<?php
namespace app\admin\controller\order;
use app\admin\controller\AuthController;
use crmeb\services\JsonService as Json;
use crmeb\services\UtilService as Util;

class Package extends AuthController
{
    public function index()
    {
        $where = Util::getMore([
            ['data', ''],
            ['key', ''],
            ['paid',-1],
            ['status',-4],
        ], $this->request);
        $where['data'] = trim($where['data']);
        $this->assign('where', $where);
        $this->assign(\app\models\store\Package::orderlist($where));
        return $this->fetch();
    }
    public function setstatus()
    {
        $data = Util::getMore([
            ['status',2],
        ], $this->request);
        if($data['status']==2)
        {
           $rs =  \app\models\store\Package::take_out(input('id',0));
        }
        else
        {
            $rs = \app\models\store\Package::invalid(input('id',0),input('re',''));
        }

        if ($rs) return $this->successful('审核成功!');
        else return $this->failed(\app\models\store\Package::getErrorInfo());

    }
}
