CoinLogController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Http\Controllers\Admin;
  3. use App\Http\Validator\AdvertValidator;
  4. use App\Services\Common\AdvertOrderService;
  5. use App\Services\Common\AdvertService;
  6. use App\Services\Common\CapitalLogService;
  7. use App\Services\Common\CoinLogService;
  8. /**
  9. * 币明细
  10. * Class CoinLogController
  11. * @package App\Http\Controllers\Admin
  12. */
  13. class CoinLogController extends Backend
  14. {
  15. public function __construct()
  16. {
  17. parent::__construct();
  18. $this->service = new CoinLogService();
  19. }
  20. /**
  21. * 获取列表
  22. * @return array|mixed
  23. */
  24. public function index()
  25. {
  26. $pageSize = request()->post('limit', 15);
  27. $params = request()->all();
  28. if($this->userInfo['user_type'] == 2){
  29. $params['business_id'] = $this->userInfo['user_id'];
  30. }
  31. $list = $this->service->getDataList($params, $pageSize);
  32. $message = array(
  33. "msg" => '操作成功',
  34. "code" => 0,
  35. "data" => isset($list['list'])? $list['list']:[],
  36. "count" => isset($list['total'])? $list['total']:0,
  37. );
  38. return $message;
  39. }
  40. /**
  41. * 提币
  42. * @return array
  43. */
  44. public function transfer()
  45. {
  46. $params = request()->post();
  47. if(!AdvertOrderService::make()->buy($this->userInfo['user_id'], $params)){
  48. return message(AdvertOrderService::make()->getError(), false);
  49. }else{
  50. return message(AdvertOrderService::make()->getError(), true);
  51. }
  52. }
  53. }