Team.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\api\controller\plus\agent;
  3. use app\api\controller\Controller;
  4. use app\api\model\plus\agent\Setting;
  5. use app\api\model\plus\agent\User as AgentUserModel;
  6. use app\api\model\plus\agent\Referee as RefereeModel;
  7. /**
  8. * 我的团队
  9. */
  10. class Team extends Controller
  11. {
  12. // 用户信息
  13. private $user;
  14. // 分销商用户信息
  15. private $Agent;
  16. // 分销商设置
  17. private $setting;
  18. /**
  19. * 构造方法
  20. */
  21. public function initialize()
  22. {
  23. parent::initialize();
  24. // 用户信息
  25. $this->user = $this->getUser();
  26. // 分销商用户信息
  27. $this->Agent = AgentUserModel::detail($this->user['user_id']);
  28. // 分销商设置
  29. $this->setting = Setting::getAll();
  30. }
  31. /**
  32. * 我的团队列表
  33. */
  34. public function lists($level = -1)
  35. {
  36. $model = new RefereeModel;
  37. return $this->renderSuccess('', [
  38. // 分销商用户信息
  39. 'agent' => $this->Agent,
  40. // 我的团队列表
  41. 'list' => $model->getList($this->user['user_id'], (int)$level),
  42. // 基础设置
  43. 'setting' => $this->setting['basic']['values'],
  44. // 页面文字
  45. 'words' => $this->setting['words']['values'],
  46. ]);
  47. }
  48. }