From 3a0eb05ab774180d27a156a285953f7d602d4182 Mon Sep 17 00:00:00 2001 From: unknown <736250432@qq.com> Date: Wed, 16 Aug 2023 15:00:35 +0800 Subject: [PATCH] jpush interface --- app/api/controller/GpsController.php | 3 ++- app/api/logic/LogisticsLogic.php | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/api/controller/GpsController.php b/app/api/controller/GpsController.php index f2a1cb75..be74c0a3 100644 --- a/app/api/controller/GpsController.php +++ b/app/api/controller/GpsController.php @@ -61,7 +61,8 @@ class GpsController extends BaseApiController 'title' => '测试消息', 'msg_content' => '这是一条新的推送消息' ]; - $res = push_message('100d85590992b509d86',json_encode($message)); + $res = push_message('18071adc021402b58fb','这是条测试信息'); + dump($res); return !($res['code'] == 0); } } diff --git a/app/api/logic/LogisticsLogic.php b/app/api/logic/LogisticsLogic.php index aea171b3..cb1499d5 100644 --- a/app/api/logic/LogisticsLogic.php +++ b/app/api/logic/LogisticsLogic.php @@ -167,7 +167,7 @@ class LogisticsLogic extends BaseLogic $courier = Courier::alias('u') ->leftjoin('la_company c', 'c.id = u.company_id') ->leftjoin('la_user a','c.user_id = a.id') - ->field('a.id,a.nickname,a.mobile,c.company_name') + ->field('a.id,a.nickname,a.mobile,c.company_name,a.register_id') ->where("CONCAT_WS(',',u.province,u.city,u.area,u.street,u.village,u.brigade) = '". $order['user_address_code']."'") ->where('u.is_contract', 1) ->where('u.is_captain',1) @@ -216,6 +216,10 @@ class LogisticsLogic extends BaseLogic 'content' => '已提交订单', 'create_time' => time(), ]); + //推送消息 + if(!empty($courier['register_id'])){ + push_message($courier['register_id'],'您有一条新的配送任务,请尽快处理!!'); + } Logistics::commit(); return ['code'=>1, 'msg'=>'操作成功','data'=>['nickname'=>$courier['nickname'],'phone'=>$courier['mobile']]]; } catch (\Exception $e) {