|
@@ -138,42 +138,53 @@ class Order extends BaseModel
|
|
OrganizationVaccine::where('org_id', $order['organization_id'])->where('vaccine_id', $orderVaccine['vaccine_id'])->decrement('stock');
|
|
OrganizationVaccine::where('org_id', $order['organization_id'])->where('vaccine_id', $orderVaccine['vaccine_id'])->decrement('stock');
|
|
}
|
|
}
|
|
|
|
|
|
- //发送微信消息
|
|
|
|
|
|
+ //给用户发送微信消息
|
|
$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 = [];
|
|
send_wechat_message(1, $official_arr, $subscribe_arr);
|
|
send_wechat_message(1, $official_arr, $subscribe_arr);
|
|
}
|
|
}
|
|
- if ($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 = [];
|
|
send_wechat_message(2, $official_arr, $subscribe_arr);
|
|
send_wechat_message(2, $official_arr, $subscribe_arr);
|
|
}
|
|
}
|
|
- if ($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 = [];
|
|
send_wechat_message(3, $official_arr, $subscribe_arr);
|
|
send_wechat_message(3, $official_arr, $subscribe_arr);
|
|
}
|
|
}
|
|
- if ($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 = [];
|
|
send_wechat_message(4, $official_arr, $subscribe_arr);
|
|
send_wechat_message(4, $official_arr, $subscribe_arr);
|
|
}
|
|
}
|
|
- if ($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 = [];
|
|
send_wechat_message(5, $official_arr, $subscribe_arr);
|
|
send_wechat_message(5, $official_arr, $subscribe_arr);
|
|
}
|
|
}
|
|
- if ($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 = [];
|
|
$subscribe_arr = [];
|
|
send_wechat_message(6, $official_arr, $subscribe_arr);
|
|
send_wechat_message(6, $official_arr, $subscribe_arr);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //给医生发送消息
|
|
|
|
+ if (in_array($order['product_type'], [1,2])) {
|
|
|
|
+ $official_arr = [$user['openid'], $order['order_sn'], config('config.product_type_map')[$order['product_type']], $orderPatient['name'], $orderPatient['phone']];
|
|
|
|
+ send_wechat_message(10, $official_arr);
|
|
|
|
+ }
|
|
|
|
+ elseif ($order['product_type'] == 3) {
|
|
|
|
+ $keyword4 = date('Y-m-d H:i', $orderPatient['appoint_start_time']).' - '.date('H:i', $orderPatient['appoint_end_time']);
|
|
|
|
+ $official_arr = [$user['openid'], $orderPatient['name'], $orderPatient['phone'], $keyword4, $order['organization']['name'], $docter['name']];
|
|
|
|
+ send_wechat_message(11, $official_arr);
|
|
|
|
+ }
|
|
|
|
+
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|