UserWithdrawLog.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. namespace addons\AvoidTax\common\models;
  3. use common\models\user\UserWithdrawLog as UserUserWithdrawLog;
  4. use yii\helpers\Json;
  5. /**
  6. * UserWithdrawLog class
  7. * @package addons\AvoidTax\common\models
  8. */
  9. class UserWithdrawLog extends UserUserWithdrawLog
  10. {
  11. /**
  12. * 获取申请中的合规提现记录
  13. *
  14. * @param integer $mall_id
  15. * @param integer $id
  16. * @return UserWithdrawLog|array|null a single row of query result. Depending on the setting of [[asArray]],
  17. */
  18. public static function getTaxLogByAgree(int $mall_id, int $id)
  19. {
  20. return static::find()
  21. ->where([
  22. 'id' => $id,
  23. 'mall_id' => $mall_id,
  24. 'status' => UserWithdrawLog::STATUS_AGREE,
  25. 'type' => 'alipay_tax'
  26. ])
  27. ->one();
  28. }
  29. /**
  30. * 获取申请中的合规提现记录
  31. *
  32. * @param integer $mall_id
  33. * @param integer $id
  34. * @return UserWithdrawLog|array|null a single row of query result. Depending on the setting of [[asArray]],
  35. */
  36. public static function getTaxLogByAgreeOrWait(int $mall_id, int $id)
  37. {
  38. return static::find()
  39. ->where([
  40. 'id' => $id,
  41. 'mall_id' => $mall_id,
  42. 'status' => [UserWithdrawLog::STATUS_AGREE, UserWithdrawLog::STATUS_WAIT],
  43. 'type' => 'alipay_tax'
  44. ])
  45. ->one();
  46. }
  47. /**
  48. * 获取申请中的合规提现记录集合
  49. *
  50. * @param integer $mall_id
  51. * @param array $ids
  52. * @return array|UserWithdrawLog[] the query results. If the query results in nothing, an empty array will be returned.
  53. */
  54. public static function getTaxLogsByAgree(int $mall_id, array $ids)
  55. {
  56. return static::find()
  57. ->where(['id' => $ids, 'mall_id' => $mall_id, 'status' => UserWithdrawLog::STATUS_AGREE, 'type' => 'alipay_tax'])
  58. ->all();
  59. }
  60. /**
  61. * 获取支付宝信息
  62. *
  63. * @return array [name, mobile, id_card]
  64. */
  65. public function getExtra()
  66. {
  67. $extra = Json::decode($this->extra);
  68. $name = !empty($extra['name']) ? $extra['name'] : '';
  69. $mobile = !empty($extra['mobile']) ? $extra['mobile'] : '';
  70. $id_card = !empty($extra['id_card']) ? $extra['id_card'] : '';
  71. return [$name, $mobile, $id_card];
  72. }
  73. }