TimestampBehavior::class, ] ]; } /** * @inheritdoc */ public function attributeLabels() { return [ 'id' => '主键', 'user_id' => '用户ID', 'goods_brand_id' => '品牌ID', 'created_at' => '添加时间', 'updated_at' => '', ]; } // public function afterSave($insert, $changedAttributes) // { /*$data = $insert ? json_encode($this->attributes) : json_encode($changedAttributes); CommonActionLog::storeActionLog('', $insert, $this->is_delete, $data, $this->id);*/ // } public static function getUserSubscribeLog($user_id) { return self::find()->alias('s')->leftJoin(['b' => GoodsBrand::tableName()], 's.goods_brand_id = b.id') ->where(['s.user_id' => $user_id, 'b.is_delete' => 0, 'b.is_show' => 1])->select('s.goods_brand_id') ->orderBy('s.id DESC')->column(); } public static function getBrandList($brand_id) { return self::find()->where(['goods_brand_id' => $brand_id])->select('id')->column(); } public static function isSubscribe($user_id, $brand_id) { return self::findOne(['goods_brand_id' => $brand_id, 'user_id' => $user_id]); } }