cover_img; return $this->imageUrl($value); } /** * 获取单个信息 * @param int $id * @param string $field * @return string */ public static function getCategoryInfo($id,$field = '*') { return self::select($field)->find($id); } /** * 获取二级分类数组 * id为键,title为值 * @return array */ public static function getCategoryArray($where = [],$options = []) { $model = self::where('status',1) ->whereNull('deleted_at'); if(count($where) > 0){ $model->where($where); } $list = $model->pluck('title','id')->toArray(); if(!empty($options)){ return array_merge($options,$list); }else{ return $list; } } /** * 处理旧图片 * @param $value * @return string */ public function imageUrl($value) { if(strripos($value,"http") === false){ return env('OSS_IMG_HOST').'/'.$value; }else{ return $value; } } }