| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | text = text.substring(1, end);
|
| | | }
|
| | |
|
| | | LogHelper.test("根据粘贴板推荐:"+text);
|
| | | LogHelper.test("根据粘贴板推荐:" + text);
|
| | |
|
| | | if (text.length() > 80) {
|
| | | out.print(JsonUtil.loadFalseResult("值过长"));
|
| | |
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 解析淘口令
|
| | | * |
| | | * @param text
|
| | | * @param out
|
| | | * @return
|
| | | */
|
| | | private boolean analysisTaoToken(String text, PrintWriter out) {
|
| | | String token = StringUtil.picUpTaoToken(text);
|
| | | if (!StringUtil.isNullOrEmpty(token)) {
|
| | | Long auctionId = TaoKeApiUtil.tokenConvertAuctionId(token);
|
| | | if (auctionId != null) {
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | tb = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | if (tb != null) {
|
| | | JSONObject data = new JSONObject();
|
| | | JSONObject taoBaoGoodsJSON = new JSONObject();
|
| | | taoBaoGoodsJSON.put("title", tb.getTitle());
|
| | | taoBaoGoodsJSON.put("zkPrice", tb.getZkPrice());
|
| | | taoBaoGoodsJSON.put("auctionId", tb.getAuctionId());
|
| | | taoBaoGoodsJSON.put("url", "http://item.taobao.com/item.htm?id=" + tb.getAuctionId());
|
| | | data.put("taoBaoGoodsBrief", taoBaoGoodsJSON);
|
| | | if (!StringUtil.isNullOrEmpty(tb.getPictUrl())) {
|
| | | if (tb.getImgList() == null)
|
| | | tb.setImgList(new ArrayList<>());
|
| | | tb.getImgList().add(0, TbImgUtil.getTBSize220Img(tb.getPictUrl()));
|
| | | }
|
| | | data.put("tbImgs", tb.getImgList());
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("type", 1);
|
| | | root.put("data", data);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | return true;
|
| | | }
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | }
|