123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace App\Console\Commands\Push;
- use App\Consts\PushConst;
- use App\Libs\Push\HuaWei\Admin\Constants;
- use App\Libs\Push\HuaWei\HwPushCommon;
- use App\Libs\Push\HuaWei\PushMsgCommon;
- use Illuminate\Console\Command;
- class HwPushTest extends Command
- {
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'push:hw:test';
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = 'test push';
- /**
- * Execute the console command.
- *
- * @return mixed
- */
- public function handle()
- {
- $appId = '102612543';
- $appSecret = '07c896089f432163421923bdcab83a8da9d386274be43e61d510c27f56c23269';
- $pushToken = 'AN0R08PKJjTJvCTRCL8hATh5ZxIVHQQOhpQ1JkpyRBjG25pRKbBckpUntQYBLpXNb2SFj8_bGb18uMeCT7KY5ehosiWZlopKUIphPYqeWKJeQcHGrn2fPKUsFEM-72X5Zg';
- $fastAppPushCommon = new HwPushCommon($appId, $appSecret);
- $fastAppPushCommon->setToken([$pushToken]);
- // $fastAppPushCommon->subscribeTopic(PushConst::TOPIC_ALL, [$pushToken]);
- // $fastAppPushCommon->unSubscribeTopic(PushConst::TOPIC_ALL, [$pushToken]);
- // $result = $fastAppPushCommon->subscribeList($pushToken);
- // $result = $fastAppPushCommon->queryPushToken($pushToken);
- $result = $fastAppPushCommon->sendPushMessage('我是标题', '我是内容', '/');
- dd($result);
- // $testPushMsgSample = new PushMsgCommon();
- // $testPushMsgSample->sendPushMsgMessageByMsgType(Constants::PUSHMSG_FASTAPP_MSG_TYPE);
- // $message = '{
- // "data": "{\"pushtype\":1,\"pushbody\":{\"messageId\":\"111110001\",\"data\":\"test pass-through msg\"}}",
- // "ssss":"{k1:v1}",
- // "android": {
- // "collapse_key": -1,
- // "urgency": "HIGH",
- // "ttl": "1448s",
- // "bi_tag": "Trump",
- // "fast_app_target": 1
- // },
- // "token": [
- // *push_token*
- // ]
- //}';
- //
- //
- // $message = str_ireplace("*push_token*", '"' . $testPushMsgSample->fast_push_token . '"', $message);
- // $testPushMsgSample->sendPushMsgRealMessage(json_decode($message), Constants::PUSHMSG_FASTAPP_MSG_TYPE);
- }
- }
|