feat: 新增地址选择插件及订阅消息等多项功能优化
- 新增地址选择插件,支持地图位置选择并返回地址和经纬度 - 新增微信订阅消息发送功能,支持审核结果、提现通知等场景 - 新增订单支付状态查询、提现收款人姓名保存等接口 - 新增服务区域管理,支持按省市区划分并同步到信息发布 - 新增资金流水和营收报表导出功能 - 新增可用优惠券查询、订单退款拆分处理等功能 - 优化后台角标显示、首页数据统计、UI配置下发等 - 修复订单支付并发问题、地区管理逻辑等
这个提交包含在:
@@ -114,6 +114,57 @@ class Coupon extends V1
|
||||
$this->ok(['userCouponId' => $userCouponId]);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/coupon/usable?amount=xx
|
||||
* 下单可用券列表(按金额计算可抵扣金额)
|
||||
*/
|
||||
public function usable()
|
||||
{
|
||||
$this->assertEnabled();
|
||||
$user = $this->auth();
|
||||
|
||||
$amount = round((float)$this->input('amount', 0), 2);
|
||||
if ($amount <= 0) {
|
||||
$this->ok([]);
|
||||
}
|
||||
|
||||
$now = time();
|
||||
$rows = Db::name('fc_user_coupon')->alias('uc')
|
||||
->join('fc_coupon c', 'c.id = uc.coupon_id')
|
||||
->where('uc.user_id', $user['id'])
|
||||
->where('uc.status', 'unused')
|
||||
->where('c.enabled', 1)
|
||||
->where('c.min_amount', '<=', $amount)
|
||||
->where(function ($q) use ($now) {
|
||||
$q->whereNull('uc.expiretime')->whereOr('uc.expiretime', '>', $now);
|
||||
})
|
||||
->field('uc.id,uc.coupon_id,uc.expiretime,c.name,c.type,c.amount,c.min_amount')
|
||||
->order('c.sort desc, c.id desc')
|
||||
->select();
|
||||
|
||||
$list = [];
|
||||
foreach ($rows as $row) {
|
||||
try {
|
||||
$p = \app\common\library\CouponService::preview($user['id'], (int)$row['id'], $amount);
|
||||
} catch (\Throwable $e) {
|
||||
continue;
|
||||
}
|
||||
$list[] = [
|
||||
'userCouponId' => (int)$row['id'],
|
||||
'couponId' => (int)$row['coupon_id'],
|
||||
'name' => (string)$row['name'],
|
||||
'type' => (string)$row['type'],
|
||||
'amount' => (float)$row['amount'],
|
||||
'minAmount' => (float)$row['min_amount'],
|
||||
'discount' => $p['discount'],
|
||||
'payable' => $p['payable'],
|
||||
'expireAt' => !empty($row['expiretime']) ? $this->iso($row['expiretime']) : null,
|
||||
];
|
||||
}
|
||||
|
||||
$this->ok($list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 券模板 → 列表项
|
||||
* @param array $row fc_coupon 行
|
||||
|
||||
在新工单中引用
屏蔽一个用户