| xqd
@@ -7,6 +7,7 @@ namespace App\Http\Controllers\Api;
|
|
|
use App\Models\DynamicModel;
|
|
|
use App\Models\User;
|
|
|
use App\Models\UserInfoModel;
|
|
|
+use App\Services\JPushService;
|
|
|
|
|
|
class TestController
|
|
|
{
|
| xqd
@@ -83,4 +84,26 @@ class TestController
|
|
|
DynamicModel::query()->create($ins);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public function test_push(){
|
|
|
+ try {
|
|
|
+ $res = JPushService::pushNotify([
|
|
|
+ //标题
|
|
|
+ 'title' => '测试',
|
|
|
+ //内容
|
|
|
+ 'content' => '测试',
|
|
|
+ //设备标识,跟设备相关
|
|
|
+ 'reg_id' => 'xxxxxxxxxxx',
|
|
|
+ //扩展字段
|
|
|
+ 'extras' => [
|
|
|
+ 'key' => 'value',
|
|
|
+ ],
|
|
|
+ //推送类型
|
|
|
+ 'type' => JPushService::PUSH_TYPE_ALL,
|
|
|
+ ]);
|
|
|
+ }catch (\Exception $exception){
|
|
|
+ return response()->json(['msg'=>$exception->getMessage()]);
|
|
|
+ }
|
|
|
+ return response()->json(['data'=>$res]);
|
|
|
+ }
|
|
|
}
|