更新码钱、小Y经营等插件

This commit is contained in:
技术老胡 2024-10-17 16:14:57 +08:00
parent 93f0e79632
commit 3d402cdbd6
9 changed files with 84 additions and 23 deletions

View File

@ -22,6 +22,12 @@
这样,只要账户、密码没有问题,就不存在监听掉线的情况,也就非常稳定了。 这样,只要账户、密码没有问题,就不存在监听掉线的情况,也就非常稳定了。
目前已支持的收款平台收钱吧、码钱、小Y经营、数字门店等。
正在开发的收款平台:拉卡拉、云闪付盛意旺
#### 软件架构 #### 软件架构
项目采用 THINKPHP8 + layui 2.9 + PearAdmin后台UI 开发 项目采用 THINKPHP8 + layui 2.9 + PearAdmin后台UI 开发

View File

@ -14,5 +14,6 @@ class BaseModel extends Model
{ {
use SoftDelete; use SoftDelete;
protected $deleteTime = 'delete_time'; protected $deleteTime = 'delete_time';
protected $autoWriteTimestamp = 'timestamp';
} }

View File

@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace app\controller\api;
use think\Request;
use app\model\Order;
class ConsoleController
{
public function orderinfo(Request $request)
{
$date = (int)$request->get('time') ?: 0;
$time = match ($date) {
0 => [date('Y') . '-01-01 00:00:00', date('Y-m-d 23:59:59')],
1 => [date('Y-m-d H:i:s', strtotime('-30 days')), date('Y-m-d 23:59:59')],
2 => [date('Y-m-d H:i:s', strtotime('-6 months')), date('Y-m-d 23:59:59')],
3 => [date('Y-m-d H:i:s', strtotime('-1 year')), date('Y-m-d 23:59:59')],
default => []
};
if (!$time) {
return json(['code' => 400, 'msg' => '参数错误']);
}
$orders = Order::whereBetweenTime('create_time', $time[0], $time[1])->where('state', 1)->field('id,type,really_price')->select();
$data = [
'ordernum' => count($orders),
'totalmoney' => \number_format(array_sum(array_column($orders->toArray(), 'really_price')), 2),
'wxpay' => [
'num' => count($orders->where('type', 'wxpay')),
'money' => \number_format(array_sum(array_column($orders->where('type', 'wxpay')->toArray(), 'really_price')), 2)
],
'alipay' => [
'num' => count($orders->where('type', 'alipay')),
'money' => \number_format(array_sum(array_column($orders->where('type', 'alipay')->toArray(), 'really_price')), 2)
],
'unionpay' => [
'num' => count($orders->where('type', 'unionpay')),
'money' => \number_format(array_sum(array_column($orders->where('type', 'unionpay')->toArray(), 'really_price')), 2)
]
];
return json($data);
}
}

View File

@ -53,7 +53,8 @@ class PayManageController extends BaseController
{ {
$ids = $this->request->post('ids'); $ids = $this->request->post('ids');
$res = PayAccount::destroy($ids); $res = PayAccount::destroy($ids);
if ($res) { $res2 = PayChannel::destroy($ids);
if ($res && $res2) {
return \json(\backMsg(0, '已删除')); return \json(\backMsg(0, '已删除'));
} else { } else {
return \json(\backMsg(1, '失败')); return \json(\backMsg(1, '失败'));

Binary file not shown.

Binary file not shown.

3
public/test.php Normal file
View File

@ -0,0 +1,3 @@
<?php
echo '测试用例';

View File

@ -252,11 +252,11 @@
<div id="app" class="layui-card-body"> <div id="app" class="layui-card-body">
<div class="layui-row order-total"> <div class="layui-row order-total">
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<p>1433</p> <p>{{ data.ordernum }}</p>
<p>总订单(笔)</p> <p>总订单(笔)</p>
</div> </div>
<div class="layui-col-xs6"> <div class="layui-col-xs6">
<p>12900</p> <p>{{ data.totalmoney }}</p>
<p>总金额(元)</p> <p>总金额(元)</p>
</div> </div>
</div> </div>
@ -276,8 +276,8 @@
<p>全渠道统计</p> <p>全渠道统计</p>
</div> </div>
</div> </div>
<div><strong @click="add(100)">{{ data.ordernum }}</strong></div> <div><strong>{{ data.wxpay.num }}</strong></div>
<div><strong>{{ data.totalmoney }}</strong></div> <div><strong>{{ data.wxpay.money }}</strong></div>
</div> </div>
<div class="layui-col-xs12 order-channel"> <div class="layui-col-xs12 order-channel">
<div class="info-channel"> <div class="info-channel">
@ -294,8 +294,8 @@
<p>全渠道统计</p> <p>全渠道统计</p>
</div> </div>
</div> </div>
<div><strong>50</strong></div> <div><strong>{{ data.alipay.num }}</strong></div>
<div><strong>490</strong></div> <div><strong>{{ data.alipay.money }}</strong></div>
</div> </div>
<div class="layui-col-xs12 order-channel"> <div class="layui-col-xs12 order-channel">
<div class="info-channel"> <div class="info-channel">
@ -321,8 +321,8 @@
<p>全渠道统计</p> <p>全渠道统计</p>
</div> </div>
</div> </div>
<div><strong>31</strong></div> <div><strong>{{ data.unionpay.num }}</strong></div>
<div><strong>68</strong></div> <div><strong>{{ data.unionpay.money }}</strong></div>
</div> </div>
</div> </div>
</div> </div>
@ -428,19 +428,24 @@
elem: '#order-data', elem: '#order-data',
data: [{ data: [{
title: '今年', title: '今年',
id: 'this-year', id: 0,
}, { }, {
title: '近30天', title: '近30天',
id: 'near-30days', id: 1,
}, { }, {
title: '近半年', title: '近半年',
id: 'near-halfyear', id: 2,
}, { }, {
title: '近一年', title: '近一年',
id: 'near-year', id: 3,
}], }],
click: function (obj) { click: function (obj) {
this.elem.find('span').text(obj.title); this.elem.find('span').text(obj.title);
(async () => {
const data = await fetch(`/api/Console/orderinfo?time=${obj.id}`).then(res => res.json());
const updateOrderInfo = new CustomEvent("updateOrderInfo", { detail: data });
window.dispatchEvent(updateOrderInfo);
})()
} }
}); });
@ -459,7 +464,7 @@
cols: cols, cols: cols,
skin: 'line', skin: 'line',
}); });
// 折线图
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden'); var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF'] const colorList = ["#9E87FF", '#73DDFF', '#fe9a8b', '#F56948', '#9E87FF']
var option = { var option = {
@ -556,14 +561,15 @@
createApp({ createApp({
setup() { setup() {
const data = ref({ ordernum: 100, totalmoney: 1500 }); const data = ref({ ordernum: 0, totalmoney: 0, wxpay: { num: 0, money: 0 }, alipay: { num: 0, money: 0 }, unionpay: { num: 0, money: 0 } });
function add(num) { (async () => {
data.value.ordernum += num; const info = await fetch(`/api/Console/orderinfo?time=0`).then(res => res.json());
} data.value = info;
return { })()
data, window.addEventListener("updateOrderInfo", (event) => {
add data.value = event.detail;
} });
return { data }
} }
}).mount('#app') }).mount('#app')
</script> </script>

View File

@ -245,7 +245,7 @@
} }
const rec_info = await res.json(); const rec_info = await res.json();
if (rec_info.code === 0) { if (rec_info.code === 0) {
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('orders-table') }); layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('account-table') });
} else { } else {
layer.msg(rec_info.msg, { icon: 2, time: 1200 }); layer.msg(rec_info.msg, { icon: 2, time: 1200 });
} }