mirror of
https://gitee.com/technical-laohu/mpay.git
synced 2025-09-19 02:06:38 +08:00
更新一些便捷操作
This commit is contained in:
parent
6260ad68fd
commit
cd38b4cc04
@ -15,135 +15,4 @@ class PluginController extends BaseController
|
||||
{
|
||||
return View::fetch();
|
||||
}
|
||||
/**
|
||||
* 列表
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function list(Request $request) {}
|
||||
|
||||
/**
|
||||
* 安装
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
* @throws GuzzleException|BusinessException
|
||||
*/
|
||||
public function install(Request $request) {}
|
||||
|
||||
/**
|
||||
* 卸载
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function uninstall(Request $request) {}
|
||||
|
||||
/**
|
||||
* 支付
|
||||
* @param Request $request
|
||||
* @return string|Response
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function pay(Request $request) {}
|
||||
|
||||
/**
|
||||
* 获取zip下载url
|
||||
* @param $name
|
||||
* @param $version
|
||||
* @return mixed
|
||||
* @throws BusinessException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function getDownloadUrl($name, $version) {}
|
||||
|
||||
/**
|
||||
* 下载zip
|
||||
* @param $url
|
||||
* @param $file
|
||||
* @return void
|
||||
* @throws BusinessException
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
protected function downloadZipFile($url, $file) {}
|
||||
|
||||
/**
|
||||
* 获取系统支持的解压命令
|
||||
* @param $zip_file
|
||||
* @param $extract_to
|
||||
* @return mixed|string|null
|
||||
*/
|
||||
protected function getUnzipCmd($zip_file, $extract_to)
|
||||
{
|
||||
if ($cmd = $this->findCmd('unzip')) {
|
||||
$cmd = "$cmd -o -qq $zip_file -d $extract_to";
|
||||
} else if ($cmd = $this->findCmd('7z')) {
|
||||
$cmd = "$cmd x -bb0 -y $zip_file -o$extract_to";
|
||||
} else if ($cmd = $this->findCmd('7zz')) {
|
||||
$cmd = "$cmd x -bb0 -y $zip_file -o$extract_to";
|
||||
}
|
||||
return $cmd;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用解压命令解压
|
||||
* @param $cmd
|
||||
* @return void
|
||||
* @throws BusinessException
|
||||
*/
|
||||
protected function unzipWithCmd($cmd) {}
|
||||
|
||||
/**
|
||||
* 获取已安装的插件列表
|
||||
* @return array
|
||||
*/
|
||||
protected function getLocalPlugins() {}
|
||||
|
||||
/**
|
||||
* 获取已安装的插件列表
|
||||
* @param Request $request
|
||||
* @return Response
|
||||
*/
|
||||
public function getInstalledPlugins(Request $request) {}
|
||||
|
||||
|
||||
/**
|
||||
* 获取本地插件版本
|
||||
* @param $name
|
||||
* @return array|mixed|null
|
||||
*/
|
||||
protected function getPluginVersion($name) {}
|
||||
|
||||
/**
|
||||
* 获取webman/admin版本
|
||||
* @return string
|
||||
*/
|
||||
protected function getAdminVersion() {}
|
||||
|
||||
/**
|
||||
* 删除目录
|
||||
* @param $src
|
||||
* @return void
|
||||
*/
|
||||
protected function rmDir($src) {}
|
||||
|
||||
/**
|
||||
* 获取httpclient
|
||||
* @return Client
|
||||
*/
|
||||
protected function httpClient() {}
|
||||
|
||||
/**
|
||||
* 获取下载httpclient
|
||||
* @return Client
|
||||
*/
|
||||
protected function downloadClient() {}
|
||||
|
||||
/**
|
||||
* 查找系统命令
|
||||
* @param string $name
|
||||
* @param string|null $default
|
||||
* @param array $extraDirs
|
||||
* @return mixed|string|null
|
||||
*/
|
||||
protected function findCmd(string $name, string $default = null, array $extraDirs = []) {}
|
||||
}
|
||||
|
@ -54,8 +54,12 @@ class PayManageController extends BaseController
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$res = PayAccount::destroy($ids);
|
||||
$res2 = PayChannel::destroy($ids);
|
||||
$res2 = PayChannel::whereIn('account_id', $ids)->select()->delete();
|
||||
if ($res && $res2) {
|
||||
$accs = PayAccount::whereIn('id', $ids)->withTrashed()->select();
|
||||
foreach ($accs as $acc) {
|
||||
$this->delAccountConfig($acc);
|
||||
}
|
||||
return \json(\backMsg(0, '已删除'));
|
||||
} else {
|
||||
return \json(\backMsg(1, '失败'));
|
||||
@ -105,6 +109,17 @@ class PayManageController extends BaseController
|
||||
return json(\backMsg(1, '修改失败'));
|
||||
}
|
||||
}
|
||||
// 删除收款终端
|
||||
public function delChannel()
|
||||
{
|
||||
$cid = $this->request->post('id');
|
||||
$res = PayChannel::destroy($cid);
|
||||
if ($res) {
|
||||
return \json(\backMsg(0, '已删除'));
|
||||
} else {
|
||||
return \json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 收款终端列表
|
||||
public function getChannelList()
|
||||
{
|
||||
@ -116,6 +131,15 @@ class PayManageController extends BaseController
|
||||
return \json(\backMsg(1, '失败'));
|
||||
}
|
||||
}
|
||||
// 删除账号配置
|
||||
public function delAccountConfig($acc)
|
||||
{
|
||||
$path = config_path() . "/payconfig/{$acc->pid}_{$acc->id}.php";
|
||||
if (file_exists($path)) {
|
||||
unlink($path);
|
||||
}
|
||||
}
|
||||
|
||||
// 生成账号配置
|
||||
private function createAccountConfig($acc)
|
||||
{
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 支付监听配置,一个文件,一个账号
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// 用户账号配置
|
||||
'user' => [
|
||||
'pid' => 1001,
|
||||
'key' => '953c4d682d9ab148277b76a06e215ce7'
|
||||
],
|
||||
// 收款平台账号配置
|
||||
'pay' => [
|
||||
// 账号id
|
||||
'aid' => 45,
|
||||
// 收款平台
|
||||
'platform' => 'storepay',
|
||||
// 插件类名
|
||||
'payclass' => 'ZhiHuiJingYing',
|
||||
// 账号
|
||||
'account' => '16546465',
|
||||
// 密码
|
||||
'password' => '5464564654',
|
||||
// 订单查询参数配置
|
||||
'query' => array (
|
||||
'pageNo' => 1,
|
||||
'pageSize' => 10,
|
||||
'payClient' => 4,
|
||||
'status' => 2,
|
||||
'_t' => NULL,
|
||||
'createTime_begin' => NULL,
|
||||
'createTime_end' => NULL,
|
||||
),
|
||||
]
|
||||
];
|
@ -1,35 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 支付监听配置,一个文件,一个账号
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// 用户账号配置
|
||||
'user' => [
|
||||
'pid' => 1006,
|
||||
'key' => ''
|
||||
],
|
||||
// 收款平台账号配置
|
||||
'pay' => [
|
||||
// 账号id
|
||||
'aid' => 6,
|
||||
// 收款平台
|
||||
'platform' => 'storepay',
|
||||
// 插件类名
|
||||
'payclass' => 'ZhiHuiJingYing',
|
||||
// 账号
|
||||
'account' => '18239931385',
|
||||
// 密码
|
||||
'password' => '12345678',
|
||||
// 订单查询参数配置
|
||||
'query' => array (
|
||||
'pageNo' => 1,
|
||||
'pageSize' => 10,
|
||||
'payClient' => 4,
|
||||
'status' => 2,
|
||||
'_t' => NULL,
|
||||
'createTime_begin' => NULL,
|
||||
'createTime_end' => NULL,
|
||||
),
|
||||
]
|
||||
];
|
@ -53,11 +53,11 @@
|
||||
})()
|
||||
},
|
||||
edit: function () {
|
||||
const cid = this.getAttribute("data-cid")
|
||||
const cid = this.getAttribute("data-cid");
|
||||
layer.open({
|
||||
id: 'iframe-channel-edit',
|
||||
type: 2,
|
||||
title: '添加收款终端',
|
||||
title: '修改终端',
|
||||
shade: 0.1,
|
||||
area: [common.isModile() ? '80%' : '400px', common.isModile() ? '70%' : '300px'],
|
||||
content: `/PayManage/editChannel?cid=${cid}`,
|
||||
@ -74,6 +74,24 @@
|
||||
content: `/PayManage/addChannel?aid=${aid}`,
|
||||
});
|
||||
},
|
||||
delete: function () {
|
||||
const cid = this.getAttribute("data-cid");
|
||||
layer.confirm('确定删除终端?', { icon: 3, title: '提示' },
|
||||
function (index) {
|
||||
fetch('/api/PayManage/delChannel', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ id: cid }) })
|
||||
.then(res => res.json())
|
||||
.then(res => {
|
||||
if (res.code === 0) {
|
||||
layer.msg(res.msg, { icon: 1, time: 1200 }, function () {
|
||||
location.reload();
|
||||
});
|
||||
} else {
|
||||
layer.msg(res.msg, { icon: 2, time: 1200 });
|
||||
}
|
||||
})
|
||||
layer.close(index);
|
||||
});
|
||||
},
|
||||
});
|
||||
// 工具
|
||||
let channel = {};
|
||||
@ -89,7 +107,10 @@
|
||||
<a href="javascript:;" class="layui-font-blue" lay-on="getQrcode"data-qrcode="${item.qrcode}"><span class="icon pear-icon"></span></a><br>
|
||||
<span class="layui-badge layui-bg-cyan">最后使用</span><span class="layui-badge layui-bg-gray">${item.last_time}</span><br>
|
||||
<span class="layui-badge layui-bg-cyan">启用状态</span><span class="layui-badge layui-bg-${item.state == 1 ? 'green' : 'gray'}">${item.state == 1 ? '启用' : '禁用'}</span><br>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-radius layui-border-green layui-btn-sm edit" lay-on="edit" data-cid="${item.id}"><span class="icon pear-icon"></span>修改</button>
|
||||
<div class="layui-btn-group edit">
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm" lay-on="edit" data-cid="${item.id}"><span class="icon pear-icon"></span></button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-sm" lay-on="delete" data-cid="${item.id}"><span class="icon pear-icon"></span></button>
|
||||
</div>
|
||||
</div>`;
|
||||
card.innerHTML = htmlstr;
|
||||
return card;
|
||||
|
@ -60,9 +60,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">查询参数</label>
|
||||
<label class="layui-form-label">查询参数
|
||||
<a href="https://www.jyshare.com/front-end/53/" class="layui-font-blue" style="float: right;" target="_blank">
|
||||
<span class="layui-font-gray">JSON工具 </span><span class="icon pear-icon"></span>
|
||||
</a>
|
||||
</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="params" placeholder="账号订单查询自定义参数,JSON格式,没有请填 { } " class="layui-textarea"></textarea>
|
||||
<textarea name="params" placeholder="账号订单查询自定义参数,JSON格式,没有请勿填写!"
|
||||
class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -111,6 +116,7 @@
|
||||
let field = obj.field;
|
||||
field.state = 'state' in field ? 1 : 0;
|
||||
field.id = '<?php echo $id ?>';
|
||||
field.params = field.params === '' ? '{}' : field.params;
|
||||
(async () => {
|
||||
const url = '/api/PayManage/editAccount';
|
||||
const info = field;
|
||||
|
Loading…
Reference in New Issue
Block a user