mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-11-13 14:13:43 +08:00
支持微信支付宝收款功能
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use think\facade\Log;
|
||||
use think\facade\View;
|
||||
|
||||
class IndexController
|
||||
@@ -21,7 +22,17 @@ class IndexController
|
||||
}
|
||||
public function test()
|
||||
{
|
||||
$web = \request()->domain();
|
||||
return $web;
|
||||
$info = request()->post();
|
||||
$action = isset($info['action']) ? $info['action'] : '';
|
||||
if ($action === 'mpay') {
|
||||
$data = json_decode($info['data'], true);
|
||||
$config = \think\facade\Config::load("payconfig/{$data['pid']}_{$data['aid']}", 'payconfig');
|
||||
$payclient_path = "\\payclient\\Mpay";
|
||||
$Payclient = new $payclient_path($info, $config);
|
||||
$res = $Payclient->notify($info);
|
||||
return $res;
|
||||
} else {
|
||||
return 202;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,12 @@ class PayManageController extends BaseController
|
||||
public function addChannel()
|
||||
{
|
||||
$aid = $this->request->get('aid');
|
||||
View::assign(['aid' => $aid]);
|
||||
$account = PayAccount::find($aid);
|
||||
$platform = $account->getData('platform');
|
||||
View::assign(['aid' => $aid, 'platform' => $platform, 'account' => $account->account]);
|
||||
if ($platform == 'wxpay' || $platform == 'alipay') {
|
||||
return View::fetch('add_channel_code');
|
||||
}
|
||||
return View::fetch();
|
||||
}
|
||||
// 编辑收款终端
|
||||
|
||||
@@ -22,6 +22,50 @@ class PayManageController extends BaseController
|
||||
return json(['code' => 1, 'msg' => '无数据记录', 'count' => 0, 'data' => []]);
|
||||
}
|
||||
}
|
||||
// 收款终端列表
|
||||
public function getChannelList()
|
||||
{
|
||||
$aid = $this->request->post('aid');
|
||||
$res = PayChannel::where(['account_id' => $aid])->order('last_time', 'desc')->select();
|
||||
if ($res) {
|
||||
return \json(\backMsg(0, '获取成功', $res));
|
||||
} else {
|
||||
return \json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 账号状态
|
||||
public function accountEnable()
|
||||
{
|
||||
$info = $this->request->post();
|
||||
$up_res = PayAccount::update($info);
|
||||
if ($up_res) {
|
||||
return json(\backMsg(0, '成功'));
|
||||
} else {
|
||||
return json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 添加账号
|
||||
public function addAccount()
|
||||
{
|
||||
$info = $this->request->post();
|
||||
$pid = $this->request->session('pid');
|
||||
$info['pid'] = $pid;
|
||||
$info['params'] = '{}';
|
||||
$check_acc = PayAccount::where(['account' => $info['account'], 'platform' => $info['platform'], 'pid' => $pid])->find();
|
||||
if ($check_acc) {
|
||||
return \json(\backMsg(1, '账号已存在'));
|
||||
}
|
||||
$acc = PayAccount::create($info);
|
||||
if ($acc) {
|
||||
$state = $this->createAccountConfig($acc);
|
||||
if (!$state) {
|
||||
return json(\backMsg(1, '自字义参数错误'));
|
||||
}
|
||||
return \json(\backMsg(0, '添加成功'));
|
||||
} else {
|
||||
return \json(\backMsg(1, '添加失败'));
|
||||
}
|
||||
}
|
||||
// 编辑账号
|
||||
public function editAccount()
|
||||
{
|
||||
@@ -38,17 +82,6 @@ class PayManageController extends BaseController
|
||||
return json(\backMsg(1, '修改失败'));
|
||||
}
|
||||
}
|
||||
// 账号状态
|
||||
public function accountEnable()
|
||||
{
|
||||
$info = $this->request->post();
|
||||
$up_res = PayAccount::update($info);
|
||||
if ($up_res) {
|
||||
return json(\backMsg(0, '成功'));
|
||||
} else {
|
||||
return json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 删除账号
|
||||
public function delAccount()
|
||||
{
|
||||
@@ -65,32 +98,14 @@ class PayManageController extends BaseController
|
||||
return \json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 添加账号
|
||||
public function addAccount()
|
||||
{
|
||||
$info = $this->request->post();
|
||||
$pid = $this->request->session('pid');
|
||||
$info['pid'] = $pid;
|
||||
$info['params'] = '{}';
|
||||
$check_acc = PayAccount::where(['account' => $info['account'], 'pid' => $pid])->find();
|
||||
if ($check_acc) {
|
||||
return \json(\backMsg(1, '账号已存在'));
|
||||
}
|
||||
$acc = PayAccount::create($info);
|
||||
if ($acc) {
|
||||
$state = $this->createAccountConfig($acc);
|
||||
if (!$state) {
|
||||
return json(\backMsg(1, '自字义参数错误'));
|
||||
}
|
||||
return \json(\backMsg(0, '添加成功'));
|
||||
} else {
|
||||
return \json(\backMsg(1, '添加失败'));
|
||||
}
|
||||
}
|
||||
// 添加收款终端
|
||||
public function addChannel()
|
||||
{
|
||||
$info = $this->request->post();
|
||||
$check = PayChannel::where(['account_id' => $info['account_id'], 'channel' => $info['channel']])->count();
|
||||
if ($check) {
|
||||
return \json(\backMsg(1, '编号已存在'));
|
||||
}
|
||||
$res = PayChannel::create($info);
|
||||
if ($res) {
|
||||
return \json(\backMsg(0, '添加成功'));
|
||||
@@ -120,17 +135,6 @@ class PayManageController extends BaseController
|
||||
return \json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 收款终端列表
|
||||
public function getChannelList()
|
||||
{
|
||||
$aid = $this->request->post('aid');
|
||||
$res = PayChannel::where(['account_id' => $aid])->order('last_time', 'desc')->select();
|
||||
if ($res) {
|
||||
return \json(\backMsg(0, '获取成功', $res));
|
||||
} else {
|
||||
return \json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 删除账号配置
|
||||
public function delAccountConfig($acc)
|
||||
{
|
||||
|
||||
@@ -18,14 +18,6 @@ class PluginController extends BaseController
|
||||
return json(['code' => 1, 'msg' => '无数据记录', 'count' => 0, 'data' => []]);
|
||||
}
|
||||
}
|
||||
// 测试
|
||||
public function test()
|
||||
{
|
||||
// $res = $this->addPlugin(['platform' => 'haopay', 'name' => '好支付', 'class_name' => 'Haopay', 'price' => 99, 'describe' => '好支付', 'website' => 'https://store.zhihuijingyingba.com/', 'state' => 1, 'query' => []]);
|
||||
// $res = $this->delPlugin('haopay');
|
||||
$res = $this->setPlugin('haopay', ['state' => 0]);
|
||||
return $res;
|
||||
}
|
||||
// 添加插件
|
||||
public function addPlugin(array $option = [])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user