field("id,cover,price,good_name,number")->where($map)->order($order)->page($page, $row)->select(); foreach ($data as $key => $value) { $cover = get_cover($value['cover'],'path'); if(strpos($cover, 'http')!==false){ $data[$key]['cover'] = $cover; }else{ $data[$key]['cover'] = 'http://'.$_SERVER['HTTP_HOST'].$cover; } } return $data; } /** * @param $id * @return mixed * author: xmy 280564871@qq.com */ public function getData($id){ $data = $this->find($id); if(empty($data)){ return $data; } $number = $data['number']; if($data['good_type'] == 2){ $key = json_decode($data['good_key']); $number = count($key); } // $data['cover'] = get_img_url($data['cover']); $data['number'] = $number; return $data; } }