Service.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020/5/29
  7. *
  8. *
  9. */
  10. namespace app\controller\api\store\service;
  11. use crmeb\basic\BaseController;
  12. use app\common\repositories\store\service\StoreServiceLogRepository;
  13. use app\common\repositories\store\service\StoreServiceRepository;
  14. use think\App;
  15. use think\db\exception\DataNotFoundException;
  16. use think\db\exception\DbException;
  17. use think\db\exception\ModelNotFoundException;
  18. /**
  19. * Class Service
  20. * @package app\controller\api\store\service
  21. * @author xaboy
  22. * @day 2020/5/29
  23. */
  24. class Service extends BaseController
  25. {
  26. /**
  27. * @var StoreServiceRepository
  28. */
  29. protected $repository;
  30. /**
  31. * Service constructor.
  32. * @param App $app
  33. * @param StoreServiceRepository $repository
  34. */
  35. public function __construct(App $app, StoreServiceRepository $repository)
  36. {
  37. parent::__construct($app);
  38. $this->repository = $repository;
  39. }
  40. /**
  41. * @param $id
  42. * @param StoreServiceLogRepository $repository
  43. * @return mixed
  44. * @throws DataNotFoundException
  45. * @throws DbException
  46. * @throws ModelNotFoundException
  47. * @author xaboy
  48. * @day 2020/6/15
  49. */
  50. public function chatHistory($id, StoreServiceLogRepository $repository)
  51. {
  52. [$page, $limit] = $this->getPage();
  53. return app('json')->success($repository->userList($id, $this->request->uid(), $page, $limit));
  54. }
  55. /**
  56. * @param StoreServiceLogRepository $repository
  57. * @return mixed
  58. * @throws DataNotFoundException
  59. * @throws DbException
  60. * @throws ModelNotFoundException
  61. * @author xaboy
  62. * @day 2020/6/16
  63. */
  64. public function getList(StoreServiceLogRepository $repository)
  65. {
  66. [$page, $limit] = $this->getPage();
  67. return app('json')->success($repository->userMerchantList($this->request->uid(), $page, $limit));
  68. }
  69. /**
  70. * @param StoreServiceLogRepository $repository
  71. * @return mixed
  72. * @throws DataNotFoundException
  73. * @throws DbException
  74. * @throws ModelNotFoundException
  75. * @author xaboy
  76. * @day 2020/6/16
  77. */
  78. public function serviceUserList(StoreServiceLogRepository $repository)
  79. {
  80. [$page, $limit] = $this->getPage();
  81. return app('json')->success($repository->serviceUserList($this->request->uid(), $page, $limit));
  82. }
  83. /**
  84. * @param $merId
  85. * @param $id
  86. * @param StoreServiceLogRepository $repository
  87. * @return mixed
  88. * @throws DataNotFoundException
  89. * @throws DbException
  90. * @throws ModelNotFoundException
  91. * @author xaboy
  92. * @day 2020/6/15
  93. */
  94. public function serviceHistory($merId, $id, StoreServiceLogRepository $repository)
  95. {
  96. [$page, $limit] = $this->getPage();
  97. return app('json')->success($repository->merList($merId, $id, $this->request->uid(), $page, $limit));
  98. }
  99. }