Service.php 3.4 KB

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