| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace app\controller;
- use app\model\saas\SaasChatStore;
- use app\model\saas\SaasUserOpen;
- use support\Request;
- use Webman\Push\Api;
- class IndexController
- {
- public function index(Request $request)
- {
- // $api = new Api('http://127.0.0.1:3232', config('plugin.webman.push.app.app_key'),config('plugin.webman.push.app.app_secret'));
- // $api->trigger("user-_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u","message",[
- // "type" => "text",
- // "time" => time() * 1000,
- // "msgId" => time(),
- // "content" => "哈稍等哈就说客家话",
- // "source" => 2,
- // "avatar" => "https://washmy.oss-cn-guangzhou.aliyuncs.com/storage/20260511/23627b2cb8f73a8a90b95c31d726e6ecad0cbb9a.png",
- // "poi_id" => "7644106137976965139",
- // "openid" => "_000KmfiVkio30K9VxoeLUUY3_hngEWcgR7u",
- // "service_id" => "105"
- // ]);
- // echo "asd";
- // $param = [
- // "events" => [
- // [
- // "channel" => "private-user-1",
- // "name" => "channel_added"
- // ]
- // ]
- // ];
- // $key = hash_hmac('sha256', json_encode($param), config('plugin.webman.push.app.app_secret'), false);
- // echo $key."\n";
- return view('index');
- }
- public function view(Request $request)
- {
- $data = (new SaasChatStore)->select();
- if ($data->isEmpty()) return json([]);
- foreach ($data as $key=>$val){
- $userOpen = (new SaasUserOpen)->where("openid",$val["openid"])->findOrEmpty();
- if (!$userOpen->isEmpty()){
- (new SaasChatStore)->where("id",$val["id"])->update(["nickname"=>$userOpen['nickname']]);
- echo $userOpen['nickname']."===更新成功==\n";
- }
- }
- return json([]);
- }
- public function json(Request $request)
- {
- return json(['code' => 0, 'msg' => 'ok']);
- }
- }
|