CoinLogController.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Http\Validator\AdvertValidator;
  4. use App\Http\Validator\CoinValidator;
  5. use App\Services\Common\AdvertOrderService;
  6. use App\Services\Common\AdvertService;
  7. use App\Services\Common\CapitalLogService;
  8. use App\Services\Common\CoinLogService;
  9. /**
  10. * 币明细
  11. * Class CoinLogController
  12. * @package App\Http\Controllers\Admin
  13. */
  14. class CoinLogController extends Backend
  15. {
  16. public function __construct()
  17. {
  18. parent::__construct();
  19. $this->service = new CoinLogService();
  20. }
  21. /**
  22. * 获取列表
  23. * @return array|mixed
  24. */
  25. public function index()
  26. {
  27. $pageSize = request()->post('limit', 15);
  28. $params = request()->all();
  29. $params['user_id'] = isset($params['business_id'])? $params['business_id'] : 0;
  30. if($this->userInfo['user_type'] == 2 && empty($params['user_id'])){
  31. $params['user_id'] = $this->userInfo['user_id'];
  32. }
  33. $list = $this->service->getDataList($params, $pageSize);
  34. $message = array(
  35. "msg" => '操作成功',
  36. "code" => 0,
  37. "data" => isset($list['list'])? $list['list']:[],
  38. "count" => isset($list['total'])? $list['total']:0,
  39. );
  40. return $message;
  41. }
  42. /**
  43. * 提币
  44. * @return array
  45. */
  46. public function withdraw(CoinValidator $validate)
  47. {
  48. $params = request()->post();
  49. $params = $validate->check($params,'withdraw');
  50. if(!is_array($params)){
  51. return returnJson($params, false,[]);
  52. }
  53. if(!CoinLogService::make()->withdraw($this->userInfo['user_id'], $params)){
  54. return returnJson(CoinLogService::make()->getError(), false);
  55. }else{
  56. return returnJson(CoinLogService::make()->getError(), true);
  57. }
  58. }
  59. /**
  60. * 提币审核
  61. * @return array
  62. */
  63. public function confirm(CoinValidator $validate)
  64. {
  65. $params = request()->post();
  66. $params = $validate->check($params,'confirm');
  67. if(!is_array($params)){
  68. return returnJson($params, false,[]);
  69. }
  70. if(!CoinLogService::make()->confirmWithdraw($this->userId, $params)){
  71. return returnJson(CoinLogService::make()->getError(), false);
  72. }else{
  73. return returnJson(CoinLogService::make()->getError(), true);
  74. }
  75. }
  76. }