package com.goafanti.app.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.goafanti.app.service.AppHomePageService;
import com.goafanti.common.bo.Result;
import com.goafanti.common.controller.BaseApiController;

@RestController
@RequestMapping(path = "/open/app/home")
public class OpenAppHomeController extends BaseApiController{
	@Resource
	private AppHomePageService	appHomePageService;
	
	
	/**App首页轮播图、导航、知产*/
	@RequestMapping(value = "/getHomePageData", method = RequestMethod.GET)
	public Result getHomePageData(HttpServletRequest  request){
		Result res = new Result();
		res.setData(appHomePageService.getAppHomePage(request));
		return res;
	}
	
	/**技淘推荐*/
	@RequestMapping(value = "/getHomeRecommended", method = RequestMethod.GET)
	public Result getHomeRecommended(Integer type){
		Result res = new Result();
		if (null==type||type>3||type<0) {
			 res.getError().add(buildError( "类型错误", "类型错误"));
	            return res;
		}
		res.setData(appHomePageService.getHomeRecommended(type));
		return res;
	}
	
	
}
