diff --git a/app/common/service/JgPush.php b/app/common/service/JgPush.php index 8b792781..5c41bc5f 100644 --- a/app/common/service/JgPush.php +++ b/app/common/service/JgPush.php @@ -2,6 +2,7 @@ namespace app\common\service; +use app\common\model\store\order\StoreGroupOrder; use app\common\model\system\merchant\Merchant; use app\common\model\user\User; use app\common\repositories\store\order\StoreGroupOrderRepository; @@ -34,9 +35,10 @@ class JgPush if (empty($jgRegisterId)) { continue; } + $msg = $order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY ? '您有新的订单已结算,请注意查看。' : '您有新的订单,请注意查看。'; $this->addRegistrationId($jgRegisterId); - $this->androidNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route]]); - $this->iosNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route]]); + $this->androidNotification($msg, ['extras' => ['route' => $route]]); + $this->iosNotification($msg, ['extras' => ['route' => $route]]); $this->push->send(); } } @@ -67,6 +69,22 @@ class JgPush $this->iosNotification('您的先货后款订单即将逾期,请尽快处理!', ['extras' => ['route' => $route]]); $this->push->send(); break; + case 'ORDER_CREATE': + $order = app()->make(StoreOrderRepository::class)->get($data['id']); + if ($order->pay_type != StoreGroupOrder::PAY_TYPE_CREDIT_BUY) { + break; + } + $route = "/pages/admin/orderDetail/index?id={$order['order_id']}&mer_id={$order['mer_id']}"; + $merUserId = Merchant::where('mer_id', $order['mer_id'])->value('uid'); + $jgRegisterId = User::where('uid', $merUserId)->value('jg_register_id'); + if (empty($jgRegisterId)) { + break; + } + $this->addRegistrationId($jgRegisterId); + $this->androidNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route]]); + $this->iosNotification('您有新的订单,请注意查看。', ['extras' => ['route' => $route]]); + $this->push->send(); + break; default: break; }