zilong 4 年之前
父节点
当前提交
deabf0f12f
共有 4 个文件被更改,包括 534 次插入31 次删除
  1. 15 7
      app/Helpers/functions.php
  2. 39 5
      app/Models/Order.php
  3. 477 19
      config/config.php
  4. 3 0
      upgrade.md

+ 15 - 7
app/Helpers/functions.php

xqd
@@ -531,20 +531,28 @@ if (!function_exists('numDays')){
     }
 }
 
-//发送微信订阅消息
+//发送微信消息
 if (!function_exists('send_wechat_message')) {
-    function send_wechat_message($type, $arr)
+    function send_wechat_message($type, $official_arr, $subscribe_arr, $url_param = [])
     {
         try {
             $app = Factory::miniProgram(config('config.wechat_small_program'));
-            $data = config('config.wechat_subscribe_message_template')[$type];
+            //先发送模板消息
+            $data = config('config.wechat_official_message_template')[$type];
             $json = json_encode($data, JSON_UNESCAPED_UNICODE);
-            $json = vsprintf($json, $arr);
+            $json = vsprintf($json, $official_arr);
             $data = json_decode($json, true);
-
-            $ret = $app->subscribe_message->send($data);
+            $ret = $app->uniform_message->send($data);
+            //如果模板消息发送失败(可能因用户没有关注公众号而失败)再发送订阅消息
+            if (isset($ret['errcode']) && $ret['errcode'] != 0) {
+                $data = config('config.wechat_subscribe_message_template')[$type];
+                $json = json_encode($data, JSON_UNESCAPED_UNICODE);
+                $json = vsprintf($json, $subscribe_arr);
+                $data = json_decode($json, true);
+                $ret = $app->subscribe_message->send($data);
+            }
         } catch (Exception $e) {
-            trace(['发送微信订阅消息失败' => $e->getMessage(), '请求参数' => $data ?? '', '返回数据' => $ret ?? ''], 'error');
+            trace(['发送微信消息失败' => $e->getMessage(), '请求参数' => $data ?? '', '返回数据' => $ret ?? ''], 'error');
         }
 
         return $ret ?? false;

+ 39 - 5
app/Models/Order.php

xqd xqd xqd xqd
@@ -91,7 +91,9 @@ class Order extends BaseModel
     //支付完成的处理方法
     public static function payCompletedHandle($order_id)
     {
-        $order = Order::select(['user_id', 'docter_id', 'product_type', 'total_amount', 'payment_type', 'payment_amount', 'order_sn', 'pay_order_pack_id', 'organization_id'])->where('id', $order_id)->first();
+        $order = Order::with(['organization', 'orderVaccine', 'orderNurse', 'orderPack'])->select(['user_id', 'docter_id', 'product_type', 'total_amount', 'payment_type', 'payment_amount', 'order_sn', 'pay_order_pack_id', 'organization_id'])->where('id', $order_id)->first();
+        $orderPatient = OrderPatient::where('order_id', $order_id)->first();
+        $user = User::select(['balance', 'openid'])->where('id', $order['user_id'])->first();
         //发送下单消息
         if ($order['product_type'] < 6) {
             $product_type_text = config('config.product_type_map')[$order['product_type']];
@@ -104,12 +106,10 @@ class Order extends BaseModel
             User::where('id', $order['user_id'])->update(['is_pack' => 1]);
         }
         elseif ($order['product_type'] == 7) {
-            $user = User::select(['balance'])->where('id', $order['user_id'])->first();
             UserMessage::saveMessage($order['user_id'], 7, $order_id, [round($order['total_amount']/100, 2), round($user['balance']/100, 2)]);
         }
         //发送余额付款成功消息
         if ($order['payment_type'] == 2) {
-            $user = User::select(['balance'])->where('id', $order['user_id'])->first();
             UserMessage::saveMessage($order['user_id'], 8, $order_id, [round($order['payment_amount']/100, 2), round($user['balance']/100, 2)]);
         }
         //发送医生端消息
@@ -122,13 +122,11 @@ class Order extends BaseModel
 
         //如果是门诊预约,预约时间段的订单数要加1
         if ($order['product_type'] == 3) {
-            $orderPatient = OrderPatient::select(['time_period_id', 'appoint_start_time'])->where('order_id', $order_id)->first();
             $schedule_date = date('Y-m-d', $orderPatient['appoint_start_time']);
             SchedulePeriod::where('docter_id', $order['docter_id'])->where('organization_id', $order['organization_id'])->where('schedule_type', 1)->where('time_period_id', $orderPatient['time_period_id'])->where('schedule_date', $schedule_date)->increment('order_num');
         }
         //如果是儿保和疫苗预约,预约时间段的订单数要加1
         if (in_array($order['product_type'], [4,5])) {
-            $orderPatient = OrderPatient::select(['time_period_id', 'appoint_start_time'])->where('order_id', $order_id)->first();
             $schedule_date = date('Y-m-d', $orderPatient['appoint_start_time']);
             $schedule_type = $order['product_type'] == 4 ? 2 : 3;
             SchedulePeriod::where('organization_id', $order['organization_id'])->where('schedule_type', $schedule_type)->where('time_period_id', $orderPatient['time_period_id'])->where('schedule_date', $schedule_date)->increment('order_num');
@@ -140,6 +138,42 @@ class Order extends BaseModel
             OrganizationVaccine::where('org_id', $order['organization_id'])->where('vaccine_id', $orderVaccine['vaccine_id'])->decrement('stock');
         }
 
+        //发送微信消息
+        $docter = Docter::where('id', $order['docter_id'])->first();
+        if ($order['product_type'] == 1) {
+            $official_arr = [$user['openid'], $docter['name'], date('Y-m-d H:i:s'), round($order['payment_amount']/100, 2)];
+            $subscribe_arr = [];
+            send_wechat_message(1, $official_arr, $subscribe_arr);
+        }
+        if ($order['product_type'] == 2) {
+            $official_arr = [$user['openid'], $docter['name'], $orderPatient['name'], $orderPatient['symptoms'], date('Y-m-d H:i:s'), round($order['payment_amount']/100, 2)];
+            $subscribe_arr = [];
+            send_wechat_message(2, $official_arr, $subscribe_arr);
+        }
+        if ($order['product_type'] == 3) {
+            $keyword2 = date('Y-m-d H:i', $orderPatient['appoint_start_time']).' - '.date('H:i', $orderPatient['appoint_end_time']);
+            $official_arr = [$user['openid'], $docter['name'], $keyword2, $orderPatient['name'], $orderPatient['phone'], $order['organization']['name'], $order['organization']['address']];
+            $subscribe_arr = [];
+            send_wechat_message(3, $official_arr, $subscribe_arr);
+        }
+        if ($order['product_type'] == 4) {
+            $keyword2 = date('Y-m-d H:i', $orderPatient['appoint_start_time']).' - '.date('H:i', $orderPatient['appoint_end_time']);
+            $official_arr = [$user['openid'], $order['organization']['name'], $order['order_vaccine']['vaccine_name'], $keyword2, $orderPatient['name'], $orderPatient['phone'], $order['organization']['name'], $order['organization']['address']];
+            $subscribe_arr = [];
+            send_wechat_message(4, $official_arr, $subscribe_arr);
+        }
+        if ($order['product_type'] == 5) {
+            $keyword2 = date('Y-m-d H:i', $orderPatient['appoint_start_time']).' - '.date('H:i', $orderPatient['appoint_end_time']);
+            $official_arr = [$user['openid'], $order['organization']['name'], $order['order_nurse'][0]['nurse_name'], $keyword2, $orderPatient['name'], $orderPatient['phone'], $order['organization']['name'], $order['organization']['address']];
+            $subscribe_arr = [];
+            send_wechat_message(5, $official_arr, $subscribe_arr);
+        }
+        if ($order['product_type'] == 6) {
+            $official_arr = [$user['openid'], $order['order_pack']['name'], date('Y-m-d H:i:s', $order['order_pack']['start_time']), date('Y-m-d H:i:s', $order['order_pack']['end_time'])];
+            $subscribe_arr = [];
+            send_wechat_message(6, $official_arr, $subscribe_arr);
+        }
+
         return true;
     }
 

+ 477 - 19
config/config.php

xqd xqd xqd xqd xqd xqd xqd xqd xqd
@@ -12,30 +12,34 @@ return [
     'aes_iv' => 'sfX2ReOCcY22CEUF',
 
     // 正式服 小程序id
-/*    'wechat_small_program' => [
+    /*'wechat_small_program' => [
         'app_id' => 'wx1dcbf8ce4bca6870',
         'secret' => 'f978c16e3664c33c811c02f1d48690b9',
     ],*/
 
-    // 测试服务
     'wechat_small_program' => [
-        'app_id' => env('WECHAT_APPID','wx6131f74e623bf6bf'),
-        'secret' => env('WECHAT_APPSECRET','b703596ab6cbcad5b74eb51fec2aeb0b'),
+        'app_id' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+        'secret' => env('WECHAT_APPSECRET', 'b703596ab6cbcad5b74eb51fec2aeb0b'),
     ],
-    // 测试服务医生
+
     'docter_wechat_small_program' => [
         'app_id' => env('DOCTRER_WECHAT_APPID', 'wx92066f7587c34617'),
         'secret' => env('DOCTRER_WECHAT_APPSECRET', 'bd7849c5259b79c41ec158173c5fb1d6'),
     ],
 
     'wechat_pay' => [
-        'app_id' => env('WECHAT_APPID','wx6131f74e623bf6bf'),
-        'mch_id' => env('WECHAT_MCHID','1398823402'),
-        'key' =>  env('WECHAT_KEY','c1891122765718911227657189112276'),
+        'app_id' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+        'mch_id' => env('WECHAT_MCHID', '1398823402'),
+        'key' =>  env('WECHAT_KEY', 'c1891122765718911227657189112276'),
         'notify_url' => env('API_HOST', '').'/api/v1/payCallback/wechatPayNotify'
     ],
 
-    'axb'   =>[
+    'wechat_official_program' => [
+        'app_id' => env('OFFICIAL_WECHAT_APPID'),
+        'secret' => env('OFFICIAL_WECHAT_APPSECRET'),
+    ],
+
+    'axb' => [
         'appid' => 'LTAI4GGMyBKstgVLLckoPxtf',
         'appscret' => 'goLufn8Qe0Mfip5PBR8R0DfbYYYkDF',
         'PoolKey' => 'FC100000115024469', // 隐私号码key
@@ -73,8 +77,370 @@ return [
 
     'pack_label_map' => [1 => '图文', 2 => '电话', 3 => '门诊', 4 => '计免', 5 => '儿保'],
 
+    //公众号模板消息
+    'wechat_official_message_template' => [
+        //电话咨询
+        1 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'eGLY32nedQQ0B31zSK8KFW2pGsWM93MNQmhRLltTa64',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '尊敬的用户,你的电话咨询已提交成功!',
+                    ],
+                    'keyword1' => [
+                        'value' => '电话咨询订单',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s医生的电话咨询',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '支付金额:%s。请耐心等待医生接单,点击可查看详情',
+                    ],
+                ],
+            ],
+        ],
+        //图文咨询
+        2 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'eGLY32nedQQ0B31zSK8KFW2pGsWM93MNQmhRLltTa64',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '尊敬的用户,你的图文咨询已提交成功!',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s医生的图文咨询订单',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s患者的病例描述:%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '支付金额:%s。请耐心等待医生接单,点击可查看详情',
+                    ],
+                ],
+            ],
+        ],
+        //门诊预约下单
+        3 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'ZuHiV-fVSFH8HWqmtIUlyp7bzEZzE7lmjRpzXU42_vk',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '尊敬的用户,你的门诊预约已提交成功!',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s医生的门诊预约',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'keyword4' => [
+                        'value' => '%s',
+                    ],
+                    'keyword5' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '地址:%s。请您按时到达服务地点!点击查看相关详情',
+                    ],
+                ],
+            ],
+        ],
+        //疫苗预约下单
+        4 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'ZuHiV-fVSFH8HWqmtIUlyp7bzEZzE7lmjRpzXU42_vk',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '尊敬的用户,你的计免预约已提交成功!',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s - %s的接种预约',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'keyword4' => [
+                        'value' => '%s',
+                    ],
+                    'keyword5' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '地址:%s。请您按时到达服务地点!点击查看相关详情',
+                    ],
+                ],
+            ],
+        ],
+        //儿保预约下单
+        5 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'ZuHiV-fVSFH8HWqmtIUlyp7bzEZzE7lmjRpzXU42_vk',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '尊敬的用户,你的儿保预约已提交成功!',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s - %s儿保项目的预约',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'keyword4' => [
+                        'value' => '%s',
+                    ],
+                    'keyword5' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '地址:%s。请您按时到达服务地点!点击查看相关详情',
+                    ],
+                ],
+            ],
+        ],
+        //服务包下单
+        6 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'qVz82UQW6ZvMgV7Rv5NCAiCEyd8X47A7Qb78GFbaDdw',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '尊敬的用户,你有一个服务包已开通成功!',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s服务包',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '点击进入小程序查看详情',
+                    ],
+                ],
+            ],
+        ],
+        //咨询订单接单提醒
+        7 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'grtzjXaIQNMTI-UoxY8cakzVna4q65s6qqZFbW67rIk',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '%s',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '%s',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'keyword4' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '%s',
+                    ],
+                ],
+            ],
+        ],
+        //图文消息回复提醒
+        8 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => '0T33vX4zLYSUbFH4NxEe_6Yt4b6m1AoanjpwvBbsRgE',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '%s',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '%s',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '%s',
+                    ],
+                ],
+            ],
+        ],
+        //订单取消提醒
+        9 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'xYAvY_xez7Ou_qflGuPV7L277FCPpj3K-zFdRcUYaBI',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '%s',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '%s',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'keyword4' => [
+                        'value' => '%s',
+                    ],
+                    'keyword5' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '%s',
+                    ],
+                ],
+            ],
+        ],
+        //服务包续费(即将到期)提醒
+        10 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'aqfqUZtxj8jrRQe5_rhjaoHCmtDUeDLRgVYVdTMTH2k',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '%s',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '%s',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '%s',
+                    ],
+                ],
+            ],
+        ],
+        //服务包失效提醒
+        11 => [
+            'touser' => '%s',
+            'mp_template_msg' => [
+                'appid' => env('OFFICIAL_WECHAT_APPID'),
+                'template_id' => 'aqfqUZtxj8jrRQe5_rhjaoHCmtDUeDLRgVYVdTMTH2k',
+                'url' => '',
+                'miniprogram' => [
+                    'appid' => env('WECHAT_APPID', 'wx6131f74e623bf6bf'),
+                    'pagepath' => '%s',
+                ],
+                'data' => [
+                    'first' => [
+                        'value' => '%s',
+                    ],
+                    'keyword1' => [
+                        'value' => '%s',
+                    ],
+                    'keyword2' => [
+                        'value' => '%s',
+                    ],
+                    'keyword3' => [
+                        'value' => '%s',
+                    ],
+                    'remark' => [
+                        'value' => '%s',
+                    ],
+                ],
+            ],
+        ],
+    ],
+
+    //小程序订阅消息
     'wechat_subscribe_message_template' => [
-        //图文咨询/电话咨询
+        //电话咨询下单
         1 => [
             'template_id' => 'M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUj',
             'touser' => '%s',
@@ -97,8 +463,31 @@ return [
                 ],
             ],
         ],
-        //门诊预约
+        //图文咨询下单
         2 => [
+            'template_id' => 'M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUj',
+            'touser' => '%s',
+            'page' => '%s',
+            'data' => [
+                'phrase1' => [
+                    'value' => '%s',
+                ],
+                'name3' => [
+                    'value' => '%s',
+                ],
+                'date4' => [
+                    'value' => '%s',
+                ],
+                'thing8' => [
+                    'value' => '你有一笔%s咨询订单已成功下单,请耐心等待',
+                ],
+                'amount10' => [
+                    'value' => '%s',
+                ],
+            ],
+        ],
+        //门诊预约下单
+        3 => [
             'template_id' => 'phcsQ7ZbsJapfmx3NMCha0MrHCqFrgN7BWVneE5OffI',
             'touser' => '%s',
             'page' => '%s',
@@ -120,8 +509,8 @@ return [
                 ],
             ],
         ],
-        //计免预约 / 儿保预约
-        3 => [
+        //疫苗预约下单
+        4 => [
             'template_id' => 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI',
             'touser' => '%s',
             'page' => '%s',
@@ -143,8 +532,54 @@ return [
                 ],
             ],
         ],
+        //儿保预约下单
+        5 => [
+            'template_id' => 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI',
+            'touser' => '%s',
+            'page' => '%s',
+            'data' => [
+                'name1' => [
+                    'value' => '%s',
+                ],
+                'thing10' => [
+                    'value' => '%s',
+                ],
+                'thing3' => [
+                    'value' => '%s',
+                ],
+                'time2' => [
+                    'value' => '%s',
+                ],
+                'thing7' => [
+                    'value' => '你的%s已下单成功,请按时前往就诊',
+                ],
+            ],
+        ],
+        //服务包下单
+        6 => [
+            'template_id' => 'obCFv2gAnl_RaW-OlnZkjCfi6teT3LUaHxxInUkwLbw',
+            'touser' => '%s',
+            'page' => '%s',
+            'data' => [
+                'thing1' => [
+                    'value' => '%s',
+                ],
+                'date2' => [
+                    'value' => '%s',
+                ],
+                'thing4' => [
+                    'value' => '%s',
+                ],
+                'phrase5' => [
+                    'value' => '%s',
+                ],
+                'thing3' => [
+                    'value' => '%s',
+                ],
+            ],
+        ],
         //咨询订单接单提醒
-        4 => [
+        7 => [
             'template_id' => '7tnOphwuX8aYenJd-m-LN0jxQm3gkF0HJc1nDX13VMw',
             'touser' => '%s',
             'page' => '%s',
@@ -167,7 +602,7 @@ return [
             ],
         ],
         //图文消息回复提醒
-        5 => [
+        8 => [
             'template_id' => 'WCkfvW9NkV_oQgLsJJuwoVMF-G0ss9y4SkIgCObZwWA',
             'touser' => '%s',
             'page' => '%s',
@@ -190,7 +625,7 @@ return [
             ],
         ],
         //订单取消提醒
-        6 => [
+        9 => [
             'template_id' => 'bjZ-r79i8sl7zEtdttAtcCPZLkCgFSYHTNWnNVd1cG0',
             'touser' => '%s',
             'page' => '%s',
@@ -209,8 +644,31 @@ return [
                 ],
             ],
         ],
-        //服务包消息配置
-        7 => [
+        //服务包续费(即将到期)提醒
+        10 => [
+            'template_id' => 'obCFv2gAnl_RaW-OlnZkjCfi6teT3LUaHxxInUkwLbw',
+            'touser' => '%s',
+            'page' => '%s',
+            'data' => [
+                'thing1' => [
+                    'value' => '%s',
+                ],
+                'date2' => [
+                    'value' => '%s',
+                ],
+                'thing4' => [
+                    'value' => '%s',
+                ],
+                'phrase5' => [
+                    'value' => '%s',
+                ],
+                'thing3' => [
+                    'value' => '%s',
+                ],
+            ],
+        ],
+        //服务包失效提醒
+        11 => [
             'template_id' => 'obCFv2gAnl_RaW-OlnZkjCfi6teT3LUaHxxInUkwLbw',
             'touser' => '%s',
             'page' => '%s',
@@ -232,5 +690,5 @@ return [
                 ],
             ],
         ],
-    ]
+    ],
 ];

+ 3 - 0
upgrade.md

xqd
@@ -2,3 +2,6 @@
 - 执行以下sql:
     ALTER TABLE `bm_orders` 
     ADD COLUMN `cancel_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '取消订单时间' AFTER `receiving_time`;
+- .env添加如下配置
+    OFFICIAL_WECHAT_APPID=xxx
+    OFFICIAL_WECHAT_APPSECRET=yyy