IncomeFreeAuditService.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /****************************************************************
  3. * Author: libaojia
  4. * Date: 2017/9/8 上午9:19
  5. * Email: livsyitian@163.com
  6. * QQ: 995265288
  7. * User: 芸众商城 www.yunzshop.com
  8. ****************************************************************/
  9. namespace app\common\services\finance;
  10. use app\backend\modules\finance\services\WithdrawService as Withdraw;
  11. use app\common\services\credit\ConstService;
  12. use app\common\services\PayFactory;
  13. class IncomeFreeAuditService
  14. {
  15. private $amount;
  16. public function incomeFreeAudit($withdraw,$payWay)
  17. {
  18. $result = false;
  19. $remark = '提现打款-' . $withdraw->type_name . '-金额:' . $withdraw->actual_amounts . '元,';
  20. if ($payWay == 'balance') {
  21. $result = $this->balanceWithdrawPay($withdraw, $remark);
  22. \Log::info('MemberId:' . $withdraw->member_id . ', ' . $remark . "打款到余额中!");
  23. }
  24. if ($payWay == 'wechat') {
  25. $result = $this->wechatWithdrawPay($withdraw, $remark);
  26. \Log::info('MemberId:' . $withdraw->member_id . ', ' . $remark . "微信打款中!");
  27. }
  28. if ($result) {
  29. return Withdraw::otherWithdrawSuccess($withdraw->id);
  30. }
  31. return false;
  32. }
  33. private function balanceWithdrawPay($withdraw,$remark)
  34. {
  35. $data = array(
  36. 'member_id' => $withdraw->member_id,
  37. 'remark' => $remark,
  38. 'source' => ConstService::SOURCE_INCOME,
  39. 'relation' => '',
  40. 'operator' => ConstService::OPERATOR_MEMBER,
  41. 'operator_id' => $withdraw->id,
  42. 'change_value' => $withdraw->actual_amounts
  43. );
  44. return (new BalanceChange())->income($data);
  45. }
  46. private function wechatWithdrawPay($withdraw,$remark)
  47. {
  48. return PayFactory::create(1)->doWithdraw($withdraw->member_id, $withdraw->withdraw_sn, $withdraw->actual_amounts, $remark);
  49. }
  50. }