From d53a005bddd5ef3e9a67ae532856fef624d8d12a Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 27 Sep 2023 19:40:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BB=86=E8=8A=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/JgPush.php | 3 +-- app/controller/api/Auth.php | 28 +++++++++++++--------------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/app/common/service/JgPush.php b/app/common/service/JgPush.php index ad462364..839d81f6 100644 --- a/app/common/service/JgPush.php +++ b/app/common/service/JgPush.php @@ -19,7 +19,6 @@ class JgPush public function __construct() { $this->client = new Client('b5f679f4357018605ea6fd2e', 'c4fb573758f8d7058d697c54'); - // $this->client = new Client('8a5efd65cda14fafa6e64ad3', 'daebe19b547c43128796a078'); $this->push = $this->client->push(); $this->setPlatform(); } @@ -43,7 +42,7 @@ class JgPush $msg = $order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY ? '您有新的订单已结算,请注意查看。' : '您有新的订单,请注意查看。'; $msgType = $order['pay_type'] == StoreGroupOrder::PAY_TYPE_CREDIT_BUY ? 'ORDER_SETTLEMENT' : 'ORDER_CREATE'; $this->addRegistrationId($jgRegisterId); - // $this->androidNotification($msg, ['extras' => ['route' => $route, 'type' => $msgType]]); + $this->androidNotification($msg, ['extras' => ['route' => $route, 'type' => $msgType]]); $this->iosNotification($msg, ['extras' => ['route' => $route, 'type' => $msgType]]); $this->push->send(); unset($this->client, $this->push); diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 09b4bd94..2f4c82b5 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -47,6 +47,7 @@ use think\facade\Db; use think\facade\Log; use think\facade\Queue; use crmeb\jobs\SendSmsJob; +use app\common\service\JgPush; use crmeb\jobs\TestJob; use crmeb\services\PayService; use crmeb\services\CombinePayService; @@ -64,22 +65,19 @@ class Auth extends BaseController { public function dotest() { - $repository = app()->make(StoreOrderRepository::class); - $param = [ - "status" => 0, - "is_del" => 0, - "mer_id" => 1, - "pay_type" => 1, - "attach" => "margin", - "order_info" => '{"is_margin":1,"margin":"0.01"}', - "pay_price" => 0.01, - "order_sn" => "bzj" . date('YmdHis') . uniqid(), - "body" =>'哈哈哈', + $data = [ + "tempId" => "ADMIN_PAY_SUCCESS_CODE", + "id" => 113 ]; - $payType = 'weixinApp'; - $service = new PayService($payType, $param); - $payInfo = $service->pay(User::where(['uid'=>1])->find()); - return app('json')->success([]); + try { + /** @var JgPush $client */ + $client = app()->make(JgPush::class); + Log::info('JgPush送发送数据:' . json_encode($data)); + $client->send($data['tempId'], $data); + } catch (\Exception $e) { + Log::info('JgPush推送消息发送失败' . json_encode($data) . ' - ' . $e->getMessage()); + + } } public function test()