| | |
| | | package com.yeshi.fanli.controller.admin.goods;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.StringUtil;
|
| | |
|
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/convertLink")
|
| | | public class ConvertLinkController {
|
| | |
|
| | | @Resource
|
| | | private ConvertLinkManager convertLinkManager;
|
| | |
|
| | | @RequestMapping(value = "convertLink")
|
| | | public void convertLink(String callback, String uid, String content, Boolean share, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(uid)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传用户ID"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传文本内容"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (share == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择是分享还是自购"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String result = null;
|
| | | try {
|
| | | result = convertLinkManager.convertLinkFromText(content, Long.parseLong(uid), share);
|
| | | } catch (NumberFormatException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户ID转换出错"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage()));
|
| | | return;
|
| | | }
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(result));
|
| | | }
|
| | |
|
| | | }
|
| | | package com.yeshi.fanli.controller.admin.goods; |
| | | |
| | | import java.io.PrintWriter; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.accept.AdminAcceptData; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | | |
| | | @Controller |
| | | @RequestMapping("admin/new/api/v1/convertLink") |
| | | public class ConvertLinkController { |
| | | |
| | | @Resource |
| | | private ConvertLinkManager convertLinkManager; |
| | | |
| | | @RequestMapping(value = "convertLink") |
| | | public void convertLink(AdminAcceptData acceptData, String callback, String uid, String content, Boolean share, PrintWriter out) { |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传用户ID")); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(content)) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请上传文本内容")); |
| | | return; |
| | | } |
| | | |
| | | if (share == null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择是分享还是自购")); |
| | | return; |
| | | } |
| | | |
| | | String result = null; |
| | | try { |
| | | result = convertLinkManager.convertLinkFromText(acceptData.getSystem(), content, Long.parseLong(uid), share, true); |
| | | } catch (NumberFormatException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户ID转换出错")); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMessage())); |
| | | return; |
| | | } |
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(result)); |
| | | } |
| | | |
| | | } |