Browse Source

模板消息

Swdz-WangHaiJun 4 years ago
parent
commit
0a0cd50273
1 changed files with 20 additions and 15 deletions
  1. 20 15
      app/Admin/Actions/Community/Notice/sendNotice.php

+ 20 - 15
app/Admin/Actions/Community/Notice/sendNotice.php

xqd xqd
@@ -19,7 +19,7 @@ class sendNotice extends BatchAction
             $remark= request('remark');
 //            $openid = 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s'; 自己
             if(empty($openid)) continue;
-//            $this->send($openid,$content,$remark);
+            $this->send($openid,$content,$remark);
         }
 
         return $this->response()->success('发送成功')->refresh();
@@ -43,21 +43,26 @@ class sendNotice extends BatchAction
                 'response_type' => 'array'
             ];
         $app = Factory::officialAccount($config);
-        $user = $app->user->get('oVxTzvgYlGktIDZXwfLMLQ01Tr5sss');
         if(!isset($user['openid'])) return true;
-        $app->template_message->send([
-                'touser' => 'oVxTzvgYlGktIDZXwfLMLQ01Tr5s',
-                'template_id' => '3LUhWGlyiljxrT3Jh8orwQZ2LSHjfRs9SIHaB40O6q0',
-            //            'url' => 'https://t5.9026.com',
-                'data' => [
-                    'first'=>'社区通知',
-                    'keyword1' => '王海军',
-                    'keyword2' => 18719141830,
-                    'keyword3' => '开发工程师',
-                    'keyword4' => '思维定制',
-                    'keyword5' => '2020-12-12',
-                ],
-            ]);
+        $res = $app->template_message->send([
+            'touser' => $open_id,
+            'template_id' => 'GWIu1FBBA8SOdOwEbXRAmBL9LlYJP_H6EJUC7rv-YiQ',
+            'url' => 'https://t5.9026.com',
+//            'miniprogram' => [
+//                'appid' => 'wx6131f74e623bf6bf',
+//                'pagepath' => '/pages/index/index',
+//            ],
+            'data' => [
+                'first'=>'社区通知',
+                'cardNumber' => '测试服务服务包',
+                'type' => '门诊',
+                'address' => '华西医院',
+                'VIPPhone' => 18719141830,
+                'VIPName' => '测试服务包',
+                'expDate' => '2021年12月31号',
+                'remark' => '请咨询13912345678。',
+            ],
+        ]);
         return true;
     }