AgainPayController.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. *
  5. * User: king/QQ:995265288
  6. * Date: 2018/7/27 下午5:01
  7. * Email: livsyitian@163.com
  8. */
  9. namespace app\backend\modules\withdraw\controllers;
  10. use app\backend\models\Withdraw;
  11. use app\common\exceptions\ShopException;
  12. use app\common\facades\Setting;
  13. use app\common\services\Session;
  14. use app\common\services\withdraw\PayedService;
  15. class AgainPayController extends PreController
  16. {
  17. /**
  18. * 提现记录 打款中重新打款接口
  19. */
  20. public function index()
  21. {
  22. \Log::debug('打款中重新打款接口+++++++++++++++++++++');
  23. if (!$this->checkVerify()) {
  24. $this->message('提现验证失败或验证已过期', yzWebUrl("withdraw.records", ['id' => $resultData['id']]), 'error');
  25. }
  26. $this->withdrawModel->status = 1;
  27. $result = (new PayedService($this->withdrawModel))->withdrawPay();
  28. return $result == true ? $this->successJson('打款成功') : $this->errorJson('打款失败,请刷新重试');
  29. }
  30. public function validatorWithdrawModel($withdrawModel)
  31. {
  32. if ($withdrawModel->status != Withdraw::STATUS_PAYING) {
  33. throw new ShopException('状态错误,不符合打款规则!');
  34. }
  35. }
  36. /**
  37. * 打款验证
  38. * @return bool
  39. */
  40. private function checkVerify()
  41. {
  42. $set = Setting::getByGroup('pay_password')['withdraw_verify'] ?: [];
  43. if (empty($set) || empty($set['is_phone_verify'])) {
  44. return true;
  45. }
  46. $verify = Session::get('withdraw_verify'); //没获取到
  47. if ($verify && $verify >= time()) {
  48. return true;
  49. }
  50. return false;
  51. }
  52. }