修改库存不足
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Amqp\Producer\CancelUnPayInquiryOrderDelayProducer;
|
||||
use App\Amqp\Producer\CancelUnpayOrdersDelayDirectProducer;
|
||||
use App\Constants\DoctorTitleCode;
|
||||
use App\Constants\HttpEnumCode;
|
||||
@@ -31,6 +32,7 @@ use App\Utils\PcreMatch;
|
||||
use Extend\Wechat\WechatPay;
|
||||
use Hyperf\Amqp\Producer;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Redis\Redis;
|
||||
use Hyperf\Snowflake\IdGeneratorInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -972,4 +974,38 @@ class InquiryService extends BaseService
|
||||
|
||||
return $order_inquiry->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测问诊订单执行退款次数
|
||||
* @param string $order_inquiry_id
|
||||
* @return bool
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function checkInquiryRefundCount(string $order_inquiry_id): bool
|
||||
{
|
||||
try {
|
||||
$redis = $this->container->get(Redis::class);
|
||||
|
||||
$redis_key = "inquiryRefund" . $order_inquiry_id;
|
||||
$redis_value = $redis->get($redis_key);
|
||||
if(empty($redis_value)){
|
||||
$redis->set($redis_key, 1,60 * 60 * 24 * 5);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 问诊订单执行退款次数过多
|
||||
if ($redis_value > 3) {
|
||||
// 加入短信队列,通知管理员
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$redis->incr($redis_key);
|
||||
} catch (\Exception $e) {
|
||||
throw new BusinessException("检测问诊订单执行退款次数失败:" . $e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user