quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
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
45
46
47
48
49
50
51
52
53
54
55
<?php
 
namespace app\api\controller\plus\vip;
 
use app\api\controller\Controller;
use app\api\model\plus\vip\User as VipUserModel;
use app\api\model\plus\vip\Order as VipOrderModel;
 
/**
 * VIP专区订单
 */
class Order extends Controller
{
    private $user;
    private $vipUser;
 
    /**
     * 构造方法
     */
    public function initialize()
    {
        // 用户信息
        $this->user = $this->getUser();
        // VIP专区用户信息
        $this->vipUser = VipUserModel::detail($this->user['user_id']);
    }
 
    /**
     * VIP专区订单列表
     */
    public function lists($type = -1)
    {
        if (!$this->vipUser) {
            return $this->renderError('您还不是VIP用户');
        }
        $model = new VipOrderModel;
        return $this->renderSuccess('', [
            'list' => $model->getList($this->vipUser['user_id'], (int)$type, $this->postData()),
        ]);
    }
 
    /**
     * VIP专区订单统计
     */
    public function statistics()
    {
        if (!$this->vipUser) {
            return $this->renderError('您还不是VIP用户');
        }
        
        $statistics = VipOrderModel::getStatistics($this->vipUser['user_id']);
        return $this->renderSuccess('', $statistics);
    }
 
}