// +---------------------------------------------------------------------- namespace App\Models; /** * 商品管理-模型 * @author wesmiler * @since 2020/11/11 * Class GoodsModel * @package App\Models */ class GoodsModel extends BaseModel { // 设置数据表 protected $table = 'goods'; /** * 获取记录信息 * @param int $id 记录ID * @return array|string * @author wesmiler * @since 2020/11/11 */ public function getInfo($id) { $info = parent::getInfo($id); // TODO: Change the autogenerated stub if ($info) { // 图片 if ($info['thumb']) { $info['thumb'] = get_image_url($info['thumb']); } // 相册 if ($info['albums']) { $info['albums'] = json_decode($info['albums'], true); if($info['albums']){ foreach ($info['albums'] as &$v){ $v = $v? get_image_url($v) : ''; } } unset($v); } } return $info; } }