修改优惠卷查询

This commit is contained in:
wucongxing 2023-04-13 10:36:10 +08:00
parent f93fbf4f03
commit e613684842
6 changed files with 94 additions and 7 deletions

View File

@ -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){

View File

@ -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){

View File

@ -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();
}

View File

@ -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" => "建议您修改处方并重新为患者开具",// 提示说明
];

View File

@ -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'),
],
];

View File

@ -0,0 +1,82 @@
<?php
namespace Extend\Kuaidi100;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\GuzzleException;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Utils\ApplicationContext;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* 快递100对接
*/
class Kuaidi
{
#[Inject]
protected ContainerInterface $container;
#[Inject]
protected Client $client;
/**
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function __construct()
{
$this->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"));
}
}