Deposit.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace app\controller\merchant;
  3. use app\extra\basic\Base;
  4. use app\middleware\AuthMiddleware;
  5. use app\model\saas\SaasStore;
  6. use app\service\saas\DepositService;
  7. use DI\Attribute\Inject;
  8. use LinFly\Annotation\Attributes\Route\Controller;
  9. use LinFly\Annotation\Attributes\Route\GetMapping;
  10. use LinFly\Annotation\Attributes\Route\Middleware;
  11. use support\Request;
  12. use support\Response;
  13. /**
  14. * 保证金
  15. */
  16. #[Controller("/api/merchant/deposit"),Middleware(AuthMiddleware::class)]
  17. class Deposit extends Base
  18. {
  19. #[Inject]
  20. protected DepositService $service;
  21. #[GetMapping('list')]
  22. public function getDataList(Request $request): Response
  23. {
  24. try {
  25. $param = $request->all();
  26. $param['poi_id'] = $request->user['store_id'];
  27. $data = $this->service->setModel()->getList($param);
  28. return successTrans(100010,pageFormat($data),200);
  29. } catch (\Throwable $th) {
  30. return error($th->getMessage());
  31. }
  32. }
  33. #[GetMapping('data')]
  34. public function getDepositData(Request $request): Response
  35. {
  36. try {
  37. $deposit = (new SaasStore)->where("poi_id",$request->user['store_id'])->value("deposit");
  38. return success('ok',compact("deposit"));
  39. } catch (\Throwable $throwable) {
  40. return error($throwable->getMessage());
  41. }
  42. }
  43. }