|
|
@@ -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,32 @@ 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="/appList" ,method=RequestMethod.GET)
|
|
|
+ public Result appList(String apiUrl,Integer client,Integer pageSize,Integer pageNo,HttpServletRequest request){
|
|
|
+ Result result=new Result();
|
|
|
+ result.setData(bannersService.findAppBannersList( 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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|