Service.php 2.8 KB

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