diff --git a/app/controller/IndexController.php b/app/controller/IndexController.php index 53a5cd0..b75af60 100644 --- a/app/controller/IndexController.php +++ b/app/controller/IndexController.php @@ -16,6 +16,6 @@ class IndexController } public function test() { - return runtime_path(); + return request()->domain(); } } diff --git a/app/controller/OrderController.php b/app/controller/OrderController.php index 1594b38..a29f527 100644 --- a/app/controller/OrderController.php +++ b/app/controller/OrderController.php @@ -13,10 +13,7 @@ class OrderController extends BaseController public function index() { $servertime = date('Y-m-d H:i:s', time()); - // 加载配置文件 - $option = \think\facade\Config::load("extendconfig/platform", 'extendconfig'); View::assign('servertime', $servertime); - View::assign('options', $option); return View::fetch(); } public function showOrder() diff --git a/app/controller/PayController.php b/app/controller/PayController.php index 7520a88..b08fe15 100644 --- a/app/controller/PayController.php +++ b/app/controller/PayController.php @@ -234,6 +234,8 @@ class PayController } else { return '监听收款配置文件名错误'; } + // 当前站点 + $user_config['host'] = \request()->domain(); // 实例化支付类 $Mpay = new \MpayClass($user_config); // 获取订单 diff --git a/app/controller/PayManageController.php b/app/controller/PayManageController.php index c283ed2..22c799d 100644 --- a/app/controller/PayManageController.php +++ b/app/controller/PayManageController.php @@ -15,9 +15,6 @@ class PayManageController extends BaseController { public function index() { - // 加载配置文件 - $option = \think\facade\Config::load("extendconfig/platform", 'extendconfig'); - View::assign('options', $option); return View::fetch(); } // 编辑账号 @@ -25,11 +22,8 @@ class PayManageController extends BaseController { $id = $this->request->get('id'); $account = PayAccount::find($id); - // 加载配置文件 - $option = \think\facade\Config::load("extendconfig/platform", 'extendconfig'); View::assign([ 'id' => $id, - 'options' => $option, 'platform' => $account->getData('platform'), 'account' => $account->account, 'password' => $account->password, @@ -41,9 +35,6 @@ class PayManageController extends BaseController // 添加账号 public function addAccount() { - // 加载配置文件 - $option = \think\facade\Config::load("extendconfig/platform", 'extendconfig'); - View::assign(['options' => $option]); return View::fetch(); } // 添加收款终端 diff --git a/app/controller/api/PluginController.php b/app/controller/api/PluginController.php index 223bcb9..e95ff74 100644 --- a/app/controller/api/PluginController.php +++ b/app/controller/api/PluginController.php @@ -31,4 +31,10 @@ class PluginController extends BaseController return json(\backMsg(1, '失败')); } } + // 插件选项 + public function pluginOption() + { + $option = Platform::field('platform,name')->where('state', 1)->select(); + return json($option); + } } diff --git a/config/extendconfig/platform.php b/config/extendconfig/platform.php deleted file mode 100644 index d5c8fd8..0000000 --- a/config/extendconfig/platform.php +++ /dev/null @@ -1,11 +0,0 @@ - '收钱吧', - 'storepay' => '数字门店', - 'ysepay' => '小Y经营', - 'mqpay' => '码钱', -); \ No newline at end of file diff --git a/config/payconfig/1001_1.php b/config/payconfig/1001_1.php index e40f42c..e6d9119 100644 --- a/config/payconfig/1001_1.php +++ b/config/payconfig/1001_1.php @@ -6,7 +6,7 @@ return [ // 用户账号配置 'user' => [ 'pid' => 1001, - 'key' => '7ImzF6Rf8OciQcmRJv8oTNBwIp6uqF0p' + 'key' => '953c4d682d9ab148277b76a06e215ce7' ], // 收款平台账号配置 'pay' => [ @@ -14,20 +14,22 @@ return [ 'aid' => 1, // 收款平台 'platform' => 'sqbpay', + // 收款平台 + 'payclass' => 'ShouQianBa', // 账号 - 'account' => '188*****423', + 'account' => '18872410423', // 密码 - 'password' => '76********QB', + 'password' => '7698177hcnSQB', // 订单查询参数配置 - 'query' => array( - 'date_end' => NULL, - 'date_start' => NULL, - 'page' => 1, - 'page_size' => 10, - 'upayQueryType' => 0, - 'status' => '2000', - 'store_sn' => '', - 'type' => '30', - ), + 'query' => array ( + 'date_end' => NULL, + 'date_start' => NULL, + 'page' => 1, + 'page_size' => 10, + 'upayQueryType' => 0, + 'status' => '2000', + 'store_sn' => '', + 'type' => '30', +), ] ]; diff --git a/extend/MpayClass.php b/extend/MpayClass.php index 793b373..0554e07 100644 --- a/extend/MpayClass.php +++ b/extend/MpayClass.php @@ -4,15 +4,16 @@ class MpayClass { private $pid; private $key; - private $host = 'https://mpay.zhaidashi.cn/'; + private $host; private $check_neworder_url; private $submit_records_url; function __construct($config) { $this->pid = $config['pid']; $this->key = $config['key']; - $this->check_neworder_url = $this->host . 'order.php'; - $this->submit_records_url = $this->host . 'payHeart'; + $this->host = $config['host']; + $this->check_neworder_url = $this->host . '/order.php'; + $this->submit_records_url = $this->host . '/payHeart'; } // 查询新订单 public function orderHeart() diff --git a/extend/payclient/ShouQianBa.php b/extend/payclient/ShouQianBa.php index 42b8c99..fe77448 100644 --- a/extend/payclient/ShouQianBa.php +++ b/extend/payclient/ShouQianBa.php @@ -17,13 +17,13 @@ class ShouQianBa $this->username = $config['username']; $this->password = $config['password']; // 检查token目录 - $dir_path = runtime_path() . 'token/shouqianba'; + $dir_path = runtime_path() . 'token/sqbpay'; if (!is_dir($dir_path)) { if (!mkdir($dir_path, 755, true)) { echo '目录创建失败'; } } - $this->token_path = $dir_path . '/' . md5($this->username . $this->password . 'ShouQianBa') . '.json'; + $this->token_path = $dir_path . '/' . md5($this->username . $this->password . 'sqbpay') . '.json'; if (!file_exists($this->token_path)) { // 失效Token刷新 $token_info = ['token' => 'Y2FjZmRiMi04MjRjLTQ2NDgtYTU0Ny1lNzg2MDllMTQ1ZTI6MTcxOTQ1Mzg0MzU3OTozNjAwMDAw.txcnX60Za8', 'expire_time' => 1719453843579]; diff --git a/runtime/order.json b/runtime/order.json index 51b4235..78a6dd1 100644 --- a/runtime/order.json +++ b/runtime/order.json @@ -1 +1 @@ -{"code":0,"msg":"没有新订单"} \ No newline at end of file +{"code":1,"msg":"\u67091\u4e2a\u65b0\u8ba2\u5355","orders":[{"id":27428,"pid":1001,"aid":1,"cid":1,"patt":1}]} \ No newline at end of file diff --git a/view/order/index.html b/view/order/index.html index 6b06064..8fbf38c 100644 --- a/view/order/index.html +++ b/view/order/index.html @@ -64,11 +64,6 @@
@@ -128,7 +123,7 @@ let dropdown = layui.dropdown; let laydate = layui.laydate; let util = layui.util; - + // 渲染时间选择器 laydate.render({ elem: '#create_time', range: ['input[name="create_time_start"]', 'input[name="create_time_end"]'], @@ -190,8 +185,18 @@ } }] }); - - + // 渲染插件选项 + (async () => { + const data = await fetch('/api/Plugin/pluginOption').then(res => res.json()); + let option_str = ``; + data.forEach(val => { + option_str += ``; + }); + const select = document.querySelector('select[name="platform"]'); + select.innerHTML = option_str; + form.render('select'); + })() + // 表格列参数 let cols = [[ { type: 'checkbox' }, { title: '订单号', field: 'order_id', align: 'center', minWidth: 165, templet: '
{{= d.order_id }}
' }, @@ -206,7 +211,7 @@ { title: '收款平台[账号:终端]', field: 'platform', align: 'center', minWidth: 160, templet: '
{{# return`${d.payAccount.platform} [${d.aid}:${d.cid}]` }}
' }, { title: '操作', align: 'center', width: 120, fixed: 'right', templet: '
设置
' } ]] - + // 表格渲染 table.render({ id: 'orders-table', elem: '#orders-table', diff --git a/view/pay_manage/add_account.html b/view/pay_manage/add_account.html index 195bfa1..078d550 100644 --- a/view/pay_manage/add_account.html +++ b/view/pay_manage/add_account.html @@ -20,12 +20,7 @@
@@ -72,6 +67,18 @@ layui.use(['form'], function () { let form = layui.form; + // 渲染插件选项 + (async () => { + const data = await fetch('/api/Plugin/pluginOption').then(res => res.json()); + let option_str = ``; + data.forEach(val => { + option_str += ``; + }); + const select = document.querySelector('select[name="platform"]'); + select.innerHTML = option_str; + form.render('select'); + })() + form.on('submit(add-account)', function (obj) { const field = obj.field; (async () => { diff --git a/view/pay_manage/edit_account.html b/view/pay_manage/edit_account.html index 9952b67..4c66553 100644 --- a/view/pay_manage/edit_account.html +++ b/view/pay_manage/edit_account.html @@ -28,12 +28,7 @@
@@ -86,14 +81,25 @@ layui.use(['form'], function () { let form = layui.form; - form.val('edit-account', { + // 渲染插件选项 + (async () => { + const data = await fetch('/api/Plugin/pluginOption').then(res => res.json()); + let option_str = ``; + data.forEach(val => { + option_str += ``; + }); + const select = document.querySelector('select[name="platform"]'); + select.innerHTML = option_str; + form.render('select'); + // 初始化表单 + form.val('edit-account', { "platform": "", "account": "", "password": "", "state": '' == 1 ? true : false, "pattern": "", }); - + })() form.on('submit(save-account)', function (obj) { let field = obj.field; field.state = 'state' in field ? 1 : 0; diff --git a/view/pay_manage/edit_channel.html b/view/pay_manage/edit_channel.html index 8996722..25974f7 100644 --- a/view/pay_manage/edit_channel.html +++ b/view/pay_manage/edit_channel.html @@ -82,8 +82,6 @@ let form = layui.form; form.val('edit-channel', { - "platform": "", - "account": "", "channel": "", "qrcode": "", "state": '' == 1 ? true : false diff --git a/view/pay_manage/index.html b/view/pay_manage/index.html index c561ef9..ce34a41 100644 --- a/view/pay_manage/index.html +++ b/view/pay_manage/index.html @@ -17,11 +17,6 @@
@@ -92,6 +87,18 @@ let common = layui.common; let util = layui.util; + // 渲染插件选项 + (async () => { + const data = await fetch('/api/Plugin/pluginOption').then(res => res.json()); + let option_str = ``; + data.forEach(val => { + option_str += ``; + }); + const select = document.querySelector('select[name="platform"]'); + select.innerHTML = option_str; + form.render('select'); + })() + let cols = [[ { type: 'checkbox' }, { title: '平 台', field: 'platform', align: 'center', templet: '' },