<?php
|
|
namespace app\api\controller\plus\vip;
|
|
use app\api\controller\Controller;
|
use app\api\model\plus\vip\Setting as VipSettingModel;
|
use app\api\model\plus\vip\User as VipUserModel;
|
use app\api\model\plus\vip\Cash as VipCashModel;
|
|
/**
|
* VIP专区提现
|
*/
|
class Cash extends Controller
|
{
|
private $user;
|
private $vipUser;
|
private $setting;
|
|
/**
|
* 构造方法
|
*/
|
public function initialize()
|
{
|
// 用户信息
|
$this->user = $this->getUser();
|
// VIP专区用户信息
|
$this->vipUser = VipUserModel::detail($this->user['user_id']);
|
// VIP专区设置
|
$this->setting = VipSettingModel::getFrontSetting();
|
}
|
|
/**
|
* 提交提现申请
|
*/
|
public function submit()
|
{
|
if (!$this->vipUser) {
|
return $this->renderError('您还不是VIP用户');
|
}
|
|
$data = $this->postData();
|
$model = new VipCashModel;
|
$data=json_decode($data['data'],true);
|
if ($model->submit($this->vipUser, $data)) {
|
return $this->renderSuccess('申请提现成功');
|
}
|
return $this->renderError($model->getError() ?: '提交失败');
|
}
|
|
/**
|
* VIP专区提现明细
|
*/
|
public function lists($status = -1)
|
{
|
$model = new VipCashModel;
|
return $this->renderSuccess('', [
|
// 提现明细列表
|
'list' => $model->getList($this->user['user_id'], (int)$status, $this->postData()),
|
// 页面文字
|
'words' => $this->setting['words'] ?? [],
|
]);
|
}
|
|
}
|