ShareRedpackInvate.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. namespace addons\ShareRedpack\common\models;
  3. use common\models\user\User;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_share_redpack_invate".
  7. *
  8. * @property int $id
  9. * @property int $mall_id 商城id
  10. * @property int $user_id 用户id
  11. * @property string $invite_code 邀请码
  12. * @property int $num 邀请用户数
  13. * @property int $created_at
  14. * @property int $updated_at
  15. */
  16. class ShareRedpackInvate extends \common\models\base\BaseActiveRecord
  17. {
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public static function tableName()
  22. {
  23. return 'qimall_addons_share_redpack_invate';
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function rules()
  29. {
  30. return [
  31. [['mall_id', 'user_id', 'invite_code', 'num'], 'required'],
  32. [['mall_id', 'user_id', 'num', 'created_at', 'updated_at'], 'integer'],
  33. [['invite_code'], 'string', 'max' => 64],
  34. ];
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function attributeLabels()
  40. {
  41. return [
  42. 'id' => 'ID',
  43. 'mall_id' => 'Mall ID',
  44. 'user_id' => 'User ID',
  45. 'invite_code' => 'Invite Code',
  46. 'num' => 'Num',
  47. 'created_at' => 'Created At',
  48. 'updated_at' => 'Updated At',
  49. ];
  50. }
  51. /**
  52. * 关联用户表
  53. */
  54. public function getUser()
  55. {
  56. return $this->hasOne(User::class,['id'=>'user_id'])->select('nickname,avatar_url,mobile,username,id,created_at');
  57. }
  58. }