9 changed files with 202 additions and 33 deletions
-
5app/Admin/Common/Auth.php
-
10app/Admin/Controllers/LanzuCsInfoController.php
-
66app/Admin/Controllers/LanzuCsWithdrawController.php
-
13app/Models/ImsCjdcMarket.php
-
11app/Models/LanzuCsInfo.php
-
13app/Models/LanzuCsWithdraw.php
-
93app/Models/LanzuUserBalance.php
-
2app/Models/MpBalance.php
-
22dcat_admin_ide_helper.php
@ -0,0 +1,93 @@ |
|||
<?php |
|||
|
|||
|
|||
namespace App\Models; |
|||
|
|||
|
|||
|
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class LanzuUserBalance extends Model |
|||
{ |
|||
protected $table = 'lanzu_user_balance'; |
|||
protected $dateFormat = 'U'; |
|||
|
|||
/** |
|||
* 获取可提现金额 |
|||
* @param $uid |
|||
* @param $uType 0/1 普通用户/服务商 |
|||
*/ |
|||
public static function getBalance($uid, $uType = 0) |
|||
{ |
|||
$row = self::where(['source_id' => $uid, 'user_type' => $uType])->first(); |
|||
if ($row) { |
|||
return $row->balance; |
|||
} else { |
|||
return '0.00'; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 扣减可提现金额 |
|||
*/ |
|||
public static function reduceBalance($uid, $uType, $reduceMoney) |
|||
{ |
|||
$row = self::where(['source_id' => $uid, 'user_type' => $uType])->first(); |
|||
if ($row) { |
|||
$row->balance = $row->balance - $reduceMoney; |
|||
return $row->save(); |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 回退审核未通过时的提现金额 |
|||
*/ |
|||
public static function returnBalance($uid, $uType, $returnMoney) |
|||
{ |
|||
$row = self::where(['source_id' => $uid, 'user_type' => $uType])->first(); |
|||
if ($row) { |
|||
$row->balance = $row->balance + $returnMoney; |
|||
return $row->save(); |
|||
} else { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 生成一条数据 |
|||
*/ |
|||
public static function create($sid,$type) |
|||
{ |
|||
$self = new self(); |
|||
$self->source_id = $sid; |
|||
$self->user_type = $type; |
|||
$self->balance = 0; |
|||
$self->save(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue