This repository has been archived on 2024-07-11. You can view files and clone it, but cannot push or open issues or pull requests.
yoshop/source/application/api/controller/user/dealer/Team.php
2020-04-25 22:20:29 +08:00

60 lines
1.5 KiB
PHP

<?php
namespace app\api\controller\user\dealer;
use app\api\controller\Controller;
use app\api\model\dealer\Setting;
use app\api\model\dealer\User as DealerUserModel;
use app\api\model\dealer\Referee as RefereeModel;
/**
* 我的团队
* Class Order
* @package app\api\controller\user\dealer
*/
class Team extends Controller
{
/* @var \app\api\model\User $user */
private $user;
private $dealer;
private $setting;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
// 用户信息
$this->user = $this->getUser();
// 分销商用户信息
$this->dealer = DealerUserModel::detail($this->user['user_id']);
// 分销商设置
$this->setting = Setting::getAll();
}
/**
* 我的团队列表
* @param int $level
* @return array
* @throws \think\exception\DbException
*/
public function lists($level = -1)
{
$model = new RefereeModel;
return $this->renderSuccess([
// 分销商用户信息
'dealer' => $this->dealer,
// 我的团队列表
'list' => $model->getList($this->user['user_id'], (int)$level),
// 基础设置
'setting' => $this->setting['basic']['values'],
// 页面文字
'words' => $this->setting['words']['values'],
]);
}
}