// +---------------------------------------------------------------------- namespace App\Models; use App\Services\RedisService; /** * 余额充值提现订单管理-模型 * @author laravel开发员 * @since 2020/11/11 * Class BalanceLogModel * @package App\Models */ class BalanceLogModel extends BaseModel { // 设置数据表 protected $table = 'balance_logs'; /** * 验证记录是否已经存在 * @param $hash * @return array|bool */ public static function checkExists($hash) { $cacheKey = "caches:wallet:balanceLog:{$hash}"; $check = RedisService::get($cacheKey); if(RedisService::exists($cacheKey)){ return $check; } $info = BalanceLogModel::where(['hash'=> $hash,'mark'=>1])->first(); $info = $info? $info->toArray() : []; if($info){ RedisService::set($cacheKey, $info, rand(600,1200)); } return $info; } /** * 用户 * @return \Illuminate\Database\Eloquent\Relations\HasOne */ public function member() { return $this->hasOne(MemberModel::class, 'id','user_id') ->where(['mark'=>1]) ->select(['id','nickname','parent_id','balance','trc_url','usdt','avatar','status']); } }