feat: 新增地址选择插件及订阅消息等多项功能优化
- 新增地址选择插件,支持地图位置选择并返回地址和经纬度 - 新增微信订阅消息发送功能,支持审核结果、提现通知等场景 - 新增订单支付状态查询、提现收款人姓名保存等接口 - 新增服务区域管理,支持按省市区划分并同步到信息发布 - 新增资金流水和营收报表导出功能 - 新增可用优惠券查询、订单退款拆分处理等功能 - 优化后台角标显示、首页数据统计、UI配置下发等 - 修复订单支付并发问题、地区管理逻辑等
这个提交包含在:
@@ -40,37 +40,43 @@ class Order extends Backend
|
||||
public function refund()
|
||||
{
|
||||
$ids = $this->request->post('ids');
|
||||
$amount = (float)$this->request->post('amount');
|
||||
$amount = $this->request->post('amount');
|
||||
$reason = $this->request->post('reason', '');
|
||||
if ($amount <= 0) {
|
||||
$this->error('退款金额需大于 0');
|
||||
}
|
||||
|
||||
$ids = is_array($ids) ? $ids : explode(',', (string)$ids);
|
||||
$ids = array_filter($ids);
|
||||
if (!$ids) {
|
||||
$this->error('请选择要退款的订单');
|
||||
}
|
||||
|
||||
$orders = Db::name('fc_order')->where('id', 'in', $ids)->select();
|
||||
if (!$orders) {
|
||||
$this->error('订单不存在');
|
||||
}
|
||||
|
||||
// 金额留空 = 按每笔订单实付金额全额退款
|
||||
$amount = ($amount === '' || $amount === null || (float)$amount <= 0) ? null : (float)$amount;
|
||||
|
||||
$ok = 0;
|
||||
$errors = [];
|
||||
foreach ($orders as $order) {
|
||||
Db::name('fc_order')->where('id', $order['id'])->update([
|
||||
'status' => 'refunded',
|
||||
'refund_amount' => $amount,
|
||||
'refund_reason' => $reason,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
Db::name('fc_message')->insert([
|
||||
'user_id' => $order['user_id'],
|
||||
'type' => 'system',
|
||||
'title' => '订单退款',
|
||||
'content' => '您的订单「' . $order['order_no'] . '」已退款' . $amount . '元' . ($reason ? ',原因:' . $reason : ''),
|
||||
'isread' => 0,
|
||||
'createtime' => time(),
|
||||
]);
|
||||
try {
|
||||
\app\common\library\OrderRefund::refund((int)$order['id'], $amount, (string)$reason);
|
||||
$ok++;
|
||||
} catch (\Throwable $e) {
|
||||
$errors[] = $order['order_no'] . ':' . $e->getMessage();
|
||||
}
|
||||
}
|
||||
$this->success('退款成功');
|
||||
|
||||
if ($ok === 0) {
|
||||
$this->error('退款失败:' . implode(';', $errors));
|
||||
}
|
||||
|
||||
$msg = '退款成功 ' . $ok . ' 笔';
|
||||
if ($errors) {
|
||||
$msg .= ',失败 ' . count($errors) . ' 笔:' . implode(';', $errors);
|
||||
}
|
||||
$this->success($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
在新工单中引用
屏蔽一个用户