作者 开飞机的舒克

轮播图修改

... ... @@ -125,13 +125,10 @@ class Index extends Api
if (empty($id)) {
$this->error('参数错误', ['status' => 2]);
}
$data = Banner::where('id', $id)
$model = new Banner();
$data = collection($model->where('id', $id)
->order('createtime DESC')
->select();
foreach ($data as $k => $v) {
$data[$k]['images'] = cdnurl($v['images'], true);
$data[$k]['details'] = strip_tags($v['details']);
}
->select())->toArray();
$this->success('获取轮播图详情成功', $data);
}
... ...
... ... @@ -35,6 +35,21 @@ class Banner extends Model
return isset($list[$value]) ? $list[$value] : '';
}
public function getImagesAttr($value, $data)
{
$list = explode(',', $data['images']);
foreach ($list as $k => $v) {
$value = cdnurl($v['images'], true);
}
return $value;
}
public function getDetailsAttr($value, $data)
{
$value = strip_tags($data['details']);
return $value;
}
public function getCreatetimeTextAttr($value, $data)
{
$value = $value ? $value : ($data['createtime'] ?? "");
... ...
... ... @@ -5920,7 +5920,7 @@
</div>
<div class="col-md-6" align="right">
Generated on 2023-04-04 11:43:29 <a href="./" target="_blank">校园活动</a>
Generated on 2023-04-04 13:40:06 <a href="./" target="_blank">校园活动</a>
</div>
</div>
... ...