Bläddra i källkod

首页轮播图修改

anderx 7 år sedan
förälder
incheckning
7d4b76531f

+ 4 - 4
src/main/java/com/goafanti/app/controller/OpenAppHomeController.java

@@ -137,7 +137,7 @@ public class OpenAppHomeController extends BaseApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/recommendedApplication" , method = RequestMethod.GET)
-	public Result recommendedApplication(Integer pageNo,Integer pageSize) {
+	public Result recommendedApplication(String apiUrl,Integer pageNo,Integer pageSize) {
 		Result result=new Result();
 		if (null==pageNo)pageNo=1;
 		if (null==pageSize)pageSize=3;
@@ -146,7 +146,7 @@ public class OpenAppHomeController extends BaseApiController{
 		map.put("recommended", jtBusinessService.recommendedApplication(null,pageNo,pageSize));
 		map.put("tag", jtTagService.selectListJtTag(null, 1, 99));
 		
-		map.put("homeImg", bannersService.findBannersList( BannersStatus.HOME.getKey(),1, 1, 1));
+		map.put("homeImg", bannersService.findBannersList( apiUrl,1, 1, 1));
 		result.setData(map);
 		return result;
 	}
@@ -155,14 +155,14 @@ public class OpenAppHomeController extends BaseApiController{
 	 * @return
 	 */
 	@RequestMapping(value = "/getHomeData" , method = RequestMethod.GET)
-	public Result getHomeData(Integer pageNo,Integer pageSize) {
+	public Result getHomeData(String apiUrl,Integer pageNo,Integer pageSize) {
 		Result result=new Result();
 		if (null==pageNo)pageNo=1;
 		if (null==pageSize)pageSize=3;
 		Map<String, Object> map=new HashMap<>();
 		//1 赚钱数据    2首页数据
 		map.put("recommended", jtBusinessService.recommendedApplication(null,pageNo,pageSize));
-		map.put("homeImg", bannersService.findBannersList( BannersStatus.HOME.getKey(),1, 3, 1));
+		map.put("homeImg", bannersService.findBannersList( apiUrl,1, 3, 1));
 		result.setData(map);
 		return result;
 	}

+ 18 - 1
src/main/java/com/goafanti/banners/controller/AdminBannersApiController.java

@@ -8,6 +8,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
 
+import org.junit.runner.Request;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.util.Assert;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import com.goafanti.banners.enums.BannersType;
 import com.goafanti.banners.service.BannersService;
 import com.goafanti.common.bo.Result;
+import com.goafanti.common.constant.ErrorConstants;
 import com.goafanti.common.controller.BaseApiController;
 import com.goafanti.common.enums.AttachmentType;
 import com.goafanti.common.model.Banners;
@@ -105,11 +107,26 @@ public class AdminBannersApiController extends BaseApiController {
 		return result;
 	}
 	@RequestMapping(value="/list" ,method=RequestMethod.GET)
-	public Result list(String apiUrl,Integer client,Integer pageSize,Integer pageNo){
+	public Result list(String apiUrl,Integer client,Integer pageSize,Integer pageNo,HttpServletRequest request){
 		Result result=new Result();
 		result.setData(bannersService.findBannersList( apiUrl,client, pageSize, pageNo));
 		return result;
 	}
 	
 
+    /**
+     * 图片上传
+     */
+    @RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
+    public Result uploadPicture(HttpServletRequest req, String sign) {
+        Result res = new Result();
+        AttachmentType attachmentType = AttachmentType.getField(sign);
+        if (attachmentType == AttachmentType.BANNERS_PIC) {
+            res.setData(handleFiles(res, "/banners", false, req, sign, "banners"));
+        } else {
+            res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "图片标示"));
+        }
+        return res;
+    }
+
 }