zilong 4 years ago
parent
commit
6a41b7ed37
3 changed files with 27 additions and 26 deletions
  1. 1 1
      app/Http/Controllers/Api/V1/OrderController.php
  2. 8 7
      app/Models/Order.php
  3. 18 18
      config/config.php

+ 1 - 1
app/Http/Controllers/Api/V1/OrderController.php

@@ -506,7 +506,7 @@ class OrderController extends AuthController
                 $server_name = $order['organization']['name'];
                 $server_name = $order['organization']['name'];
             }
             }
             $official_arr = [$user['openid'], $order['order_sn'], $keyword2, round($order['total_amount']/100, 2), date('Y-m-d H:i:s', $order['payment_time']), $order['order_patient']['name'], $server_name, $order['order_notes'], config('config.payment_status_map')[$order['payment_status']]];
             $official_arr = [$user['openid'], $order['order_sn'], $keyword2, round($order['total_amount']/100, 2), date('Y-m-d H:i:s', $order['payment_time']), $order['order_patient']['name'], $server_name, $order['order_notes'], config('config.payment_status_map')[$order['payment_status']]];
-            $subscribe_arr = [];
+            $subscribe_arr = [$user['openid'], $order['order_sn'], $order['order_notes'], $keyword2, config('config.payment_status_map')[$order['payment_status']]];
             send_wechat_message(7, $official_arr, $subscribe_arr);
             send_wechat_message(7, $official_arr, $subscribe_arr);
 
 
             DB::commit();
             DB::commit();

+ 8 - 7
app/Models/Order.php

@@ -93,7 +93,7 @@ class Order extends BaseModel
     {
     {
         $order = Order::with(['organization', 'orderVaccine', 'orderNurse', 'orderPack'])->where('id', $order_id)->first()->toArray();
         $order = Order::with(['organization', 'orderVaccine', 'orderNurse', 'orderPack'])->where('id', $order_id)->first()->toArray();
         $orderPatient = OrderPatient::where('order_id', $order_id)->first();
         $orderPatient = OrderPatient::where('order_id', $order_id)->first();
-        $user = User::select(['balance', 'openid'])->where('id', $order['user_id'])->first();
+        $user = User::where('id', $order['user_id'])->first();
         //发送下单消息
         //发送下单消息
         if ($order['product_type'] < 6) {
         if ($order['product_type'] < 6) {
             $product_type_text = config('config.product_type_map')[$order['product_type']];
             $product_type_text = config('config.product_type_map')[$order['product_type']];
@@ -142,35 +142,36 @@ class Order extends BaseModel
         $docter = Docter::where('id', $order['docter_id'])->first();
         $docter = Docter::where('id', $order['docter_id'])->first();
         if ($order['product_type'] == 1) {
         if ($order['product_type'] == 1) {
             $official_arr = [$user['openid'], $docter['name'], date('Y-m-d H:i:s'), round($order['payment_amount']/100, 2)];
             $official_arr = [$user['openid'], $docter['name'], date('Y-m-d H:i:s'), round($order['payment_amount']/100, 2)];
-            $subscribe_arr = [];
+            $subscribe_arr = [$user['openid'], $user['nickname'], date('Y-m-d H:i:s'), config('config.product_type_map')[$order['product_type']], round($order['payment_amount']/100, 2)];
             send_wechat_message(1, $official_arr, $subscribe_arr);
             send_wechat_message(1, $official_arr, $subscribe_arr);
         }
         }
         elseif ($order['product_type'] == 2) {
         elseif ($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)];
             $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 = [];
+            $subscribe_arr = [$user['openid'], $user['nickname'], date('Y-m-d H:i:s'), config('config.product_type_map')[$order['product_type']], round($order['payment_amount']/100, 2)];
             send_wechat_message(2, $official_arr, $subscribe_arr);
             send_wechat_message(2, $official_arr, $subscribe_arr);
         }
         }
         elseif ($order['product_type'] == 3) {
         elseif ($order['product_type'] == 3) {
             $keyword2 = date('Y-m-d H:i', $orderPatient['appoint_start_time']).' - '.date('H:i', $orderPatient['appoint_end_time']);
             $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']];
             $official_arr = [$user['openid'], $docter['name'], $keyword2, $orderPatient['name'], $orderPatient['phone'], $order['organization']['name'], $order['organization']['address']];
-            $subscribe_arr = [];
+            $subscribe_arr = [$user['openid'], $orderPatient['name'], $order['organization']['name'], $docter['name'], $keyword2];
             send_wechat_message(3, $official_arr, $subscribe_arr);
             send_wechat_message(3, $official_arr, $subscribe_arr);
         }
         }
         elseif ($order['product_type'] == 4) {
         elseif ($order['product_type'] == 4) {
             $keyword2 = date('Y-m-d H:i', $orderPatient['appoint_start_time']).' - '.date('H:i', $orderPatient['appoint_end_time']);
             $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']];
             $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 = [];
+            $subscribe_arr = [$user['openid'], $orderPatient['name'], $order['order_vaccine']['vaccine_name'], $order['organization']['name'], $keyword2];
             send_wechat_message(4, $official_arr, $subscribe_arr);
             send_wechat_message(4, $official_arr, $subscribe_arr);
         }
         }
         elseif ($order['product_type'] == 5) {
         elseif ($order['product_type'] == 5) {
             $keyword2 = date('Y-m-d H:i', $orderPatient['appoint_start_time']).' - '.date('H:i', $orderPatient['appoint_end_time']);
             $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']];
             $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 = [];
+            $subscribe_arr = [$user['openid'], $orderPatient['name'], $order['order_nurse'][0]['nurse_name'], $order['organization']['name'], $keyword2];
             send_wechat_message(5, $official_arr, $subscribe_arr);
             send_wechat_message(5, $official_arr, $subscribe_arr);
         }
         }
         elseif ($order['product_type'] == 6) {
         elseif ($order['product_type'] == 6) {
             $official_arr = [$user['openid'], $order['order_pack']['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'])];
             $official_arr = [$user['openid'], $order['order_pack']['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 = [];
+            $service_time = date('Y/m/d', $order['order_pack']['start_time']). ' - '. date('Y/m/d', $order['order_pack']['end_time']);
+            $subscribe_arr = [$user['openid'], $order['order_pack']['pack_name'], $service_time, $user['nickname']];
             send_wechat_message(6, $official_arr, $subscribe_arr);
             send_wechat_message(6, $official_arr, $subscribe_arr);
         }
         }
 
 

+ 18 - 18
config/config.php

@@ -409,7 +409,7 @@ return [
             ],
             ],
         ],
         ],
         //门诊预约确认提醒 发给医生端的
         //门诊预约确认提醒 发给医生端的
-        11 =>  [
+        11 => [
             'touser' => '%s',
             'touser' => '%s',
             'mp_template_msg' => [
             'mp_template_msg' => [
                 'appid' => env('DOCTOR_OFFICIAL_WECHAT_APPID', 'wx6df68b725662f8a3'),
                 'appid' => env('DOCTOR_OFFICIAL_WECHAT_APPID', 'wx6df68b725662f8a3'),
@@ -482,7 +482,7 @@ return [
         1 => [
         1 => [
             'template_id' => 'M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUj',
             'template_id' => 'M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUj',
             'touser' => '%s',
             'touser' => '%s',
-            'page' => '%s',
+            'page' => '',
             'data' => [
             'data' => [
                 'phrase1' => [
                 'phrase1' => [
                     'value' => '%s',
                     'value' => '%s',
@@ -505,7 +505,7 @@ return [
         2 => [
         2 => [
             'template_id' => 'M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUj',
             'template_id' => 'M9b6PPKtD7PEqLsSnQ453iTIHtIZZpixOBjUj',
             'touser' => '%s',
             'touser' => '%s',
-            'page' => '%s',
+            'page' => '',
             'data' => [
             'data' => [
                 'phrase1' => [
                 'phrase1' => [
                     'value' => '%s',
                     'value' => '%s',
@@ -517,7 +517,7 @@ return [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'thing8' => [
                 'thing8' => [
-                    'value' => '有一笔%s咨询订单已成功下单,请耐心等待',
+                    'value' => '有一笔%s咨询订单已成功下单,请耐心等待',
                 ],
                 ],
                 'amount10' => [
                 'amount10' => [
                     'value' => '%s',
                     'value' => '%s',
@@ -528,7 +528,7 @@ return [
         3 => [
         3 => [
             'template_id' => 'phcsQ7ZbsJapfmx3NMCha0MrHCqFrgN7BWVneE5OffI',
             'template_id' => 'phcsQ7ZbsJapfmx3NMCha0MrHCqFrgN7BWVneE5OffI',
             'touser' => '%s',
             'touser' => '%s',
-            'page' => '%s',
+            'page' => '',
             'data' => [
             'data' => [
                 'name1' => [
                 'name1' => [
                     'value' => '%s',
                     'value' => '%s',
@@ -551,13 +551,13 @@ return [
         4 => [
         4 => [
             'template_id' => 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI',
             'template_id' => 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI',
             'touser' => '%s',
             'touser' => '%s',
-            'page' => '%s',
+            'page' => '',
             'data' => [
             'data' => [
                 'name1' => [
                 'name1' => [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'thing10' => [
                 'thing10' => [
-                    'value' => '%s',
+                    'value' => '%s疫苗接种',
                 ],
                 ],
                 'thing3' => [
                 'thing3' => [
                     'value' => '%s',
                     'value' => '%s',
@@ -566,7 +566,7 @@ return [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'thing7' => [
                 'thing7' => [
-                    'value' => '你的%s已下单成功,请按时前往就诊',
+                    'value' => '您的计免预约已下单成功,请按时前往就诊',
                 ],
                 ],
             ],
             ],
         ],
         ],
@@ -574,13 +574,13 @@ return [
         5 => [
         5 => [
             'template_id' => 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI',
             'template_id' => 'phcsQ7ZbsJapfmx3NMChaxepR9tJFiqbO25P9tujErI',
             'touser' => '%s',
             'touser' => '%s',
-            'page' => '%s',
+            'page' => '',
             'data' => [
             'data' => [
                 'name1' => [
                 'name1' => [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'thing10' => [
                 'thing10' => [
-                    'value' => '%s',
+                    'value' => '%s儿保项目',
                 ],
                 ],
                 'thing3' => [
                 'thing3' => [
                     'value' => '%s',
                     'value' => '%s',
@@ -589,7 +589,7 @@ return [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'thing7' => [
                 'thing7' => [
-                    'value' => '你的%s已下单成功,请按时前往就诊',
+                    'value' => '您的儿保预约已下单成功,请按时前往就诊',
                 ],
                 ],
             ],
             ],
         ],
         ],
@@ -597,7 +597,7 @@ return [
         6 => [
         6 => [
             'template_id' => 'obCFv2gAnl_RaW-OlnZkjCfi6teT3LUaHxxInUkwLbw',
             'template_id' => 'obCFv2gAnl_RaW-OlnZkjCfi6teT3LUaHxxInUkwLbw',
             'touser' => '%s',
             'touser' => '%s',
-            'page' => '%s',
+            'page' => '',
             'data' => [
             'data' => [
                 'thing1' => [
                 'thing1' => [
                     'value' => '%s',
                     'value' => '%s',
@@ -606,13 +606,13 @@ return [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'thing4' => [
                 'thing4' => [
-                    'value' => '%s',
+                    'value' => '亲爱的%s,你已成功开通服务包',
                 ],
                 ],
                 'phrase5' => [
                 'phrase5' => [
-                    'value' => '%s',
+                    'value' => '已开通',
                 ],
                 ],
                 'thing3' => [
                 'thing3' => [
-                    'value' => '%s',
+                    'value' => '点击“详情”进入小程序查看服务包详情信息',
                 ],
                 ],
             ],
             ],
         ],
         ],
@@ -620,19 +620,19 @@ return [
         7 => [
         7 => [
             'template_id' => 'bjZ-r79i8sl7zEtdttAtcCPZLkCgFSYHTNWnNVd1cG0',
             'template_id' => 'bjZ-r79i8sl7zEtdttAtcCPZLkCgFSYHTNWnNVd1cG0',
             'touser' => '%s',
             'touser' => '%s',
-            'page' => '%s',
+            'page' => '',
             'data' => [
             'data' => [
                 'character_string1' => [
                 'character_string1' => [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'name5' => [
                 'name5' => [
-                    'value' => '%s',
+                    'value' => '用户',
                 ],
                 ],
                 'thing4' => [
                 'thing4' => [
                     'value' => '%s',
                     'value' => '%s',
                 ],
                 ],
                 'thing7' => [
                 'thing7' => [
-                    'value' => '%s',
+                    'value' => '%s订单,支付状态:%s,有任何疑问,请联系管理员',
                 ],
                 ],
             ],
             ],
         ],
         ],