| // +------------------------------------------------+ namespace app\common\model; use think\Config; class Category extends _Init { /** * 获取封面地址 * @param [type] $value 封面id * @param [type] $data 文章数据 * @return [type] 图片地址 */ public function getCoverAttr($value, $data) { return Storage::where('id', $data['storage_id'])->value('path'); } public function getModelAttr($value, $data) { $list = config::get('category_model'); $name = $list[$data['model']]; return $name ?? '没有'; } }