64], [['cover_pic', 'source_url', 'article_desc', 'url', 'thumb_url','article_id'], 'string', 'max' => 255], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => 'Mall ID', 'content' => 'Content', 'thumb_media_id' => 'Thumb Media ID', 'title' => 'Title', 'cover_pic' => 'Cover Pic', 'show_cover' => '是否在文章内容显示封面图片', 'media_id' => 'Media ID', 'source_url' => '原文链接', 'article_desc' => 'Article Desc', 'url' => 'Url', 'thumb_url' => '缩略图', 'author' => 'Author', 'status' => '状态【1启用 0禁用 -1删除】', 'created_at' => 'Created At', 'updated_at' => 'Updated At', 'publish_id' => 'Publish Id', 'article_id' => '图文id' ]; } /** * 保存数据 * @Author lun * @DateTime 2021-09-17 14:16:24 * @copyright: Copyright (c) 2020 广东七件事集团 * @param array $params * @return object|boolean */ public static function setData(int $mall_id, array $params){ try{ if(!empty($params['id'])){ $model = self::findOne(['and',['id' => $params['id'],'mall_id' => $mall_id],['<>','status',StatusEnum::DELETE]]); if(empty($model)) throw new \Exception('图文素材不存在或已删除'); }else{ $model = new self(); $model->loadDefaultValues(); $model->mall_id = $mall_id; } if(!$model->load($params,'') || !$model->save()){ throw new \Exception($model->getErrorMessage()); } return $model; }catch(\Exception $e){ self::$static_error = $e->getMessage(); return false; } } }