CoinLogController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. if($this->userInfo['user_type'] == 2){
  30. $params['business_id'] = $this->userInfo['user_id'];
  31. }
  32. $list = $this->service->getDataList($params, $pageSize);
  33. $message = array(
  34. "msg" => '操作成功',
  35. "code" => 0,
  36. "data" => isset($list['list'])? $list['list']:[],
  37. "count" => isset($list['total'])? $list['total']:0,
  38. );
  39. return $message;
  40. }
  41. /**
  42. * 提币
  43. * @return array
  44. */
  45. public function withdraw(CoinValidator $validate)
  46. {
  47. $params = request()->post();
  48. $params = $validate->check($params,'withdraw');
  49. if(!is_array($params)){
  50. return returnJson($params, false,[]);
  51. }
  52. if(!CoinLogService::make()->withdraw($this->userInfo['user_id'], $params)){
  53. return returnJson(CoinLogService::make()->getError(), false);
  54. }else{
  55. return returnJson(CoinLogService::make()->getError(), true);
  56. }
  57. }
  58. /**
  59. * 提币审核
  60. * @return array
  61. */
  62. public function confirm(CoinValidator $validate)
  63. {
  64. $params = request()->post();
  65. $params = $validate->check($params,'confirm');
  66. if(!is_array($params)){
  67. return returnJson($params, false,[]);
  68. }
  69. if(!CoinLogService::make()->confirmWithdraw($this->userId, $params)){
  70. return returnJson(CoinLogService::make()->getError(), false);
  71. }else{
  72. return returnJson(CoinLogService::make()->getError(), true);
  73. }
  74. }
  75. }