dyjh 6 年之前
父节点
当前提交
e5a226add3
共有 2 个文件被更改,包括 21 次插入13 次删除
  1. 20 12
      app/Http/Controllers/Api/V1/AlbumController.php
  2. 1 1
      resources/views/admin/album/poster/edit.blade.php

+ 20 - 12
app/Http/Controllers/Api/V1/AlbumController.php

xqd xqd
@@ -1747,20 +1747,28 @@ class AlbumController extends Controller
             'response_type' => 'array',
         ];\Log::info('2224');
         $app = Factory::officialAccount($config);
-        $text = new Text($content);\Log::info($text);
-        $res_msg = $app->customer_service->message($text)->to($g_open_id)->send();\Log::info($res_msg);
+        $re_g = $app->template_message->send([
+            'touser' => $g_open_id,
+            'template_id' => 'lXMh2Xjg62C4LjB50QVi9ETbcvU21WElvqNCHBCsWuM',
+            'url' => '',
+            "miniprogram"=>[
+                "appid"=>"$weChatApp->app_id",
+                "pagepath"=>"pages/sell/sell"
+            ],
+            'data' => [
+                'key1' => $name,
+                'key2' => $content,
+                'key3' => date('Y-m-d H:i'),
+            ],
+        ]);
         if($user&&$formId){
-            $this->wechat_app = AlbumManufacturerModel::where('store_id',$storeid)->first();
-            $config = [
-                'app_id' => $this->wechat_app->app_id,
-                'secret' => $this->wechat_app->app_secret,
-
-                // 下面为可选项
-                // 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
+            $config_app = [
+                'app_id' => $weChatApp->app_id,
+                'secret' => $weChatApp->app_secret,
                 'response_type' => 'array',
             ];
-            $app = Factory::miniProgram($config);
-            $res = $app->template_message->send([
+            $app_x = Factory::miniProgram($config_app);
+            $res = $app_x->template_message->send([
                 'touser' => $open_id,
                 'template_id' => '9PDTfnhsRvdNwpPMIcYLL7wQF4SZkB8-9ZhXUfthbmw',
                 'page' => 'pages/sell/sell',
@@ -1770,7 +1778,7 @@ class AlbumController extends Controller
                     'keyword2' => $content,
                     'keyword3' => date('Y-m-d H:i'),
                 ],
-            ]);\Log::info($res);
+            ]);\Log::info($re_g);
           //  dd($res);
             if($res){
                 $formId->delete();

+ 1 - 1
resources/views/admin/album/poster/edit.blade.php

xqd
@@ -23,7 +23,7 @@
 					</div>
 				</div>
 				<div class="ibox-content">
-                    
+
 
 		            <div class="row">
                         <div class="col-lg-10">