<?php
namespace app\admin\controller\rose;
use app\admin\controller\AuthController;
use app\models\user\{UserCode,User};

use crmeb\services\{
    UtilService as Util,
    JsonService as Json
};

class Statistics extends AuthController
{
    public function index()
    {
        $this->assign([
            'code_list' => UserCode::alias('c')->join("user u",'c.uid=u.uid',"left")->field('c.code,u.uid,u.real_name,u.nickname')->select(),
        ]);
        return $this->fetch();
    }
    public function lst()
    {
        $where = [];
        if(trim(input('code',''))!='') {
            $where['code'] = trim(input('code', ''));
        }
        $count = count($data =  User::where($where)->page(input('page',1),input('limit',100))->order('team_cts desc')->field('uid,real_name,nickname,avatar,level,team_cts')->select()->toarray());
        return Json::successlayui(compact('count','data'));
    }
}
