mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-09-21 03:06:39 +08:00
调整支付逻辑
This commit is contained in:
parent
7de80febbb
commit
2447ebd52d
36
README.en.md
36
README.en.md
@ -1,36 +0,0 @@
|
|||||||
# 码支付
|
|
||||||
|
|
||||||
#### Description
|
|
||||||
个人使用,聚合收款码收款回调通知。
|
|
||||||
|
|
||||||
#### Software Architecture
|
|
||||||
Software architecture description
|
|
||||||
|
|
||||||
#### Installation
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### Instructions
|
|
||||||
|
|
||||||
1. xxxx
|
|
||||||
2. xxxx
|
|
||||||
3. xxxx
|
|
||||||
|
|
||||||
#### Contribution
|
|
||||||
|
|
||||||
1. Fork the repository
|
|
||||||
2. Create Feat_xxx branch
|
|
||||||
3. Commit your code
|
|
||||||
4. Create Pull Request
|
|
||||||
|
|
||||||
|
|
||||||
#### Gitee Feature
|
|
||||||
|
|
||||||
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
|
|
||||||
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
|
|
||||||
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
|
|
||||||
4. The most valuable open source project [GVP](https://gitee.com/gvp)
|
|
||||||
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
|
|
||||||
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
|
|
@ -208,7 +208,7 @@ class PayController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [定时任务]监听新订单
|
// [定时任务]监听新订单,生成JSON文件信息
|
||||||
public function checkOrder($pid = '', $sign = '')
|
public function checkOrder($pid = '', $sign = '')
|
||||||
{
|
{
|
||||||
if (!($pid && $sign)) {
|
if (!($pid && $sign)) {
|
||||||
@ -240,7 +240,7 @@ class PayController
|
|||||||
return json($info);
|
return json($info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// [定时任务]监听收款通知
|
// 获取收款通知,提交收款订单明细
|
||||||
public function checkPayResult(Request $request)
|
public function checkPayResult(Request $request)
|
||||||
{
|
{
|
||||||
$req_info = $request->get();
|
$req_info = $request->get();
|
||||||
|
@ -8,6 +8,7 @@ use app\BaseController;
|
|||||||
use app\model\PayAccount;
|
use app\model\PayAccount;
|
||||||
use app\model\PayChannel;
|
use app\model\PayChannel;
|
||||||
use app\model\Platform;
|
use app\model\Platform;
|
||||||
|
use app\model\User;
|
||||||
use think\facade\View;
|
use think\facade\View;
|
||||||
|
|
||||||
class PayManageController extends BaseController
|
class PayManageController extends BaseController
|
||||||
@ -29,6 +30,8 @@ class PayManageController extends BaseController
|
|||||||
$info = $this->request->post();
|
$info = $this->request->post();
|
||||||
$up_res = PayAccount::update($info);
|
$up_res = PayAccount::update($info);
|
||||||
if ($up_res) {
|
if ($up_res) {
|
||||||
|
$acc = PayAccount::find($info['id']);
|
||||||
|
$this->createAccountConfig($acc);
|
||||||
return json(\backMsg(0, '修改成功'));
|
return json(\backMsg(0, '修改成功'));
|
||||||
} else {
|
} else {
|
||||||
return json(\backMsg(1, '修改失败'));
|
return json(\backMsg(1, '修改失败'));
|
||||||
@ -62,8 +65,9 @@ class PayManageController extends BaseController
|
|||||||
$info = $this->request->post();
|
$info = $this->request->post();
|
||||||
$pid = $this->request->session('pid');
|
$pid = $this->request->session('pid');
|
||||||
$info['pid'] = $pid;
|
$info['pid'] = $pid;
|
||||||
$res = PayAccount::create($info);
|
$acc = PayAccount::create($info);
|
||||||
if ($res) {
|
if ($acc) {
|
||||||
|
$this->createAccountConfig($acc);
|
||||||
return \json(\backMsg(0, '添加成功'));
|
return \json(\backMsg(0, '添加成功'));
|
||||||
} else {
|
} else {
|
||||||
return \json(\backMsg(1, '添加失败'));
|
return \json(\backMsg(1, '添加失败'));
|
||||||
@ -103,37 +107,24 @@ class PayManageController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 生成账号配置
|
// 生成账号配置
|
||||||
public function createAccountConfig()
|
private function createAccountConfig($acc)
|
||||||
{
|
{
|
||||||
$query = [
|
$platform = Platform::where('platform', $acc->getData('platform'))->find();
|
||||||
"date_end" => null,
|
$user = User::where('pid', $acc->pid)->find();
|
||||||
"date_start" => null,
|
$query = \unserialize($platform->query);
|
||||||
"page" => 1,
|
|
||||||
"page_size" => 10,
|
|
||||||
"upayQueryType" => 0,
|
|
||||||
"status" => "2000",
|
|
||||||
"store_sn" => "",
|
|
||||||
"type" => "30"
|
|
||||||
];
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'pid' => 1001,
|
'pid' => $user->pid,
|
||||||
'key' => '154556b80a3f02ab6b57d4199cd6ebdf',
|
'key' => $user->secret_key,
|
||||||
'aid' => 1,
|
'aid' => $acc->id,
|
||||||
'platform' => 'sqbpay',
|
'platform' => $acc->getData('platform'),
|
||||||
'account' => '18872410423',
|
'account' => $acc->account,
|
||||||
'password' => '7698177hcnSQB',
|
'password' => $acc->password,
|
||||||
'query' => \var_export($query, \true)
|
'query' => \var_export($query, \true)
|
||||||
];
|
];
|
||||||
$config = View::fetch('tpl/account_config', $data);
|
$config = View::fetch('tpl/account_config', $data);
|
||||||
$name = "{$data['pid']}_{$data['aid']}";
|
$name = "{$data['pid']}_{$data['aid']}";
|
||||||
$path = "../config/payconfig/{$name}.php";
|
$path = "../config/payconfig/{$name}.php";
|
||||||
$res = \file_put_contents($path, $config);
|
\file_put_contents($path, $config);
|
||||||
if ($res) {
|
|
||||||
return \json(\backMsg(msg: '创建成功'));
|
|
||||||
} else {
|
|
||||||
return \json(\backMsg(1, '创建成功'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 生成平台列表配置
|
// 生成平台列表配置
|
||||||
public function crtPlfConfig()
|
public function crtPlfConfig()
|
||||||
|
@ -9,10 +9,7 @@ use app\model\Platform;
|
|||||||
|
|
||||||
class PluginController extends BaseController
|
class PluginController extends BaseController
|
||||||
{
|
{
|
||||||
public function index()
|
// 插件列表
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
public function getPluginList()
|
public function getPluginList()
|
||||||
{
|
{
|
||||||
$query = $this->request->get();
|
$query = $this->request->get();
|
||||||
@ -23,4 +20,15 @@ class PluginController extends BaseController
|
|||||||
return json(['code' => 1, 'msg' => '无数据记录', 'count' => 0, 'data' => []]);
|
return json(['code' => 1, 'msg' => '无数据记录', 'count' => 0, 'data' => []]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 插件启用
|
||||||
|
public function pluginEnable()
|
||||||
|
{
|
||||||
|
$info = $this->request->post();
|
||||||
|
$up_res = Platform::update($info);
|
||||||
|
if ($up_res) {
|
||||||
|
return json(\backMsg(0, '成功'));
|
||||||
|
} else {
|
||||||
|
return json(\backMsg(1, '失败'));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
33
config/payconfig/1001_39.php
Normal file
33
config/payconfig/1001_39.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 支付监听配置,一个文件,一个账号
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
return [
|
||||||
|
// 用户账号配置
|
||||||
|
'user' => [
|
||||||
|
'pid' => 1001,
|
||||||
|
'key' => '7ImzF6Rf8OciQcmRJv8oTNBwIp6uqF0p'
|
||||||
|
],
|
||||||
|
// 收款平台账号配置
|
||||||
|
'pay' => [
|
||||||
|
// 账号id
|
||||||
|
'aid' => 39,
|
||||||
|
// 收款平台
|
||||||
|
'platform' => 'sqbpay',
|
||||||
|
// 账号
|
||||||
|
'account' => '18727623516',
|
||||||
|
// 密码
|
||||||
|
'password' => '123456',
|
||||||
|
// 订单查询参数配置
|
||||||
|
'query' => array (
|
||||||
|
'date_end' => NULL,
|
||||||
|
'date_start' => NULL,
|
||||||
|
'page' => 1,
|
||||||
|
'page_size' => 10,
|
||||||
|
'upayQueryType' => 0,
|
||||||
|
'status' => '2000',
|
||||||
|
'store_sn' => '',
|
||||||
|
'type' => '30',
|
||||||
|
),
|
||||||
|
]
|
||||||
|
];
|
37
config/payconfig/1001_40.php
Normal file
37
config/payconfig/1001_40.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 支付监听配置,一个文件,一个账号
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
return [
|
||||||
|
// 用户账号配置
|
||||||
|
'user' => [
|
||||||
|
'pid' => 1001,
|
||||||
|
'key' => '7ImzF6Rf8OciQcmRJv8oTNBwIp6uqF0p'
|
||||||
|
],
|
||||||
|
// 收款平台账号配置
|
||||||
|
'pay' => [
|
||||||
|
// 账号id
|
||||||
|
'aid' => 40,
|
||||||
|
// 收款平台
|
||||||
|
'platform' => 'mqpay',
|
||||||
|
// 账号
|
||||||
|
'account' => '258000000',
|
||||||
|
// 密码
|
||||||
|
'password' => '123456',
|
||||||
|
// 订单查询参数配置
|
||||||
|
'query' => array (
|
||||||
|
'terminalType' => '',
|
||||||
|
'payType' => '',
|
||||||
|
'payMode' => '',
|
||||||
|
'tradeStatus' => '1',
|
||||||
|
'tradeNo' => '',
|
||||||
|
'storeId' => '',
|
||||||
|
'page' => 1,
|
||||||
|
'rows' => 10,
|
||||||
|
'endDate' => NULL,
|
||||||
|
'endTime' => NULL,
|
||||||
|
'startDate' => NULL,
|
||||||
|
'startTime' => NULL,
|
||||||
|
),
|
||||||
|
]
|
||||||
|
];
|
@ -107,7 +107,7 @@
|
|||||||
const state = obj.elem.checked == true ? 1 : 0;
|
const state = obj.elem.checked == true ? 1 : 0;
|
||||||
const id = obj.value;
|
const id = obj.value;
|
||||||
const field = { state: state, id: id };
|
const field = { state: state, id: id };
|
||||||
layer.msg(id + ', ' + state);
|
plugin.enable(obj, field);
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -124,6 +124,20 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// 启用
|
||||||
|
plugin.enable = async (obj, field) => {
|
||||||
|
const res = await fetch('/api/Plugin/pluginEnable', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(field) });
|
||||||
|
if (res.status !== 200) {
|
||||||
|
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 }, () => { obj.elem.checked = !obj.elem.checked });
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const rec_info = await res.json();
|
||||||
|
if (rec_info.code === 0) {
|
||||||
|
layer.tips(rec_info.msg, obj.othis, { tips: 1, time: 1200 });
|
||||||
|
} else {
|
||||||
|
layer.msg(rec_info.msg, { icon: 2, time: 1200 }, () => { obj.elem.checked = !obj.elem.checked });
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
Reference in New Issue
Block a user