<?php
|
|
namespace app\operations\controller\plus\vip;
|
|
use app\operations\controller\Controller;
|
use app\operations\model\plus\vip\Apply as VipApplyModel;
|
use app\common\model\plus\vip\User as VipUserModel;
|
|
/**
|
* VIP专区申请管理
|
*/
|
class Apply extends Controller
|
{
|
/**
|
* 申请列表
|
*/
|
public function index()
|
{
|
$model = new VipApplyModel;
|
$list = $model->getList($this->postData());
|
return $this->renderSuccess('', compact('list'));
|
}
|
|
/**
|
* 申请审核
|
*/
|
public function audit()
|
{
|
$data = $this->postData();
|
$model = new VipApplyModel;
|
$detail = $model::detail($data['id']);
|
|
if (!$detail) {
|
return $this->renderError('申请记录不存在');
|
}
|
|
if ($detail['apply_status'] != 10) {
|
return $this->renderError('该申请已处理');
|
}
|
|
// 更新审核状态
|
$updateData = [
|
'apply_status' => $data['apply_status'],
|
'audit_time' => time()
|
];
|
|
if ($data['apply_status'] == 30) {
|
// 驳回,需要填写驳回原因
|
if (empty($data['reject_reason'])) {
|
return $this->renderError('请填写驳回原因');
|
}
|
$updateData['reject_reason'] = $data['reject_reason'];
|
}
|
|
if ($model->where('id', $data['id'])->update($updateData)) {
|
return $this->renderSuccess('审核成功');
|
}
|
return $this->renderError('审核失败');
|
}
|
}
|