diff --git a/app/Command/getPrescriptionOrderStatusCommand.php b/app/Command/getPrescriptionOrderStatusCommand.php index 7efe523..c5db8d8 100644 --- a/app/Command/getPrescriptionOrderStatusCommand.php +++ b/app/Command/getPrescriptionOrderStatusCommand.php @@ -20,7 +20,7 @@ use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; /** - * 获取处方平台订单数据 + * 更新处方平台订单数据 */ #[Command] class getPrescriptionOrderStatusCommand extends HyperfCommand @@ -87,7 +87,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand } if ($result['status'] == "CFD03" || $result['status'] == "CFD04" || $result['status'] == "CFD06" || $result['status'] == "CFD07"){ - // 药师审核未通过/库存不足 + // 药师审核未通过/库存不足/已取消/申请退款 // 检测药品订单数据 $res = $this->checkPreFailedOrderStatus($item); if (!$res){ diff --git a/app/Model/UserCoupon.php b/app/Model/UserCoupon.php index 84fec0c..1be4df0 100644 --- a/app/Model/UserCoupon.php +++ b/app/Model/UserCoupon.php @@ -81,7 +81,7 @@ class UserCoupon extends Model * @param array $fields * @return object|null */ - public static function getWithCouponOne(array $params,array $coupon_params, array $application_scope_params,array $fields = ['*']): object|null + public static function getDateWithCouponOne(array $params, array $coupon_params, array $application_scope_params, array $fields = ['*']): object|null { return self::with(['Coupon']) ->whereHas('Coupon' , function($query) use ($coupon_params,$application_scope_params){ diff --git a/app/Services/CouponService.php b/app/Services/CouponService.php index fbfb3d4..f5ba376 100644 --- a/app/Services/CouponService.php +++ b/app/Services/CouponService.php @@ -52,8 +52,8 @@ class CouponService extends BaseService $params = array(); $params[] = ['user_id','=',$user_id]; $params[] = ['user_coupon_status','=',0];// 状态(0:未使用 1:已使用 3:已过期) - $params[] = ['valid_start_time','>',date('Y-m-d H:i:s',time())]; // 有效使用时间 - $params[] = ['valid_end_time','<',date('Y-m-d H:i:s',time())]; // 过期使用时间 + $params[] = ['valid_start_time','<',date('Y-m-d H:i:s',time())]; // 有效使用时间 + $params[] = ['valid_end_time','>',date('Y-m-d H:i:s',time())]; // 过期使用时间 $coupon_params = array(); $coupon_params[] = ['coupon_client','=',$coupon_client]; @@ -61,7 +61,7 @@ class CouponService extends BaseService $application_scope_params = [1,$inquiry_type]; // 适用范围(1:全部 2:快速问诊 3:专家问诊 4:公益问诊 5:问诊购药) - $user_coupon = UserCoupon::getWithCouponOne($params,$coupon_params,$application_scope_params); + $user_coupon = UserCoupon::getDateWithCouponOne($params,$coupon_params,$application_scope_params); if (empty($user_coupon)){ return array(); } diff --git a/app/Services/MessagePush.php b/app/Services/MessagePush.php index 58d05a4..893d6bb 100644 --- a/app/Services/MessagePush.php +++ b/app/Services/MessagePush.php @@ -1263,7 +1263,7 @@ class MessagePush extends BaseService $sub_data['params']['data'] = [ "phrase1" => "药师审方不通过",// 审核结果 "thing2" => $order_prescription['pharmacist_fail_reason'],// 原因 - "date3" => $order_prescription['pharmacist_verify_time'],// 审核时间 + "date3" => date('Y-m-d',time(strtotime($order_prescription['pharmacist_verify_time']))),// 审核时间 "thing4" => "建议您修改处方并重新为患者开具",// 提示说明 ]; diff --git a/config/config.php b/config/config.php index 457e8b9..a2529bf 100644 --- a/config/config.php +++ b/config/config.php @@ -95,4 +95,9 @@ return [ "client_secret" => env('REG_PLAT_CLIENT_SECRET', 'dcfd9223a3f448b0aae83ce22cdcc015'), "api_url" => env('REG_PLAT_APP_URL', 'https://202.61.88.184:19200/'), ], + 'kuaidi100' => [ // 快递100 + "key" => env('REG_PLAT_CLIENT_ID', 'Mpjjgebe8764'), + "customer" => env('REG_PLAT_CLIENT_SECRET', 'EA3A55C09C524BDB72AE31231721B20F'), + "api_url" => env('REG_PLAT_APP_URL', 'https://poll.kuaidi100.com/poll/query.do'), + ], ]; diff --git a/extend/Kuaidi100/Kuaidi.php b/extend/Kuaidi100/Kuaidi.php new file mode 100644 index 0000000..e0d70f0 --- /dev/null +++ b/extend/Kuaidi100/Kuaidi.php @@ -0,0 +1,82 @@ +container = ApplicationContext::getContainer(); + $this->client = $this->container->get(Client::class); + } + + /** + * 封装公共请求 + * @param string $path + * @param array $arg + * @return mixed + * @throws GuzzleException + */ + protected function httpRequest(string $path, array $arg = []): mixed + { + $option = [ + "headers" => [ + "sign" => config("ca.app_id"), + "signature" => $this->getRequestSign($arg), + ], + ]; + + $arg = array_merge($arg, $option); + + $response = $this->client->post($path, $arg); + + if ($response->getStatusCode() != '200') { + // 请求失败 + throw new BusinessException($response->getBody()->getContents()); + } + $body = json_decode($response->getBody(), true); + dump($body); + if (empty($body)) { + // 返回值为空 + throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); + } + + if ($body['result_code'] != 0) { + // 请求失败 + if (!empty($body['result_msg'])) { + throw new BusinessException($body['result_msg']); + } + throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::SERVER_ERROR)); + } + + return $body['body']; + } + + protected function getSign(string $data){ + $sign = md5($data . config("kuaidi100.key") . config("kuaidi100.customer")); + } + +} \ No newline at end of file