| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- 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','username','realname','balance','trc_url','usdt','avatar','status']);
- }
- /**
- * 承兑商
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function acceptor()
- {
- return $this->hasOne(AcceptorModel::class, 'id','user_id')
- ->where(['mark'=>1])
- ->select(['id','name as nickname','user_id','mobile']);
- }
- /**
- * 商家
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function merchant()
- {
- return $this->hasOne(MerchantModel::class, 'id','user_id')
- ->where(['mark'=>1])
- ->select(['id','name as nickname','user_id','mobile']);
- }
- /**
- * 账号信息
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function payment()
- {
- return $this->hasOne(MemberBankModel::class, 'id','payment_id')
- ->where(['mark'=>1]);
- }
- }
|