WithdrawLog.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. namespace addons\Alitopay\common\models;
  3. use addons\Alitopay\common\enums\AlitoapyEnum;
  4. use common\models\user\UserWithdrawLog;
  5. /**
  6. * 商城提现model
  7. * @package addons\Alitopay\common\models
  8. */
  9. class WithdrawLog extends UserWithdrawLog
  10. {
  11. /**
  12. * 通过IDs获取支付宝代付提现
  13. *
  14. * @param integer $mall_id
  15. * @param array $ids
  16. * @return array
  17. */
  18. public static function getAlitopayLogByIds(int $mall_id, array $ids)
  19. {
  20. return static::find()
  21. ->where([
  22. 'id' => $ids,
  23. 'mall_id' => $mall_id,
  24. 'status' => UserWithdrawLog::STATUS_AGREE,
  25. 'type' => AlitoapyEnum::ALITOPAY,
  26. ])
  27. ->asArray()
  28. ->all();
  29. }
  30. /**
  31. * 通过IDs获取支付宝代付提现
  32. *
  33. * @param array $ids
  34. * @return array
  35. */
  36. public static function getLogByIds(array $ids)
  37. {
  38. return static::find()
  39. ->where(['id' => $ids])
  40. ->all();
  41. }
  42. /**
  43. * 通过ID获取支付宝代付提现
  44. *
  45. * @param integer $id
  46. * @return static
  47. */
  48. public static function getLogById(int $id)
  49. {
  50. return static::findOne($id);
  51. }
  52. /**
  53. * 通过ids修改状态打款中
  54. *
  55. * @param array $ids
  56. * @return int
  57. */
  58. public static function changeStatusToPayingByIds(array $ids)
  59. {
  60. return static::updateAll(
  61. ['status' => static::STATUS_WAIT, 'updated_at' => time()], ['id' => $ids]
  62. );
  63. }
  64. }