作者 lyh

gx

... ... @@ -334,7 +334,7 @@ class FileController
}
/**
* @remark :获取文件交接链接
* @remark :获取文件链接
* @name :getImageUrl
* @author :lyh
* @method :post
... ...
... ... @@ -297,7 +297,7 @@ class ImageController extends Controller
*/
public function getImageList(){
$imageModel = new ImageModel();
$lists = $imageModel->list([],$order = 'id',['id','hash','type','path','created_at']);
$lists = $imageModel->list($this->param,$order = 'id',['id','hash','type','path','created_at']);
foreach ($lists as $k => $v){
$v['image_link'] = $this->getImageUrl($v['hash']);
$lists[$k] = $v;
... ...
... ... @@ -45,6 +45,13 @@ class ProductRequest extends FormRequest
}
}
}],
'icon' => ['required', 'array', function ($attribute, $value, $fail) {
foreach ($value as $v) {
if (empty($v['url'])) {
$fail('图片链接不能为空');
}
}
}],
'attrs' => ['array', function ($attribute, $value, $fail) {
foreach ($value as $v) {
if (empty($v['key'])) {
... ...
... ... @@ -32,10 +32,9 @@ class Product extends Base
];
}
// public function setThumbAttribute($value){
// $value['url'] = Upload::url2path($value['url']);
// $this->attributes['thumb'] = Arr::a2s($value);
// }
public function setThumbAttribute($value){
$this->attributes['thumb'] = Arr::a2s($value);
}
public function getThumbAttribute($value){
$value = Arr::s2a($value);
... ... @@ -43,12 +42,9 @@ class Product extends Base
return $value;
}
// public function setGalleryAttribute($value){
// foreach ($value as &$v){
// $v['url'] = Upload::url2path($v['url']);
// }
// $this->attributes['gallery'] = Arr::a2s($value);
// }
public function setGalleryAttribute($value){
$this->attributes['gallery'] = Arr::a2s($value);
}
public function getGalleryAttribute($value){
$value = Arr::s2a($value);
... ... @@ -65,10 +61,22 @@ class Product extends Base
* @method :post
* @time :2023/7/21 11:11
*/
public function setIconAttribute($value){
$this->attributes['gallery'] = Arr::a2s($value);
}
/**
* @remark :图标获取器
* @name :getGalleryAttribute
* @author :lyh
* @method :post
* @time :2023/7/21 11:11
*/
public function getIconAttribute($value){
$value = $this->getImageUrl($value);
return $value;
}
public function setAttrsAttribute($value){
$this->attributes['attrs'] = Arr::a2s($value);
}
... ...