AgentLevel.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\controller\api\v2\agent;
  12. use app\Request;
  13. use app\services\agent\AgentLevelServices;
  14. use app\services\agent\AgentLevelTaskServices;
  15. /**
  16. * Class AgentLevel
  17. * @package app\controller\api\v2\agent
  18. */
  19. class AgentLevel
  20. {
  21. protected $services;
  22. public function __construct(AgentLevelServices $services)
  23. {
  24. $this->services = $services;
  25. }
  26. /**
  27. * 检测用户是否可以成为会员
  28. * @param Request $request
  29. * @return mixed
  30. */
  31. public function detection(Request $request)
  32. {
  33. return app('json')->successful($this->services->detection((int)$request->uid()));
  34. }
  35. /**
  36. * 分销员等级列表
  37. * @param Request $request
  38. * @return mixed
  39. */
  40. public function levelList(Request $request)
  41. {
  42. return app('json')->successful($this->services->getUserlevelList((int)$request->uid()));
  43. }
  44. /**
  45. * 获取等级任务
  46. * @param Request $request
  47. * @param AgentLevelTaskServices $services
  48. * @param $id
  49. * @return mixed
  50. * @throws \think\db\exception\DataNotFoundException
  51. * @throws \think\db\exception\DbException
  52. * @throws \think\db\exception\ModelNotFoundException
  53. */
  54. public function levelTaskList(Request $request, AgentLevelTaskServices $services, $id)
  55. {
  56. return app('json')->successful($services->getUserLevelTaskList((int)$request->uid(), (int)$id));
  57. }
  58. /**
  59. * 会员详情
  60. * @param Request $request
  61. * @return mixed
  62. */
  63. public function userLevelInfo(Request $request)
  64. {
  65. return app('json')->successful($this->services->getUserLevelInfo((int)$request->uid()));
  66. }
  67. }