| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- /**
- * 重庆赤晓店信息科技有限公司
- * https://www.chixiaodian.com
- * Copyright (c) 2023 赤店商城 All rights reserved.
- */
- namespace app\models;
- use Yii;
- use yii\behaviors\TimestampBehavior;
- use yii\db\ActiveRecord;
- /**
- * This is the model class for table "{{%live_comment}}".
- *
- * @property $id int(11) NOT NULL AUTO_INCREMENT,
- * @property $store_id int(11) DEFAULT NULL,
- * @property $content text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '评论内容',
- * @property $room_id int(11) NOT NULL COMMENT '直播间id',
- * @property $user_id int(11) NOT NULL COMMENT '评论人id',
- * @property $type tinyint(1) NOT NULL DEFAULT '0' COMMENT '评论类型:0普通用户评论,2,管理员评论, 3 提示',
- * @property $created_at int(11) NULL DEFAULT 0 ,
- */
- class LiveComment extends \yii\db\ActiveRecord
- {
- const TYPE_DEFAULT = 0;
- const TYPE_ADMIN = 2;
- const TYPE_INFO = 3;
-
- public static $type_list = [
- self::TYPE_DEFAULT => '用户评论',
- self::TYPE_ADMIN => '管理员评论',
- self::TYPE_INFO => '提示',
- ];
-
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return '{{%live_comment}}';
- }
- public function behaviors()
- {
- return [
- [
- // 自动更新创建和更新时间
- 'class' => TimestampBehavior::class,
- 'updatedAtAttribute' => false,
- ]
- ];
- }
-
- public static function type_name($type) {
- return self::$type_list[$type] ?? '';
- }
- }
|