|
|
|
@@ -7,7 +7,7 @@ import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxAppinfo; |
|
|
|
import com.iformall.enums.EnumAppType; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.service.WxAppinfoService; |
|
|
|
import com.iformall.service.wechat.FmOpenService; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
@@ -93,9 +93,9 @@ public class WxAppinfoController extends BaseController { |
|
|
|
return new ResultData(Result.SUCCESS, "查询成功", wxAppinfoService.getById(id)); |
|
|
|
} |
|
|
|
|
|
|
|
@ApiOperation(value = "下载二维码", notes = "参数{\"name\":\"String\",\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") |
|
|
|
@ApiOperation(value = "下载二维码", produces="application/json;charset=UTF-8", notes = "参数{\"name\":\"String\",\"pageUrl\":\"String\", \"sceneParam\":\"二维码参数\", \"type\":0:有限二维码,1:无限二维码,\"withText\":int(0:不带字, 1:加一行字,2:加两行字),\"text1\":\"String\",\"text2\":\"String\"}") |
|
|
|
@PostMapping("/downQrCode") |
|
|
|
public ResultData downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> params) { |
|
|
|
public void downQrCode(HttpServletRequest request, HttpServletResponse response, @RequestBody Map<String, Object> params) throws MallinkException { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxAppinfoController::downQrCode"); |
|
|
|
String name = (String) params.get("name"); |
|
|
|
String pageUrl = (String) params.get("pageUrl"); |
|
|
|
@@ -116,7 +116,7 @@ public class WxAppinfoController extends BaseController { |
|
|
|
String text1 = (String) params.get("text1"); |
|
|
|
String text2 = (String) params.get("text2"); |
|
|
|
if (StringUtils.isBlank(pageUrl)) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "pageUrl不能为空"); |
|
|
|
throw new MallinkException(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "pageUrl不能为空"); |
|
|
|
} |
|
|
|
try { |
|
|
|
exportQrcode(request, response, |
|
|
|
@@ -125,9 +125,8 @@ public class WxAppinfoController extends BaseController { |
|
|
|
name); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
throw new MallinkException(Result.ERROR, "下载异常"); |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
private void exportQrcode(HttpServletRequest request, HttpServletResponse response, |
|
|
|
@@ -219,7 +218,7 @@ public class WxAppinfoController extends BaseController { |
|
|
|
private void downFile(String filePath, String filename, HttpServletResponse response, HttpServletRequest req) throws IOException { |
|
|
|
try { |
|
|
|
response.reset(); |
|
|
|
response.setContentType("image/png"); |
|
|
|
response.setContentType("application/octet-stream"); |
|
|
|
String agent = req.getHeader("user-agent"); |
|
|
|
if (agent.contains("Firefox")) { |
|
|
|
response.setHeader("Content-disposition", |
|
|
|
|