32], [['bg_image', 'share_title', 'share_desc', 'goods_ids','share_image', 'album_image'], 'string', 'max' => 255], [['bg_video'], 'string', 'max' => 5000], [['file',], 'string', 'max' => 500], ]; } /** * {@inheritdoc} */ public function attributeLabels() { return [ 'id' => 'ID', 'mall_id' => '商城ID', 'title' => '画册标题', 'bg_image' => '画册背景图', 'bg_video' => '背景音乐', 'bg_color' => '画册背景颜色', 'size_type' => '预设尺寸', 'file' => '附件下载地址', 'share_title' => '自定义分享标题', 'share_desc' => '自定义分享描述', 'share_image' => '自定义分享图片', 'author_id' => '发布者,会员id', 'author_nick' => '发布者,会员昵称', 'author_mobile' => '发布者,手机号', 'created_at' => '添加时间戳', 'updated_at' => '更新时间戳', 'status' => '-1是删除,0是禁用,1是启用', 'album_image' => '封面图片', 'goods_count' => '画册商品数量', 'page_num' => '页面数量', 'bg_type' => '背景类型', 'goods_ids' => '商品集合', ]; } public function getUser() { return $this->hasOne(User::class, ['id' => 'author_id'])->select('id,mobile,nickname,avatar_url,parent_id,username'); } public function getStatistics() { return $this->hasOne(AddonsAlbumStatistics::class, ['album_id' => 'id']); } /** * @Author: ltm * @DateTime: 2022/2/15 0015 11:43 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $data * @return string */ public static function setData(array $params){ try{ if (!empty($params['id'])) { $model = self::findOne(['id'=>$params['id'],'mall_id'=>$params['mall_id']]); if (empty($model)) throw new Exception('记录不存在或已删除'); }else{ $model = new self(); $model->loadDefaultValues(); } $model->mall_id = $params['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; } } }