field('wallet_address,wallet_type')->find(); if(empty($list)){ $wallet_info=self::where([ 'user_id'=>0, 'wallet_type'=>$data['wallet_type'] ])->order('id','asc')->find(); if($wallet_info){ $wallet_info=$wallet_info->toArray(); self::where('id',$wallet_info['id'])->update([ 'user_id'=>$data['user_id'] ]); } $list=$wallet_info; }else{ $list=$list->toArray(); } return $list; } public static function getUidByWallet(array $data) { $info=self::where($data)->find(); if(!empty($info)){ $wallet_info=$info->toArray(); return $wallet_info['user_id']; }else{ return ''; } } public static function getUserWalletAddress(array $data) { $info=self::where($data)->find(); if(!empty($info)){ $wallet_info=$info->toArray(); return $wallet_info['wallet_address']; }else{ return ''; } } public static function InsertUserWalletAddress(array $data) { $self = new self; $self->user_id = $data['user_id']; $self->wallet_address = $data['wallet_address']; $self->wallet_type = $data['wallet_type']; $self->create_time = date('Y-m-d H:i:s'); $self->save(); } }