PaymentController.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: tandunzhao
  5. * Date: 2017/11/22
  6. * Time: 下午3:23
  7. */
  8. namespace App\Http\Controllers\Channel\Finance;
  9. use App\Http\Controllers\Channel\Finance\Transformers\PaymentDetailTransformer;
  10. use App\Http\Controllers\Channel\Finance\Transformers\PaymentTransformer;
  11. use App\Modules\Finance\Services\FinancialConfigService;
  12. use App\Modules\Finance\Services\PaymentService;
  13. use App\Modules\Finance\Services\WithdrawCashService;
  14. use Illuminate\Http\Request;
  15. use DB;
  16. class PaymentController extends BaseController
  17. {
  18. /**
  19. * @apiDefine Finance 结算提现模块
  20. */
  21. /**
  22. * @apiVersion 1.0.0
  23. * @apiDescription 打款列表
  24. * @api {GET} payments 打款列表
  25. * @apiGroup Finance
  26. * @apiName payments
  27. * @apiParam {Number} withdraw_cash_id 提现id.
  28. * @apiParam {String} [start_time] 开始时间(可不传)
  29. * @apiParam {String} [end_time] 结束时间(可不传)
  30. * @apiSuccess {Number} id 打款 id.
  31. * @apiSuccess {Number} withdraw_cash_id 提现 id.
  32. * @apiSuccess {Number} amount 打款金额.
  33. * @apiSuccess {String} remark 备注
  34. * @apiSuccess {String} pay_time 打款时间
  35. * @apiSuccessExample {json} Success-Response:
  36. *
  37. * {
  38. * "code": 0,
  39. * "msg": "",
  40. * "data":{
  41. * "list": [
  42. * {
  43. * "id": 1,
  44. * "withdraw_cash_id": 1,
  45. * "amount": "1000.0000",
  46. * "remark": "dfsdfssd",
  47. * "pay_time": "2017-11-20 14:28:28"
  48. * }
  49. * ],
  50. * "meta": {
  51. * "total": 1,
  52. * "per_page": 15,
  53. * "current_page": 1,
  54. * "last_page": 1,
  55. * "next_page_url": "",
  56. * "prev_page_url": ""
  57. * }
  58. * }
  59. * }
  60. */
  61. function get_list(Request $request) {
  62. $withdraw_cash_id = $request->has('withdraw_cash_id') ? $request->input('withdraw_cash_id') : '';
  63. $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
  64. $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : '';
  65. $end_time = self::getMaxDay($end_time);
  66. $payments = PaymentService::getPaymentList($withdraw_cash_id, $start_time, $end_time);
  67. return response()->pagination(new PaymentTransformer(), $payments);
  68. }
  69. /**
  70. * @apiVersion 1.0.0
  71. * @apiDescription 打款列表详情
  72. * @api {GET} listPayments 打款列表详情
  73. * @apiGroup Finance
  74. * @apiName listPayments
  75. * @apiParam {Number} withdraw_cash_id 提现 id.
  76. * @apiParam {String} [start_time] 开始时间(可不传)
  77. * @apiParam {String} [end_time] 结束时间(可不传)
  78. * @apiParam {String} [account_name] 账户名称
  79. * @apiParam {String} [search_name] 搜索名称
  80. * @apiParam {Number} [status] 状态 查看接口 api/getWithdrawCashStatus (可不传,获取所有状态)
  81. *
  82. * @apiSuccess {Number} id 打款 id.
  83. * @apiSuccess {Number} withdraw_cash_id 提现 id.
  84. * @apiSuccess {Number} amount 打款金额.
  85. * @apiSuccess {String} remark 备注
  86. * @apiSuccess {String} pay_time 打款时间
  87. * @apiSuccess {String} status 打款状态
  88. * @apiSuccess {Number} check_user_id 审核人ID
  89. * @apiSuccess {String} check_user_name 审核人名称
  90. * @apiSuccess {String} account_name 银行卡户主名称
  91. * @apiSuccess {String} identity_card 银行卡户主身份证
  92. * @apiSuccess {String} card_number 银行卡账号
  93. * @apiSuccess {String} account_bank 银行支行
  94. * @apiSuccess {String} bank 银行名称
  95. * @apiSuccess {String} province 银行地址
  96. * @apiSuccessExample {json} Success-Response:
  97. *
  98. * {
  99. * "code": 0,
  100. * "msg": "",
  101. * "data":{
  102. * "list": [
  103. * {
  104. * "id": 1,
  105. * "withdraw_cash_id": 1,
  106. * "amount": "1000.0000",
  107. * "pay_time": "2017-11-20 14:28:28",
  108. * "status": "已打款",
  109. * "remark": "哈哈哈,有钱",
  110. * "check_user_id": 1,
  111. * "check_user_name": "张大妈",
  112. * "account_name": "宋晓",
  113. * "identity_card": "33038119930901821X",
  114. * "card_number": "6222520177654916",
  115. * "account_bank": "钱江支行",
  116. * "bank": "杭州银行",
  117. * "province": "北京市"
  118. * }
  119. * ],
  120. * "meta": {
  121. * "total": 1,
  122. * "per_page": 15,
  123. * "current_page": 1,
  124. * "last_page": 1,
  125. * "next_page_url": "",
  126. * "prev_page_url": ""
  127. * }
  128. * }
  129. * }
  130. */
  131. function get_listDetail(Request $request) {
  132. $distribution_channel_id = $this->getChannelId();
  133. $distribution_channel_name = $this->getChannelName();
  134. $distribution_channel_name = '';
  135. $withdraw_cash_id = $request->has('withdraw_cash_id') ? $request->input('withdraw_cash_id') : '';
  136. $start_time = $request->has('start_time') && !empty($request->input('start_time')) ? date('Ymd',strtotime($request->input('start_time'))) : '';
  137. $end_time = $request->has('end_time') && !empty($request->input('end_time')) ? date('Ymd',strtotime($request->input('end_time'))) : '';
  138. $account_name = $request->has('account_name') ? $request->input('account_name') : '';
  139. $search_name = $request->has('search_name') ? $request->input('search_name') : '';
  140. $status = $request->has('status') ? $request->input('status') : '';
  141. $params = [
  142. 'withdraw_cash_id'=>$withdraw_cash_id,
  143. 'channel_id'=>$distribution_channel_id,
  144. 'channel_name'=>$distribution_channel_name,
  145. 'start_date'=>$start_time,
  146. 'end_date'=>$end_time,
  147. 'account_name'=>$account_name,
  148. 'search_name'=>$search_name,
  149. ];
  150. $payments = PaymentService::getPaymentDetailList($params, $status);
  151. return response()->pagination(new PaymentDetailTransformer(), $payments);
  152. }
  153. }