/**
  * 粉丝用户表
  */
 public function initUserTable()
 {
     // 公众号粉丝详情表
     $tableName = MpUser::tableName();
     $this->createTable($tableName, ['id' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '粉丝ID'", 'nickname' => Schema::TYPE_STRING . "(20) NOT NULL DEFAULT '' COMMENT '昵称'", 'sex' => Schema::TYPE_BOOLEAN . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '性别'", 'city' => Schema::TYPE_STRING . "(40) NOT NULL DEFAULT '' COMMENT '所在城市'", 'country' => Schema::TYPE_STRING . "(40) NOT NULL DEFAULT '' COMMENT '所在省'", 'province' => Schema::TYPE_STRING . "(40) NOT NULL DEFAULT '' COMMENT '微信ID'", 'language' => Schema::TYPE_STRING . "(40) NOT NULL DEFAULT '' COMMENT '用户语言'", 'avatar' => Schema::TYPE_STRING . " NOT NULL DEFAULT '' COMMENT '用户头像'", 'subscribe_time' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '关注时间'", 'union_id' => Schema::TYPE_STRING . "(30) NOT NULL DEFAULT '' COMMENT '用户头像'", 'remark' => Schema::TYPE_STRING . " NOT NULL DEFAULT '' COMMENT '备注'", 'group_id' => Schema::TYPE_SMALLINT . " NOT NULL DEFAULT '0' COMMENT '分组ID'", 'updated_at' => Schema::TYPE_INTEGER . " UNSIGNED NOT NULL DEFAULT '0' COMMENT '修改时间'"]);
     $this->createIndex('id', $tableName, 'id', true);
 }
예제 #2
0
 /**
  * 关联的用户信息
  * @return \yii\db\ActiveQuery
  */
 public function getUser()
 {
     return $this->hasOne(MpUser::className(), ['id' => 'id']);
 }