DeedController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace App\Http\Controllers\Deed;
  3. use App\Http\Controllers\Controller;
  4. use App\Http\Controllers\Core\Auth;
  5. use App\Services\Deed\DeedService;
  6. use Illuminate\Http\Request;
  7. class DeedController extends Controller
  8. {
  9. /**
  10. * 活跃的契约
  11. * @param Request $request
  12. * @return array
  13. * @throws \Tymon\JWTAuth\Exceptions\JWTException
  14. */
  15. public function ings(Request $request)
  16. {
  17. $uid = Auth::auth();
  18. $page = $request->get('page') ?? 1;
  19. $pages = array(
  20. 'limit' => 20,
  21. 'page' => $page
  22. );
  23. $ds = new DeedService();
  24. $data = $ds->ings($uid, $pages);
  25. return array(
  26. 'code' => 200,
  27. 'message' => 'success',
  28. 'data' => $data
  29. );
  30. }
  31. /**
  32. * 不活跃的契约
  33. * @param Request $request
  34. * @return array
  35. * @throws \Tymon\JWTAuth\Exceptions\JWTException
  36. */
  37. public function succs(Request $request)
  38. {
  39. $uid = Auth::auth();
  40. $page = $request->get('page') ?? 1;
  41. $pages = array(
  42. 'limit' => 20,
  43. 'page' => $page
  44. );
  45. $ds = new DeedService();
  46. $data = $ds->succs($uid, $pages);
  47. return array(
  48. 'code' => 200,
  49. 'message' => 'success',
  50. 'data' => $data
  51. );
  52. }
  53. /**
  54. * 查看契约信息
  55. * @param int $deed_id
  56. * @return array
  57. */
  58. public function show(int $deed_id)
  59. {
  60. $ds = new DeedService();
  61. $data = $ds->get($deed_id);
  62. return array(
  63. 'code' => 200,
  64. 'message' => 'success',
  65. 'data' => $data
  66. );
  67. }
  68. /**
  69. * 查看契约信息
  70. * @param Request $request
  71. * @return array
  72. * @throws \App\Exceptions\AlertException
  73. * @throws \Tymon\JWTAuth\Exceptions\JWTException
  74. */
  75. public function getbytua(Request $request)
  76. {
  77. $uid = Auth::auth();
  78. $this->validate($request, [
  79. 'type' => 'required',
  80. 'ack' => 'required',
  81. ]);
  82. $type = $request->post('type');
  83. $ack = $request->post('ack');
  84. $ds = new DeedService();
  85. $data = $ds->getByTUA($type, $uid, $ack);
  86. return array(
  87. 'code' => 200,
  88. 'message' => 'success',
  89. 'data' => $data
  90. );
  91. }
  92. /**
  93. * 查看契约信息
  94. * @param Request $request
  95. * @return array
  96. * @throws \App\Exceptions\AlertException
  97. * @throws \Tymon\JWTAuth\Exceptions\JWTException
  98. */
  99. public function getbytuw(Request $request)
  100. {
  101. $uid = Auth::auth();
  102. $this->validate($request, [
  103. 'type' => 'required',
  104. 'way' => 'required',
  105. 'way_id' => 'required',
  106. ]);
  107. $type = $request->post('type');
  108. $way = $request->post('way');
  109. $way_id = $request->post('way_id');
  110. $ds = new DeedService();
  111. $data = $ds->getByTUW($type, $uid, $way, $way_id);
  112. return array(
  113. 'code' => 200,
  114. 'message' => 'success',
  115. 'data' => $data
  116. );
  117. }
  118. }