1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\jobs\order;
- use app\services\order\StoreOrderStatusServices;
- use crmeb\basic\BaseJobs;
- use crmeb\traits\QueueTrait;
- class OrderStatusJob extends BaseJobs
- {
- use QueueTrait;
- public function doJob($orderId, $group, $totalPrice, $payPrice)
- {
-
- $statusService = app()->make(StoreOrderStatusServices::class);
- $statusService->save([
- 'oid' => $orderId,
- 'change_type' => 'cache_key_create_order',
- 'change_message' => '订单生成',
- 'change_time' => time()
- ]);
- if (isset($group['changePrice']) && $group['changePrice'] > 0) {
- $totalPrice = $group['priceData']['pay_price'] ?? $totalPrice;
- $statusService->save([
- 'oid' => $orderId,
- 'change_type' => 'order_edit',
- 'change_time' => time(),
- 'change_message' => '商品总价为:' . $totalPrice . ' 修改实际支付金额为:' . $payPrice
- ]);
- }
- return true;
- }
-
- public function savePayStatus($oid)
- {
- if (!$oid) {
- return true;
- }
-
- $statusService = app()->make(StoreOrderStatusServices::class);
- $statusService->save([
- 'oid' => $oid,
- 'change_type' => 'pay_success',
- 'change_message' => '用户付款成功',
- 'change_time' => time()
- ]);
- return true;
- }
- }
|