Browse Source

feat:定义评论模型中的状态字段

antshop
linyaostalker 5 years ago
parent
commit
fe8fe20ba0
  1. 13
      backend/modules/shop/models/ars/Comment.php

13
backend/modules/shop/models/ars/Comment.php

@ -4,6 +4,7 @@ namespace backend\modules\shop\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
use backend\modules\shop\models\ars\OrderGoods;
/**
* This is the model class for table "ats_comment".
@ -19,6 +20,13 @@ use yii\behaviors\TimestampBehavior;
*/
class Comment extends \yii\db\ActiveRecord
{
//状态
const STATUS_VIEW = 1; //显示
const STATUS_HIDE = 0; //隐藏
public static $commentStatus = [
self::STATUS_VIEW => '显示',
self::STATUS_HIDE => '隐藏'
];
/**
* {@inheritdoc}
*/
@ -77,4 +85,9 @@ class Comment extends \yii\db\ActiveRecord
],
];
}
public function getOrderGoods()
{
return $this->hasOne(OrderGoods::class,['id' => 'order_goods_id']);
}
}
Loading…
Cancel
Save