|
|
|
@ -10,6 +10,7 @@ class MpBalance extends Model |
|
|
|
{ |
|
|
|
protected $table = 'lanzu_user_balance'; |
|
|
|
protected $dateFormat = 'U'; |
|
|
|
protected $guarded = []; |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取可提现金额 |
|
|
|
@ -18,7 +19,10 @@ class MpBalance extends Model |
|
|
|
*/ |
|
|
|
public static function getBalance($uid,$uType=0) |
|
|
|
{ |
|
|
|
$row = self::where(['source_id'=>$uid,'user_type'=>$uType])->first(); |
|
|
|
$row = self::where(['source_id'=>$uid,'user_type'=>$uType])->firstOrCreate( |
|
|
|
['source_id'=>$uid,'user_type'=>$uType], |
|
|
|
['balance'=>0] |
|
|
|
); |
|
|
|
if ($row){ |
|
|
|
return $row->balance; |
|
|
|
}else{ |
|
|
|
|