// +---------------------------------------------------------------------- namespace App\Models; use App\Services\RedisService; /** * 平台钱包交易记录-模型 * @author laravel开发员 * @since 2020/11/11 * @package App\Models */ class WalletLogModel extends BaseModel { // 设置数据表 protected $table = 'wallet_log'; /** * 验证记录是否已经存在 * @param $hash * @return array|bool */ public static function checkExists($hash) { $cacheKey = "caches:wallet:checkLog:{$hash}"; $check = RedisService::get($cacheKey); if($check){ return true; } $info = WalletLogModel::where(['hash'=> $hash,'status'=>1,'mark'=>1])->first(); $info = $info? $info->toArray() : []; if($info){ RedisService::set($cacheKey, $info, rand(3600,7200)); } return $info; } }