request->params([ ]); return success((new ConfigService())->getPage($data)); } /** * 配置项详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new ConfigService())->getInfo($id)); } /** * 重新生成H5站点二维码 * @param int $id * @return \think\Response */ public function resetH5SiteQRCode(int $id){ $qrcode = (new ConfigService())->resetH5SiteQRCode($id); $res = [ 'url'=>$qrcode['url'], 'ol_url'=>$qrcode['ol_url'] ]; return success($res); } /** * 重新生成H5站点二维码 * @param int $id * @return \think\Response */ public function resetMiniAppQRCode(int $id){ $qrcode = (new ConfigService())->resetMiniAppQRCode($id); $res = [ 'url'=>$qrcode['url'], 'ol_url'=>$qrcode['ol_url'] ]; return success($res); } /** * 添加配置项 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["we_chat_pay_appid",""], ["we_chat_pay_app_id",""], ["we_chat_pay_miniapp_id",""], ["we_chat_pay_mch_id",""], ["we_chat_pay_key",""], ["we_chat_pay_miniapp_secret",""], ["we_chat_pay_notify_url",""], ["alipay_appId",""], ["alipay_rsa_private_key",""], ["alipay_public_key",""], ["alipay_notify_url",""], ["we_chat_pay_mch_secret_cert",""], ["we_chat_pay_mch_public_cert_path",""], ]); $this->validate($data, 'addon\hygl\app\validate\config\Config.add'); $id = (new ConfigService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 配置项编辑 * @param $id 配置项id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["we_chat_pay_appid",""], ["we_chat_pay_app_id",""], ["we_chat_pay_miniapp_id",""], ["we_chat_pay_mch_id",""], ["we_chat_pay_key",""], ["we_chat_pay_miniapp_secret",""], ["we_chat_pay_notify_url",""], // ["alipay_appId",""], // ["alipay_rsa_private_key",""], // ["alipay_public_key",""], // ["alipay_notify_url",""], ["h5_qrcode_url",""], ["we_chat_pay_mch_secret_cert",""], ["we_chat_pay_mch_public_cert_path",""], ]); if (!$data['we_chat_pay_mch_secret_cert'] || !$data['we_chat_pay_mch_public_cert_path']){ return fail('微信商户私钥或商户公钥不能为空'); } $this->validate($data, 'addon\hygl\app\validate\config\Config.edit'); (new ConfigService())->edit($data); return success('EDIT_SUCCESS'); } /** * 配置项删除 * @param $id 配置项id * @return \think\Response */ public function del(int $id){ (new ConfigService())->del($id); return success('DELETE_SUCCESS'); } }