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

namespace app\api\controller\paihangbang;

use app\api\controller\Base;
use think\Db;

class User extends Base
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
    
    public $model = null;
    public function _initialize(){
        parent::_initialize();
        $this->model = new \app\common\model\bbfxshop\Paihangbang;
    }
    
    public function getList(){
        $result = $this->model->getRankingUser();
        $result['data']['ranking'] = "";
        if(!empty($this->user)){
            foreach ($result['data']['list'] as $key => $val){
                if($val['id'] == $this->user['id']){
                    $result['data']['ranking'] = $val['ranking'];
                }
            }
        }
        $set = $this->model->getSet();
        if($set['ranking_method'] == 1 || $set['ranking_method'] == 2){
            $result['data']['ranking_method'] = "业绩";
        }
        
        __result($result);
    }
}