新增物流状态推送,物流消息推送
This commit is contained in:
@@ -1008,6 +1008,47 @@ class CallBackController extends AbstractController
|
||||
return $this->LogisticsFailReturn($e->getMessage());
|
||||
}
|
||||
|
||||
// 推送消息
|
||||
try {
|
||||
// 获取患者数据
|
||||
$params = array();
|
||||
$params['patient_id'] = $order_product['patient_id'];
|
||||
$user_patient = UserPatient::getOne($params);
|
||||
if (empty($user_patient)){
|
||||
return $this->LogisticsSuccessReturn("推送消息错误:用户数据错误");
|
||||
}
|
||||
|
||||
// 检测是否推送过
|
||||
$redis = $this->container->get(Redis::class);
|
||||
|
||||
$redis_key = "logistics_" . $request_params['param']['lastResult']['nu'] . $request_params['param']['lastResult']['state'];
|
||||
$redis_value = $redis->get($redis_key);
|
||||
if (empty($redis_value)){
|
||||
// 未推送过
|
||||
$status = "";
|
||||
if ($request_params['param']['lastResult']['state'] == 1){
|
||||
// 1揽收
|
||||
$status = "已揽收";
|
||||
|
||||
}elseif ($request_params['param']['lastResult']['state'] == 0){
|
||||
// 0在途
|
||||
$status = "已发货";
|
||||
}elseif ($request_params['param']['lastResult']['state'] == 3){
|
||||
// 3签收
|
||||
$status = "已签收";
|
||||
}
|
||||
|
||||
if (!empty($status)){
|
||||
// 患者-药品已发货-订阅失败发送短信
|
||||
$MessagePush = new MessagePush($user_patient['user_id']);
|
||||
$MessagePush->logistics($status,$order_product['patient_id']);
|
||||
$redis->set($redis_key, 1, 60 * 10);
|
||||
}
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
return $this->LogisticsSuccessReturn("推送消息错误:" . $e->getMessage());
|
||||
}
|
||||
|
||||
return $this->LogisticsSuccessReturn();
|
||||
} catch (\Exception $e) {
|
||||
return $this->LogisticsFailReturn("异常:" . $e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user