UserAuditLog.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use app\utils\Notice\NoticeSend;
  9. use yii\behaviors\TimestampBehavior;
  10. /**
  11. * Class StoreAliMini
  12. * @package app\models
  13. * @property integer $id
  14. * @property string $wechat_open_id
  15. * @property string $wechat_platform_open_id
  16. * @property string $ali_openId
  17. * @property string $ali_user_id
  18. * @property integer $store_id
  19. * @property string $avatar
  20. * @property string $mobile
  21. * @property integer $status
  22. * @property integer $type
  23. * @property integer $user_id
  24. * @property integer $custom_form
  25. * @property integer $is_delete
  26. * @property string $pass_remark
  27. * @property string $audit_time
  28. * @property string $created_at
  29. * @property string $updated_at
  30. *
  31. *
  32. **/
  33. class UserAuditLog extends \yii\db\ActiveRecord
  34. {
  35. const STATUS_NOT_AUDIT = -1;//未处理
  36. const STATUS_NOT_AGREE = 0;//未通过
  37. const STATUS_AGREE = 1;//通过
  38. const STATUS_PASS = 2;//已拒绝
  39. const STATUS_ARR = [
  40. self::STATUS_NOT_AUDIT,
  41. self::STATUS_NOT_AGREE,
  42. self::STATUS_AGREE,
  43. self::STATUS_PASS
  44. ];
  45. const TYPE_H5 = 0;//h5来源
  46. const TYPE_WX = 1;//微信来源
  47. const TYPE_ALI = 2;//支付宝来源
  48. const TYPE_APP = 3;//APP来源
  49. /**
  50. * @inheritdoc
  51. */
  52. public static function tableName()
  53. {
  54. return '{{%user_audit_log}}';
  55. }
  56. /**
  57. * @inheritdoc
  58. */
  59. public function rules()
  60. {
  61. return [
  62. [['id', 'store_id', 'status', 'type', 'user_id', 'is_delete'], 'integer'],
  63. [['avatar', 'created_at', 'updated_at', 'audit_time', 'pass_remark', 'custom_form', 'wechat_open_id', 'ali_openId', 'ali_user_id', 'wechat_platform_open_id', 'mobile'], 'string']
  64. ];
  65. }
  66. public function behaviors()
  67. {
  68. return [
  69. [
  70. 'class' => TimestampBehavior::class
  71. ]
  72. ];
  73. }
  74. public function afterSave($insert, $changedAttributes)
  75. {
  76. parent::afterSave($insert, $changedAttributes);
  77. if (!$insert && isset($changedAttributes['status']) && in_array($this->status, [self::STATUS_AGREE, self::STATUS_PASS])) {
  78. NoticeSend::userAuditStatusNotice($this->id, $this->store_id);
  79. } else {
  80. NoticeSend::userAuditNotice($this->id, $this->store_id);
  81. }
  82. }
  83. /**
  84. * @inheritdoc
  85. */
  86. public function attributeLabels()
  87. {
  88. return [
  89. 'id' => '',
  90. 'wechat_open_id' => '微信openid',
  91. 'wechat_platform_open_id' => '微信公众号openid',
  92. 'ali_openId' => '支付宝openid',
  93. 'ali_user_id' => '支付宝userid',
  94. 'store_id' => '绑定店铺',
  95. 'mobile' => '手机号',
  96. 'status' => '状态0未审核 1已通过 2已拒绝',
  97. 'type' => '来源:0:h5 1:微信 2:支付宝',
  98. 'user_id' => '绑定的user_id',
  99. 'is_delete' => '是否删除',
  100. 'pass_remark' => '拒绝原因',
  101. 'created_at' => '',
  102. 'updated_at' => '',
  103. 'audit_time' => '审核时间'
  104. ];
  105. }
  106. }