cxgj/models/OrderComments.php
2023-11-27 09:45:13 +08:00

117 lines
4.2 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\models;
use Yii;
use app\models\Model;
/**
* This is the model class for table "{{%order_comments}}".
*
* @property int $id ID
* @property int $cx_mch_id 平台商家ID
* @property int $order_id 订单ID
* @property int $order_detail_id 订单详情ID
* @property int $user_id 用户ID
* @property int $score 评分1=差评2=中评3=好
* @property string $content 评价内容
* @property string $pic_urls 评价图片
* @property int $is_show 是否显示0=不显示1=显示
* @property int $is_virtual 是否虚拟用户
* @property string $virtual_user 虚拟用户名
* @property string $virtual_avatar 虚拟头像
* @property int $virtual_time 虚拟评价时间
* @property int $goods_id 商品ID
* @property int $goods_hub_id 商品库ID
* @property string $plugin_sign 插件标识
* @property string $reply_content 商家回复内容
* @property int $created_at 添加时间
* @property int $updated_at 更新时间
* @property int $deleted_at 删除时间
* @property int $is_delete 是否删除0=否1=是
* @property int $is_anonymous 是否匿名0=否1=是
* @property int $is_top 是否置顶0=否1=是
* @property string|null $goods_attr_info 商品信息
* @property int $attr_id 规格
*/
class OrderComments extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return '{{%order_comments}}';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['content', 'pic_urls', 'reply_content', 'goods_attr_info', 'virtual_user', 'plugin_sign', 'virtual_avatar'], 'trim'],
[['cx_mch_id', 'order_id', 'order_detail_id', 'user_id', 'score', 'is_show', 'is_virtual', 'virtual_time', 'goods_id', 'goods_hub_id', 'created_at', 'updated_at', 'deleted_at', 'is_delete', 'is_anonymous', 'is_top', 'attr_id'], 'integer'],
[['order_id', 'order_detail_id', 'user_id', 'score', 'content', 'pic_urls', 'goods_hub_id', 'reply_content', 'created_at', 'updated_at', 'deleted_at'], 'required'],
[['content', 'pic_urls', 'reply_content', 'goods_attr_info'], 'string'],
[['virtual_user', 'plugin_sign'], 'string', 'max' => 255],
[['virtual_avatar'], 'string', 'max' => 2048],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'ID',
'cx_mch_id' => '平台商家ID',
'order_id' => '订单ID',
'order_detail_id' => '订单详情ID',
'user_id' => '用户ID',
'score' => '评分1=差评2=中评3=好',
'content' => '评价内容',
'pic_urls' => '评价图片',
'is_show' => '是否显示0=不显示1=显示',
'is_virtual' => '是否虚拟用户',
'virtual_user' => '虚拟用户名',
'virtual_avatar' => '虚拟头像',
'virtual_time' => '虚拟评价时间',
'goods_id' => '商品ID',
'goods_hub_id' => '商品库ID',
'plugin_sign' => '插件标识',
'reply_content' => '商家回复内容',
'created_at' => '添加时间',
'updated_at' => '更新时间',
'deleted_at' => '删除时间',
'is_delete' => '是否删除0=否1=是',
'is_anonymous' => '是否匿名0=否1=是',
'is_top' => '是否置顶0=否1=是',
'goods_attr_info' => '商品信息',
'attr_id' => '规格',
];
}
public function beforeSave($insert) {
if(parent::beforeSave($insert)){
if($this->isNewRecord){
$this->created_at = time();
}
$this->updated_at = time();
if($this->is_delete == 1)
$this->deleted_at = time();
$this->htmlTagFilter();
return true;
} else {
return false;
}
}
public function htmlTagFilter()
{
$this->content = Model::htmlTagFilter($this->content);
}
}