AutomateAuditService.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. *
  5. * User: king/QQ:995265288
  6. * Date: 2018/6/15 下午2:03
  7. * Email: livsyitian@163.com
  8. */
  9. namespace app\frontend\modules\withdraw\services;
  10. use app\common\events\withdraw\WithdrawAuditedEvent;
  11. use app\common\events\withdraw\WithdrawAuditEvent;
  12. use app\common\events\withdraw\WithdrawAuditingEvent;
  13. use app\common\exceptions\ShopException;
  14. use app\common\services\withdraw\AuditService;
  15. use app\common\services\withdraw\PayedService;
  16. use app\frontend\modules\withdraw\models\Income;
  17. use app\frontend\modules\withdraw\models\Withdraw;
  18. use Illuminate\Support\Facades\DB;
  19. use Illuminate\Support\Facades\Log;
  20. class AutomateAuditService
  21. {
  22. /**
  23. * @var Withdraw
  24. */
  25. private $withdrawModel;
  26. public function __construct(Withdraw $withdrawModel)
  27. {
  28. $this->withdrawModel = $withdrawModel;
  29. \Setting::$uniqueAccountId = \YunShop::app()->uniacid = $withdrawModel->uniacid;
  30. }
  31. /**
  32. * 提现免审核
  33. */
  34. public function freeAudit()
  35. {
  36. $this->withdrawAudit();
  37. $this->withdrawPay();
  38. Log::debug("收入提现免审核ID:{$this->withdrawModel->id}自动审核打款完成");
  39. }
  40. /**
  41. * 提现审核
  42. */
  43. private function withdrawAudit()
  44. {
  45. $audit_ids = explode(',', $this->withdrawModel->type_id);
  46. $this->withdrawModel->audit_ids = $audit_ids;
  47. (new AuditService($this->withdrawModel))->withdrawAudit();
  48. }
  49. /**
  50. * 提现打款
  51. */
  52. private function withdrawPay()
  53. {
  54. (new PayedService($this->withdrawModel))->withdrawPay();
  55. }
  56. }