chore: 新增epay和cos插件相关类库及配置文件

- 新增epay v2、v3、v3new版本的支付类库及证书文件
- 新增cos云存储类库文件
- 调整文件上传保存格式为按分类存储
- 修复会员、规则、类目等语言翻译键名
- 新增小程序图标等静态资源文件
这个提交包含在:
YuanWen
2026-11-04 09:33:57 +08:00
父节点 361dffc7d8
当前提交 78d45eea74
共有 1176 个文件被更改,包括 102605 次插入 和 4357 次删除

查看文件

@@ -24,6 +24,12 @@ class Order extends Base
*/
public function create()
{
// 频次防刷限制:同一用户 3 秒内禁止连续下单,防并发重复创单
$lastOrderTime = Db::name('order')->where('user_id', $this->uid())->order('id desc')->value('createtime');
if ($lastOrderTime && (time() - (int)$lastOrderTime) < 3) {
$this->error('操作过于频繁,请稍候再试');
}
$serviceId = (int)$this->request->post('service_id');
$addressId = (int)$this->request->post('address_id');
$appointTime = (int)$this->request->post('appoint_time', 0);
@@ -203,6 +209,22 @@ class Order extends Base
'custom' => '用户自主定价',
'range' => '按面积计价',
];
if (!empty($goodsList) && is_array($goodsList)) {
foreach ($goodsList as $g) {
Db::name('order_goods')->insert([
'order_id' => (int)$id,
'service_id' => isset($g['service_id']) ? (int)$g['service_id'] : (int)$serviceId,
'goods_name' => isset($g['goods_name']) ? (string)$g['goods_name'] : (string)$serviceName,
'goods_model' => isset($g['goods_model']) ? (string)$g['goods_model'] : (string)$goodsModel,
'goods_num' => isset($g['goods_num']) ? max(1, (int)$g['goods_num']) : 1,
'goods_image' => isset($g['goods_image']) ? (string)$g['goods_image'] : '',
'addon_services' => isset($g['addon_services']) ? (string)$g['addon_services'] : '',
'base_price' => isset($g['base_price']) ? (float)$g['base_price'] : (float)$amount['base_amount'],
'createtime' => time(),
]);
}
}
$this->addLog($id, OrderStatus::PENDING_PAY, '用户下单(' . (isset($modeText[$priceType]) ? $modeText[$priceType] : '一口价') . ')', 'user', $this->uid());
$this->success('下单成功', [
@@ -259,12 +281,63 @@ class Order extends Base
$this->error('支付失败:' . $e->getMessage());
}
// 订单广播通知:进入接单大厅后,通知周边在线师傅
if ($nextStatus === OrderStatus::PENDING_ACCEPT) {
try {
$masters = Db::name('master')->where('status', 'normal')->limit(20)->select();
foreach ($masters as $m) {
$this->notify('master', (int)$m['user_id'], '新工单就绪通知', '同城有新工单【' . $order['order_no'] . '】进入接单大厅,请尽快前往抢单!', 'order', $orderId);
}
} catch (\Exception $e) {}
}
$this->success('支付成功');
}
/**
* 我的订单列表
*/
/**
* 用户在线支付施工增项补差价
* @ApiMethod (POST)
*/
public function payDiff()
{
$orderId = (int)$this->request->post('order_id');
$order = $this->ownOrder($orderId, 'user');
if ((int)$order['diff_status'] !== 1 || (float)$order['diff_amount'] <= 0) {
$this->error('当前订单无待支付的增项补差价');
}
$diffAmount = (float)$order['diff_amount'];
$newPayAmount = round((float)$order['pay_amount'] + $diffAmount, 2);
Db::startTrans();
try {
Db::name('order')->where('id', $orderId)->update([
'diff_status' => 2,
'pay_amount' => $newPayAmount,
'updatetime' => time(),
]);
$this->addLog($orderId, (int)$order['status'], '用户在线支付施工增项补差价 ¥' . $diffAmount, 'user', $this->uid());
Db::commit();
} catch (\Exception $e) {
Db::rollback();
$this->error('支付失败:' . $e->getMessage());
}
if ((int)$order['master_id'] > 0) {
$m = Db::name('master')->where('id', $order['master_id'])->find();
if ($m) {
$this->notify('master', (int)$m['user_id'], '客户已支付增项补差价', '工单 ' . $order['order_no'] . ' 客户已支付增项补差价 ¥' . $diffAmount, 'order', $orderId);
}
}
$this->success('增项补差价支付成功!', ['pay_amount' => $newPayAmount]);
}
public function index()
{
$status = $this->request->param('status', 'all');
@@ -378,6 +451,7 @@ class Order extends Base
$this->success('', [
'order' => $this->formatOrder($order),
'goods_list' => Db::name('order_goods')->where('order_id', $orderId)->select(),
'master' => $master,
'logs' => $logs,
'media' => $media,
@@ -631,6 +705,12 @@ class Order extends Base
'urgent' => (int)$row['urgent'],
'price_type_text' => $this->priceTypeText($row['price_type']),
'is_order_owner' => (int)$row['user_id'] === $this->uid(),
'diff_amount' => isset($row['diff_amount']) ? (float)$row['diff_amount'] : 0.00,
'diff_status' => isset($row['diff_status']) ? (int)$row['diff_status'] : 0,
'diff_remark' => isset($row['diff_remark']) ? (string)$row['diff_remark'] : '',
'diff_image' => isset($row['diff_image']) ? (string)$row['diff_image'] : '',
'empty_run_fee' => isset($row['empty_run_fee']) ? (float)$row['empty_run_fee'] : 0.00,
'auto_quote_timeout' => isset($row['auto_quote_timeout']) ? (int)$row['auto_quote_timeout'] : 0,
]);
}