QrcodeStat.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace addons\Wechat\common\models;
  3. use common\models\member\Auth;
  4. /**
  5. * This is the model class for table "{{%addon_wechat_qrcode_stat}}".
  6. *
  7. * @property int $id
  8. * @property int|null $merchant_id 商户id
  9. * @property int|null $store_id 店铺ID
  10. * @property int|null $qrcord_id 二维码id
  11. * @property string|null $openid 微信openid
  12. * @property int|null $type 1:关注;2:扫描
  13. * @property string|null $name 场景名称
  14. * @property string|null $scene_str 场景值
  15. * @property int|null $scene_id 场景ID
  16. * @property int|null $status 状态
  17. * @property int|null $created_at 创建时间
  18. * @property int|null $updated_at 修改时间
  19. */
  20. class QrcodeStat extends \common\models\base\BaseModel
  21. {
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public static function tableName()
  26. {
  27. return '{{%addon_wechat_qrcode_stat}}';
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function rules()
  33. {
  34. return [
  35. [['merchant_id', 'store_id', 'qrcord_id', 'type', 'scene_id', 'status', 'created_at', 'updated_at'], 'integer'],
  36. [['openid', 'name'], 'string', 'max' => 50],
  37. [['scene_str'], 'string', 'max' => 64],
  38. ];
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function attributeLabels()
  44. {
  45. return [
  46. 'id' => 'ID',
  47. 'merchant_id' => '商户id',
  48. 'store_id' => '店铺ID',
  49. 'qrcord_id' => '二维码id',
  50. 'openid' => '微信openid',
  51. 'type' => '1:关注;2:扫描',
  52. 'name' => '场景名称',
  53. 'scene_str' => '场景值',
  54. 'scene_id' => '场景ID',
  55. 'status' => '状态',
  56. 'created_at' => '创建时间',
  57. 'updated_at' => '修改时间',
  58. ];
  59. }
  60. /**
  61. * @return \yii\db\ActiveQuery
  62. */
  63. public function getFans()
  64. {
  65. return $this->hasOne(Fans::class,['openid' => 'openid']);
  66. }
  67. /**
  68. * 关联授权
  69. */
  70. public function getAuth()
  71. {
  72. return $this->hasOne(Auth::class, ['oauth_client_user_id' => 'openid']);
  73. }
  74. }
粤ICP备19079148号