DepositController.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Services\Common\DepositService;
  4. /**
  5. * 保证金管理
  6. * @package App\Http\Controllers\Admin
  7. */
  8. class DepositController extends Backend
  9. {
  10. /**
  11. * 构造函数
  12. * @author laravel开发员
  13. * @since 2020/11/11
  14. * GoodsController constructor.
  15. */
  16. public function __construct()
  17. {
  18. parent::__construct();
  19. $this->service = new DepositService();
  20. }
  21. /**
  22. * 列表
  23. * @return array
  24. */
  25. public function index()
  26. {
  27. $pageSize = request()->get('limit', 10);
  28. $list = $this->service->getDataList(request()->all(), $pageSize);
  29. $message = array(
  30. "msg" => '操作成功',
  31. "code" => 0,
  32. "data" => isset($list['list'])? $list['list']:[],
  33. "counts" => isset($list['counts'])? $list['counts']:[],
  34. "count" => isset($list['total'])? $list['total']:0,
  35. );
  36. return $message;
  37. }
  38. /**
  39. * 审核
  40. * @return array
  41. */
  42. public function confirm()
  43. {
  44. $params = request()->post();
  45. if(DepositService::make()->confirm($this->userId,$params)){
  46. return message(DepositService::make()->getError(), true);
  47. }else{
  48. return message(DepositService::make()->getError(), false);
  49. }
  50. }
  51. /**
  52. * 打款
  53. * @return array
  54. */
  55. public function payment()
  56. {
  57. $params = request()->post();
  58. if(DepositService::make()->payment($this->userId,$params)){
  59. return message(DepositService::make()->getError(), true);
  60. }else{
  61. return message(DepositService::make()->getError(), false);
  62. }
  63. }
  64. /**
  65. * 获取配置
  66. * @return array
  67. */
  68. public function getSetting()
  69. {
  70. if($config = DepositService::make()->getSetting()){
  71. return message(1010, true, $config);
  72. }else{
  73. return message(1009, false);
  74. }
  75. }
  76. /**
  77. * 保存设置
  78. * @return array
  79. */
  80. public function saveSetting()
  81. {
  82. $params = request()->post();
  83. if(DepositService::make()->saveSetting($this->userId,$params)){
  84. return message(DepositService::make()->getError(), true);
  85. }else{
  86. return message(DepositService::make()->getError(), false);
  87. }
  88. }
  89. /**
  90. * 删除数据
  91. * @return mixed
  92. * @since 2020/11/11
  93. * @author laravel开发员
  94. */
  95. public function delete()
  96. {
  97. $result = $this->service->delete();
  98. return $result;
  99. }
  100. }