You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
131 lines
3.8 KiB
131 lines
3.8 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace addon\hygl\app\adminapi\controller\config;
|
|
|
|
use core\base\BaseAdminController;
|
|
use addon\hygl\app\service\admin\config\ConfigService;
|
|
|
|
|
|
/**
|
|
* 配置项控制器
|
|
* Class Config
|
|
* @package addon\hygl\app\adminapi\controller\config
|
|
*/
|
|
class Config extends BaseAdminController
|
|
{
|
|
/**
|
|
* 获取配置项列表
|
|
* @return \think\Response
|
|
*/
|
|
public function lists(){
|
|
$data = $this->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);
|
|
}
|
|
|
|
/**
|
|
* 添加配置项
|
|
* @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');
|
|
}
|
|
|
|
|
|
}
|
|
|