<?php
/*
 本代码由 焕岱科技 创建
 技术支持 WX：15285007200
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace app\api\controller\fenxiao;

use app\api\controller\Base;
use think\Db;
use app\common\model\bbfxshop\User;


class Commission extends Base
{
    protected $noNeedLogin = [];
    protected $noNeedRight = ['*'];
    
    public $model = null;
    public function _initialize(){
        parent::_initialize();
        $this->model = new \app\common\model\bbfxshop\Fenxiao;
    }

    public function getList(){
        $page = max(1,$this->param("page/d"));
        $limit = 20;

        $where = ['uniacid'=>UNIACID,'user_id'=>$this->user['id']];

        $list = Db::name("bbfx_fenxiao_commission")->where($where)->order("createtime desc")->limit(($page-1)*$limit,$limit)->select();
        $total = Db::name("bbfx_fenxiao_commission")->where($where)->count();

        foreach($list as $key => &$val){
            $val['createtime'] = date("Y-m-d H:i:s",$val['createtime']);
        }
        unset($val);

        __success("操作成功",['list'=>$list,'total'=>$total]);
    }
}