quanwei
18 hours ago c441dea81bd86bdfb12dff35821fed51f4cc91c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
 
namespace app\operations\controller\user;
 
use app\common\enum\settings\SettingEnum;
use app\operations\controller\Controller;
use app\operations\model\settings\Setting as SettingModel;
use app\operations\model\user\BalanceLog as BalanceLogModel;
 
/**
 * 余额明细
 */
class Balance extends Controller
{
    /**
     * 余额明细
     */
    public function log()
    {
        $model = new BalanceLogModel;
        return $this->renderSuccess('', [
            // 充值记录列表
            'list' => $model->getList($this->postData('Params')),
            // 属性集
            'attributes' => $model::getAttributes(),
        ]);
    }
 
    /**
     * 充值设置
     */
    public function setting()
    {
        if ($this->request->isGet()) {
            $values = SettingModel::getItem(SettingEnum::BALANCE);
            return $this->renderSuccess('', compact('values'));
        }
        $model = new SettingModel;
        if ($model->edit(SettingEnum::BALANCE, $this->postData())) {
            return $this->renderSuccess('操作成功');
        }
        return $this->renderError($model->getError() ?: '操作失败');
    }
}