Withdraw.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. namespace app\store\controller\apps\dealer;
  3. use app\store\controller\Controller;
  4. use app\store\model\dealer\Withdraw as WithdrawModel;
  5. /**
  6. * 分销商提现申请
  7. * Class Setting
  8. * @package app\store\controller\apps\dealer
  9. */
  10. class Withdraw extends Controller
  11. {
  12. /**
  13. * 提现记录列表
  14. * @param int $user_id
  15. * @param int $apply_status
  16. * @param int $pay_type
  17. * @param string $search
  18. * @return mixed
  19. * @throws \think\exception\DbException
  20. */
  21. public function index($user_id = null, $apply_status = -1, $pay_type = -1, $search = '')
  22. {
  23. $model = new WithdrawModel;
  24. return $this->fetch('index', [
  25. 'list' => $model->getList($user_id, $apply_status, $pay_type, $search)
  26. ]);
  27. }
  28. /**
  29. * 提现审核
  30. * @param $id
  31. * @return array
  32. * @throws \app\common\exception\BaseException
  33. * @throws \think\exception\DbException
  34. */
  35. public function submit($id)
  36. {
  37. $model = WithdrawModel::detail($id);
  38. if ($model->submit($this->postData('withdraw'))) {
  39. return $this->renderSuccess('操作成功');
  40. }
  41. return $this->renderError($model->getError() ?: '操作失败');
  42. }
  43. /**
  44. * 确认打款
  45. * @param $id
  46. * @return array
  47. * @throws \think\exception\DbException
  48. */
  49. public function money($id)
  50. {
  51. $model = WithdrawModel::detail($id);
  52. if ($model->money()) {
  53. return $this->renderSuccess('操作成功');
  54. }
  55. return $this->renderError($model->getError() ?: '操作失败');
  56. }
  57. /**
  58. * 分销商提现:微信支付企业付款
  59. * @param $id
  60. * @return array|bool
  61. * @throws \app\common\exception\BaseException
  62. * @throws \think\exception\DbException
  63. */
  64. public function wechat_pay($id)
  65. {
  66. $model = WithdrawModel::detail($id);
  67. if ($model->wechatPay()) {
  68. return $this->renderSuccess('操作成功');
  69. }
  70. return $this->renderError($model->getError() ?: '操作失败');
  71. }
  72. }