CoinLogController.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Http\Validator\CoinValidator;
  4. use App\Services\Common\CoinLogService;
  5. /**
  6. * 币明细
  7. * Class CoinLogController
  8. * @package App\Http\Controllers\Api
  9. */
  10. class CoinLogController extends webApp
  11. {
  12. public function __construct()
  13. {
  14. parent::__construct();
  15. $this->service = new CoinLogService();
  16. }
  17. /**
  18. * 获取列表
  19. * @return array|mixed
  20. */
  21. public function index()
  22. {
  23. $pageSize = request()->post('pageSize', 15);
  24. $params = request()->all();
  25. if($this->userInfo['user_type'] == 2){
  26. $params['business_id'] = $this->userInfo['user_id'];
  27. }
  28. $list = $this->service->getDataList($params, $pageSize);
  29. return message(1002, true, $list);
  30. }
  31. /**
  32. * 提币
  33. * @return array
  34. */
  35. public function withdraw(CoinValidator $validate)
  36. {
  37. $params = request()->post();
  38. $params = $validate->check($params,'out');
  39. if(!is_array($params)){
  40. return message($params, false,[]);
  41. }
  42. $params['check_google'] = false;
  43. if(!CoinLogService::make()->withdraw($this->userId, $params)){
  44. return message(CoinLogService::make()->getError(), false);
  45. }else{
  46. return message(CoinLogService::make()->getError(), true);
  47. }
  48. }
  49. }