| | |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.UrlUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.PrintWriter; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Controller |
| | | @RequestMapping("webapi") |
| | |
| | | private KeyOrderService keyOrderService; |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "submitKey") |
| | | public void push(String key, PrintWriter out) { |
| | | public String submitKey(String key) { |
| | | if(StringUtil.isNullOrEmpty(key)){ |
| | | out.print(JsonUtil.loadFalseResult(0,"请上传key")); |
| | | return; |
| | | return JsonUtil.loadFalseResult(0,"请上传key"); |
| | | } |
| | | List<String> urllist = UrlUtils.parseUrlsFromText(key); |
| | | if(urllist.isEmpty()||!urllist.get(0).contains("ur.alipay.com")){ |
| | | return JsonUtil.loadFalseResult("支付宝口令不正确"); |
| | | } |
| | | try { |
| | | KeyOrder order = keyOrderService.addKeyOrder(key); |
| | | |
| | |
| | | orderUpdate.setDistributeTime(new Date()); |
| | | keyOrderService.update(orderUpdate); |
| | | } |
| | | out.print(JsonUtil.loadTrueResult("")); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (KeyOrderException e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult(e.getMessage())); |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @RequestMapping(value = "test") |
| | | public String test(String key) { |
| | | return "123123"; |
| | | } |
| | | |
| | | |
| | | } |