<?php
|
|
namespace app\api\controller\balance;
|
|
use app\api\controller\Controller;
|
use app\api\model\settings\Setting as SettingModel;
|
use app\api\model\user\BalanceLog as BalanceLogModel;
|
use app\api\model\supplier\Balance as SupplierBalanceModel;
|
|
/**
|
* 余额账单明细
|
*/
|
class Log extends Controller
|
{
|
/**
|
* 余额首页
|
*/
|
public function index()
|
{
|
$user = $this->getUser();
|
$list = (new BalanceLogModel)->getTop10($user['user_id']);
|
//商户是否独立收款
|
$is_independent = SettingModel::getIndependentOpen();
|
// 余额
|
if(!empty($is_independent) && $is_independent == 1){
|
$balance = SupplierBalanceModel::getTotalBalance($user['user_id']);
|
}else{
|
$balance = $user['balance'];
|
}
|
|
// 充值功能是否开启
|
$balance_setting = SettingModel::getItem('balance');
|
$balance_open = intval($balance_setting['is_open']);
|
// 提现功能是否开启
|
$cash_setting = SettingModel::getItem('balance_cash');
|
$cash_open = intval($cash_setting['is_open']);
|
|
return $this->renderSuccess('', compact('list', 'balance', 'balance_open', 'cash_open','is_independent'));
|
}
|
/**
|
* 余额账单明细列表
|
*/
|
public function lists($type = 'all')
|
{
|
$user = $this->getUser();
|
$list = (new BalanceLogModel)->getList($user['user_id'], $type);
|
return $this->renderSuccess('', compact('list'));
|
}
|
|
/**
|
* 获取商户的余额
|
*/
|
public function getSupplierBlancelists()
|
{
|
$user = $this->getUser();
|
$list = (new SupplierBalanceModel)->getList($user['user_id'],$this->postData());
|
return $this->renderSuccess('', compact('list'));
|
}
|
|
}
|