正在显示
1 个修改的文件
包含
121 行增加
和
121 行删除
| @@ -39,128 +39,128 @@ class Product extends Base | @@ -39,128 +39,128 @@ class Product extends Base | ||
| 39 | 3=>'热销产品' | 39 | 3=>'热销产品' |
| 40 | ]; | 40 | ]; |
| 41 | 41 | ||
| 42 | -// public function setThumbAttribute($value){ | ||
| 43 | -// $value['url'] = str_replace_url($value['url']); | ||
| 44 | -// $this->attributes['thumb'] = Arr::a2s($value); | ||
| 45 | -// } | ||
| 46 | -// | ||
| 47 | -// public function getThumbAttribute($value){ | ||
| 48 | -// $value = json_decode($value,true); | ||
| 49 | -// $value['url'] = getImageUrl($value['url']); | ||
| 50 | -// return $value; | ||
| 51 | -// } | ||
| 52 | -// | ||
| 53 | -// public function setGalleryAttribute($value){ | ||
| 54 | -// foreach ($value as $k => $v){ | ||
| 55 | -// $v['url'] = str_replace_url($v['url']); | ||
| 56 | -// $value[$k] = $v; | ||
| 57 | -// } | ||
| 58 | -// $this->attributes['gallery'] = Arr::a2s($value); | ||
| 59 | -// } | ||
| 60 | -// | ||
| 61 | -// public function getGalleryAttribute($value){ | ||
| 62 | -// $value = Arr::s2a($value); | ||
| 63 | -// foreach ($value as $k => $v){ | ||
| 64 | -// $v['url'] = getImageUrl($v['url']); | ||
| 65 | -// $value[$k] = $v; | ||
| 66 | -// } | ||
| 67 | -// return $value; | ||
| 68 | -// } | 42 | + public function setThumbAttribute($value){ |
| 43 | + $value['url'] = str_replace_url($value['url']); | ||
| 44 | + $this->attributes['thumb'] = Arr::a2s($value); | ||
| 45 | + } | ||
| 69 | 46 | ||
| 70 | -// /** | ||
| 71 | -// * @remark :图标获取器 | ||
| 72 | -// * @name :getGalleryAttribute | ||
| 73 | -// * @author :lyh | ||
| 74 | -// * @method :post | ||
| 75 | -// * @time :2023/7/21 11:11 | ||
| 76 | -// */ | ||
| 77 | -// public function setIconAttribute($value){ | ||
| 78 | -// foreach ($value as $k => $v){ | ||
| 79 | -// $v = str_replace_url($v); | ||
| 80 | -// $value[$k] = $v; | ||
| 81 | -// } | ||
| 82 | -// $this->attributes['icon'] = Arr::a2s($value); | ||
| 83 | -// } | ||
| 84 | -// | ||
| 85 | -// /** | ||
| 86 | -// * @remark :图标获取器 | ||
| 87 | -// * @name :getGalleryAttribute | ||
| 88 | -// * @author :lyh | ||
| 89 | -// * @method :post | ||
| 90 | -// * @time :2023/7/21 11:11 | ||
| 91 | -// */ | ||
| 92 | -// public function getIconAttribute($value){ | ||
| 93 | -// $value = Arr::s2a($value); | ||
| 94 | -// foreach ($value as $k => $v){ | ||
| 95 | -// $v = getImageUrl($v); | ||
| 96 | -// $value[$k] = $v; | ||
| 97 | -// } | ||
| 98 | -// return $value; | ||
| 99 | -// } | ||
| 100 | -// | ||
| 101 | -// public function setAttrsAttribute($value){ | ||
| 102 | -// $this->attributes['attrs'] = Arr::a2s($value); | ||
| 103 | -// } | ||
| 104 | -// | ||
| 105 | -// public function getAttrsAttribute($value){ | ||
| 106 | -// return Arr::s2a($value); | ||
| 107 | -// } | ||
| 108 | -// | ||
| 109 | -// public function setDescribeAttribute($value){ | ||
| 110 | -// $this->attributes['describe'] = Arr::a2s($value); | ||
| 111 | -// } | ||
| 112 | -// | ||
| 113 | -// public function getDescribeAttribute($value){ | ||
| 114 | -// return Arr::s2a($value); | ||
| 115 | -// } | ||
| 116 | -// | ||
| 117 | -// public function setSeoMateAttribute($value){ | ||
| 118 | -// $this->attributes['seo_mate'] = Arr::a2s($value); | ||
| 119 | -// } | ||
| 120 | -// | ||
| 121 | -// public function getSeoMateAttribute($value){ | ||
| 122 | -// return Arr::s2a($value); | ||
| 123 | -// } | ||
| 124 | -// | ||
| 125 | -// public function setCategoryIdAttribute($value){ | ||
| 126 | -// $this->attributes['category_id'] = ','.Arr::arrToSet($value).','; | ||
| 127 | -// } | ||
| 128 | -// | ||
| 129 | -// public function getCategoryIdAttribute($value){ | ||
| 130 | -// return Arr::setToArr(trim($value,',')); | ||
| 131 | -// } | ||
| 132 | -// | ||
| 133 | -// public function setAttrIdAttribute($value){ | ||
| 134 | -// $this->attributes['attr_id'] = Arr::arrToSet($value); | ||
| 135 | -// } | ||
| 136 | -// | ||
| 137 | -// public function getAttrIdAttribute($value){ | ||
| 138 | -// return Arr::setToArr($value); | ||
| 139 | -// } | ||
| 140 | -// | ||
| 141 | -// public function setDescribeIdAttribute($value){ | ||
| 142 | -// $this->attributes['describe_id'] = Arr::arrToSet($value); | ||
| 143 | -// } | ||
| 144 | -// | ||
| 145 | -// public function getDescribeIdAttribute($value){ | ||
| 146 | -// return Arr::setToArr($value); | ||
| 147 | -// } | ||
| 148 | -// | ||
| 149 | -// public function setKeywordIdAttribute($value){ | ||
| 150 | -// $this->attributes['keyword_id'] = ','.Arr::arrToSet($value).','; | ||
| 151 | -// } | ||
| 152 | -// | ||
| 153 | -// public function getKeywordIdAttribute($value){ | ||
| 154 | -// return Arr::setToArr(trim($value,',')); | ||
| 155 | -// } | ||
| 156 | -// | ||
| 157 | -// public function setRelatedProductIdAttribute($value){ | ||
| 158 | -// $this->attributes['related_product_id'] = Arr::arrToSet($value); | ||
| 159 | -// } | ||
| 160 | -// | ||
| 161 | -// public function getRelatedProductIdAttribute($value){ | ||
| 162 | -// return Arr::setToArr($value); | ||
| 163 | -// } | 47 | + public function getThumbAttribute($value){ |
| 48 | + $value = json_decode($value,true); | ||
| 49 | + $value['url'] = getImageUrl($value['url']); | ||
| 50 | + return $value; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public function setGalleryAttribute($value){ | ||
| 54 | + foreach ($value as $k => $v){ | ||
| 55 | + $v['url'] = str_replace_url($v['url']); | ||
| 56 | + $value[$k] = $v; | ||
| 57 | + } | ||
| 58 | + $this->attributes['gallery'] = Arr::a2s($value); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public function getGalleryAttribute($value){ | ||
| 62 | + $value = Arr::s2a($value); | ||
| 63 | + foreach ($value as $k => $v){ | ||
| 64 | + $v['url'] = getImageUrl($v['url']); | ||
| 65 | + $value[$k] = $v; | ||
| 66 | + } | ||
| 67 | + return $value; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * @remark :图标获取器 | ||
| 72 | + * @name :getGalleryAttribute | ||
| 73 | + * @author :lyh | ||
| 74 | + * @method :post | ||
| 75 | + * @time :2023/7/21 11:11 | ||
| 76 | + */ | ||
| 77 | + public function setIconAttribute($value){ | ||
| 78 | + foreach ($value as $k => $v){ | ||
| 79 | + $v = str_replace_url($v); | ||
| 80 | + $value[$k] = $v; | ||
| 81 | + } | ||
| 82 | + $this->attributes['icon'] = Arr::a2s($value); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * @remark :图标获取器 | ||
| 87 | + * @name :getGalleryAttribute | ||
| 88 | + * @author :lyh | ||
| 89 | + * @method :post | ||
| 90 | + * @time :2023/7/21 11:11 | ||
| 91 | + */ | ||
| 92 | + public function getIconAttribute($value){ | ||
| 93 | + $value = Arr::s2a($value); | ||
| 94 | + foreach ($value as $k => $v){ | ||
| 95 | + $v = getImageUrl($v); | ||
| 96 | + $value[$k] = $v; | ||
| 97 | + } | ||
| 98 | + return $value; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public function setAttrsAttribute($value){ | ||
| 102 | + $this->attributes['attrs'] = Arr::a2s($value); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public function getAttrsAttribute($value){ | ||
| 106 | + return Arr::s2a($value); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public function setDescribeAttribute($value){ | ||
| 110 | + $this->attributes['describe'] = Arr::a2s($value); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public function getDescribeAttribute($value){ | ||
| 114 | + return Arr::s2a($value); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public function setSeoMateAttribute($value){ | ||
| 118 | + $this->attributes['seo_mate'] = Arr::a2s($value); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + public function getSeoMateAttribute($value){ | ||
| 122 | + return Arr::s2a($value); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + public function setCategoryIdAttribute($value){ | ||
| 126 | + $this->attributes['category_id'] = ','.Arr::arrToSet($value).','; | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + public function getCategoryIdAttribute($value){ | ||
| 130 | + return Arr::setToArr(trim($value,',')); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + public function setAttrIdAttribute($value){ | ||
| 134 | + $this->attributes['attr_id'] = Arr::arrToSet($value); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + public function getAttrIdAttribute($value){ | ||
| 138 | + return Arr::setToArr($value); | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public function setDescribeIdAttribute($value){ | ||
| 142 | + $this->attributes['describe_id'] = Arr::arrToSet($value); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + public function getDescribeIdAttribute($value){ | ||
| 146 | + return Arr::setToArr($value); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + public function setKeywordIdAttribute($value){ | ||
| 150 | + $this->attributes['keyword_id'] = ','.Arr::arrToSet($value).','; | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + public function getKeywordIdAttribute($value){ | ||
| 154 | + return Arr::setToArr(trim($value,',')); | ||
| 155 | + } | ||
| 156 | + | ||
| 157 | + public function setRelatedProductIdAttribute($value){ | ||
| 158 | + $this->attributes['related_product_id'] = Arr::arrToSet($value); | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public function getRelatedProductIdAttribute($value){ | ||
| 162 | + return Arr::setToArr($value); | ||
| 163 | + } | ||
| 164 | 164 | ||
| 165 | // public static function getNumByProjectId($project_id){ | 165 | // public static function getNumByProjectId($project_id){ |
| 166 | // return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); | 166 | // return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); |
-
请 注册 或 登录 后发表评论