增加了订单主表,修改了所有订单相关,支付相关代码
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use Hyperf\Context\ApplicationContext;
|
||||
use Hyperf\Redis\Redis;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* @property $container
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
/**
|
||||
* 检测执行次数
|
||||
* @param string $redis_key
|
||||
* @return bool
|
||||
*/
|
||||
public function checkHandleNumber(string $redis_key): bool
|
||||
{
|
||||
try {
|
||||
$redis = ApplicationContext::getContainer()->get(Redis::class);
|
||||
|
||||
$redis_value = $redis->get($redis_key);
|
||||
if (empty($redis_value)) {
|
||||
$redis->set($redis_key, 1, 60 * 60 * 24 * 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
// 问诊订单执行退款次数过多
|
||||
if ($redis_value > 3) {
|
||||
// 加入短信队列,通知管理员
|
||||
|
||||
// 返回false,删除掉缓存
|
||||
$redis->del($redis_key);
|
||||
return false;
|
||||
}
|
||||
|
||||
$redis->incr($redis_key);
|
||||
} catch (\Throwable $e) {
|
||||
Log::getInstance("Utils-checkHandleNumber")->error($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user