feat: 新增地址选择插件及订阅消息等多项功能优化

- 新增地址选择插件,支持地图位置选择并返回地址和经纬度
- 新增微信订阅消息发送功能,支持审核结果、提现通知等场景
- 新增订单支付状态查询、提现收款人姓名保存等接口
- 新增服务区域管理,支持按省市区划分并同步到信息发布
- 新增资金流水和营收报表导出功能
- 新增可用优惠券查询、订单退款拆分处理等功能
- 优化后台角标显示、首页数据统计、UI配置下发等
- 修复订单支付并发问题、地区管理逻辑等
这个提交包含在:
2026-10-22 17:14:56 +08:00
父节点 088a08d43a
当前提交 cb12bf5fc8
共有 180 个文件被更改,包括 9695 次插入 和 1680 次删除

查看文件

@@ -57,42 +57,81 @@ class Withdraw extends Backend
if (!$withdraws) {
$this->error('提现记录不存在');
}
foreach ($withdraws as $withdraw) {
if ($op === 'pay') {
Db::name('fc_withdraw')->where('id', $withdraw['id'])->update([
'status' => 'paid',
'paytime' => time(),
'updatetime' => time(),
]);
Db::name('fc_finance_flow')->insert([
'flow_no' => 'WD' . date('YmdHis') . $withdraw['id'],
'type' => 'expense',
'scene' => '佣金提现',
'amount' => $withdraw['amount'],
'balance' => 0,
'related_id' => $withdraw['id'],
'remark' => '提现打款',
'createtime' => time(),
]);
} else {
Db::name('fc_withdraw')->where('id', $withdraw['id'])->update([
'status' => 'rejected',
'reason' => $reason,
'updatetime' => time(),
]);
$done = 0;
$pending = 0;
$failed = 0;
$errors = [];
if ($op === 'reject') {
try {
Db::transaction(function () use ($withdraws, $reason, &$done) {
foreach ($withdraws as $withdraw) {
// 行锁 + 状态校验:已处理的记录不会被二次驳回
$locked = Db::name('fc_withdraw')->where('id', $withdraw['id'])->lock(true)->find();
if (!$locked || (string)$locked['status'] !== 'auditing') {
continue;
}
$done++;
Db::name('fc_withdraw')->where('id', $locked['id'])->update([
'status' => 'rejected',
'reason' => $reason,
'updatetime' => time(),
]);
Db::name('fc_message')->insert([
'user_id' => $locked['user_id'],
'type' => 'system',
'title' => '提现驳回',
'content' => '您的提现申请「' . $locked['withdraw_no'] . '」被驳回' . ($reason ? ',原因:' . $reason : ''),
'isread' => 0,
'createtime' => time(),
]);
}
});
} catch (\Throwable $e) {
$this->error('操作失败:' . $e->getMessage());
}
Db::name('fc_message')->insert([
'user_id' => $withdraw['user_id'],
'type' => 'system',
'title' => $op === 'pay' ? '提现成功' : '提现驳回',
'content' => $op === 'pay'
? '您的提现申请「' . $withdraw['withdraw_no'] . '」已打款,金额:' . $withdraw['amount'] . '元'
: '您的提现申请「' . $withdraw['withdraw_no'] . '」被驳回' . ($reason ? ',原因:' . $reason : ''),
'isread' => 0,
'createtime' => time(),
]);
if ($done === 0) {
$this->error('选中的提现记录均已处理,请刷新后重试');
}
$this->success('驳回成功(' . $done . ' 条)');
}
$this->success($op === 'pay' ? '打款成功' : '驳回成功');
// 通过 → 逐笔发起微信商家转账(外部调用不能放在事务里)
foreach ($withdraws as $withdraw) {
if ((string)$withdraw['status'] !== 'auditing') {
continue;
}
try {
$res = \app\common\library\WxTransfer::approve((int)$withdraw['id']);
$done++;
if ($res['withdrawState'] === 'paying') {
$pending++;
} elseif ($res['withdrawState'] === 'failed') {
$failed++;
}
} catch (\Throwable $e) {
$errors[] = $withdraw['withdraw_no'] . ':' . $e->getMessage();
}
}
if ($done === 0) {
$this->error('转账失败:' . implode(';', $errors));
}
$msg = '已发起转账 ' . $done . ' 笔';
if ($pending > 0) {
$msg .= '(其中 ' . $pending . ' 笔等待用户在微信确认收款)';
}
if ($failed > 0) {
$msg .= ',' . $failed . ' 笔转账失败';
}
if ($errors) {
$msg .= ';失败 ' . count($errors) . ' 笔:' . implode(';', $errors);
}
$this->success($msg);
}