增加了订单主表,修改了所有订单相关,支付相关代码

This commit is contained in:
2024-04-08 14:51:28 +08:00
parent c0f6fbca06
commit 944ab44305
21 changed files with 2044 additions and 742 deletions
+48
View File
@@ -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;
}
}