| | |
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DaTaoKeGoodsResult; |
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DaTaoKeListTopOffDTO; |
| | | import com.yeshi.goods.facade.dto.taobao.dataoke.DaTaoKeResult; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoCouponCache; |
| | | import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.goods.facade.entity.taobao.dataoke.DaTaoKeDetailV2; |
| | | import net.sf.json.JSONArray; |
| | |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | DaTaoKeResult result = DaTaoKeApiUtil.listTipOff(null, null, 20); |
| | | // String result = DaTaoKeApiUtil.convertLink("712706225501", "mm_124933865_56750082_89555600043",false); |
| | | // System.out.println(result); |
| | | |
| | | String result = DaTaoKeApiUtil.parseGoodsIdFromToken("【淘宝】https://m.tb.cn/h.50OdXLq?tk=t7ghdGREBd3 CZ0001 「盼盼甲级防盗门家用双色门进户安全门入户门单门定制大门内外双色」\n" + |
| | | "点击链接直接打开 或者 淘宝搜索直接打开"); |
| | | System.out.println(result); |
| | | } |
| | | } |
| | |
| | | public void updateApp(AcceptData acceptData, PrintWriter out) { |
| | | if (Constant.IS_TEST) |
| | | acceptData.setVersion("20"); |
| | | String result = appUpdateManager.getUpdateInfoCache(acceptData); |
| | | String result = "{\"code\":1}";// appUpdateManager.getUpdateInfoCache(acceptData); |
| | | try { |
| | | out.print(new String(result.getBytes("ISO-8859-1"), "UTF-8")); |
| | | } catch (UnsupportedEncodingException e) { |
| | |
| | | return; |
| | | } |
| | | |
| | | DYConvertResult link = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createFanLiExtraInfo(uid), |
| | | ""); |
| | | DYConvertResult link = null; |
| | | try { |
| | | link = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createFanLiExtraInfo(uid), |
| | | ""); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品转链失败")); |
| | | } |
| | | |
| | | GoodsJumpLinkVO vo = GoodsJumpUtil.getDYJumpInfo(link); |
| | | |
| | |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYConvertResult; |
| | | import com.yeshi.fanli.util.goods.douyin.vo.DYGoodsDetail; |
| | | import kafka.utils.Json; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | |
| | | // 抖音 |
| | | if (goodsType == Constant.SOURCE_TYPE_DY) { |
| | | createDYShare(acceptData, uid,Long.parseLong( goodsId), source, needGoods, out); |
| | | try { |
| | | createDYShare(acceptData, uid,Long.parseLong( goodsId), source, needGoods, out); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult("转链失败")); |
| | | e.printStackTrace(); |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | * @Description: |
| | | */ |
| | | public void createDYShare(AcceptData acceptData, Long uid, Long goodsId, String source, boolean needGoods, |
| | | PrintWriter out) { |
| | | PrintWriter out) throws Exception { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(goodsId); |
| | | if (goods == null) { |
| | | out.print(JsonUtil.loadFalseResult(1, "该商品已下架")); |
| | |
| | | SystemEnum system = SystemInfoUtil.getSystem(acceptData); |
| | | |
| | | |
| | | DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createShareExtraInfo(uid), ""); |
| | | DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createShareExtraInfo(uid), ""); |
| | | |
| | | |
| | | ShareInfoVO shareInfo = new ShareInfoVO(); |
| | | shareInfo.setClickUrl(convertResult.getQrCode()); |
| | |
| | | return; |
| | | } |
| | | |
| | | DYConvertResult convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(),DYUtil.createShareExtraInfo(uid),""); |
| | | DYConvertResult convertResult = null; |
| | | try { |
| | | convertResult = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createShareExtraInfo(uid),""); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(2, "商品转链失败")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // 生成普通分享内容 |
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getSuperHongBaoToken") |
| | | public void getSuperHongBaoToken(String sign, Long uid, String callback, PrintWriter out) { |
| | | public void getSuperHongBaoToken(String sign, Long uid,String sceneId, String callback, PrintWriter out) { |
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误"))); |
| | | return; |
| | |
| | | String token = null; |
| | | token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | if(StringUtil.isNullOrEmpty(sceneId)){ |
| | | sceneId = "20150318020014241"; |
| | | } |
| | | try { |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253", |
| | | "20150318019998255", info.getRelationId()); |
| | | sceneId, info.getRelationId()); |
| | | String link = dto.getClick_url(); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | |
| | | } |
| | | |
| | | @RequestMapping(value = "getYuShouToken") |
| | | public void getYuShouToken(String sign, Long uid, String callback, PrintWriter out) { |
| | | public void getYuShouToken(String sign, Long uid,String sceneId, String callback, PrintWriter out) { |
| | | if (!StringUtil.Md5(uid + "@?,223Hbb88lll").equalsIgnoreCase(sign)) { |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1001, "签名错误"))); |
| | | return; |
| | |
| | | token = redisManager.getCommonString(key); |
| | | if (StringUtil.isNullOrEmpty(token)) { |
| | | try { |
| | | if(StringUtil.isNullOrEmpty(sceneId)){ |
| | | sceneId ="20150318020015507"; |
| | | } |
| | | TaoKeOfficialActivityConvertResultDTO dto = TaoKeApiUtil.officialActivityConvert("19507100253", |
| | | "1574926757600", info.getRelationId()); |
| | | sceneId, info.getRelationId()); |
| | | String link = dto.getShort_click_url(); |
| | | if (!StringUtil.isNullOrEmpty(link)) { |
| | | token = TaoKeApiUtil.getTKToken("http://img.flqapp.com/resource/s11/banner.jpg", "预售商品付定金,得奖金!", |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.yeshi.fanli.entity.taobao.SearchFilter; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult; |
| | | import com.yeshi.fanli.util.*; |
| | | import com.yeshi.fanli.util.goods.douyin.CSJCPSApiUtil; |
| | | import com.yeshi.fanli.util.goods.douyin.DYUtil; |
| | |
| | | } |
| | | //优先解析淘口令 |
| | | if (goodsId != null) { |
| | | CommonGoods commonGoods = getTaoBaoGoods(goodsId); |
| | | if (commonGoods != null) |
| | | resultListener.onResult(commonGoods); |
| | | else |
| | | resultListener.onResult(text); |
| | | |
| | | TaoBaoGoodsBrief taobaoGoods =null; |
| | | try { |
| | | taobaoGoods = TaoKeApiUtil.getSimpleGoodsInfo(goodsId); |
| | | } catch (TaobaoGoodsDownException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (taobaoGoods==null) { |
| | | int startIndex = text.indexOf("「"); |
| | | int endIndex = text.indexOf("」"); |
| | | if (startIndex > 0 && endIndex > 0) { |
| | | resultListener.onResult(text.substring(startIndex+1,endIndex)); |
| | | return; |
| | | } |
| | | } else { |
| | | CommonGoods commonGoods = CommonGoodsFactory.create(taobaoGoods); |
| | | if (commonGoods != null) |
| | | resultListener.onResult(commonGoods); |
| | | else |
| | | resultListener.onResult(text); |
| | | } |
| | | return; |
| | | } |
| | | |
| | |
| | | if (goods != null) { |
| | | commonGoods = CommonGoodsFactory.create(goods); |
| | | } else { |
| | | goods = TaoBaoUtil.getTmallGoodsInfo(simpleGoods.getGoodsId()); |
| | | if (goods != null) { |
| | | SearchFilter sf=new SearchFilter(); |
| | | sf.setKey("https://item.taobao.com/item.htm?id="+simpleGoods.getGoodsId()); |
| | | TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(sf,null,null); |
| | | if(searchResult!=null&&searchResult.getTaoBaoGoodsBriefs()!=null&&searchResult.getTaoBaoGoodsBriefs().size()>0){ |
| | | TaoBaoGoodsBrief tempGoods = searchResult.getTaoBaoGoodsBriefs().get(0); |
| | | commonGoods = new CommonGoods(); |
| | | commonGoods.setTitle(goods.getTitle()); |
| | | commonGoods.setPicture(goods.getPictUrl()); |
| | | } else { |
| | | // TODO 根据淘宝商品ID解析标题与图片 |
| | | commonGoods.setTitle(tempGoods.getTitle()); |
| | | commonGoods.setPicture(tempGoods.getPictUrl()); |
| | | }else { |
| | | goods = TaoBaoUtil.getTmallGoodsInfo(simpleGoods.getGoodsId()); |
| | | if (goods != null) { |
| | | commonGoods = new CommonGoods(); |
| | | commonGoods.setTitle(goods.getTitle()); |
| | | commonGoods.setPicture(goods.getPictUrl()); |
| | | } else { |
| | | // TODO 根据淘宝商品ID解析标题与图片 |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | if (goods != null) { |
| | | commonGoods = CommonGoodsFactory.create(goods); |
| | | } |
| | | }else if (simpleGoods.getGoodsType() == Constant.SOURCE_TYPE_DY) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong( simpleGoods.getGoodsId())); |
| | | } else if (simpleGoods.getGoodsType() == Constant.SOURCE_TYPE_DY) { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong(simpleGoods.getGoodsId())); |
| | | if (goods != null) { |
| | | commonGoods = CommonGoodsFactory.create(goods); |
| | | } |
| | |
| | | if (!StringUtil.isNullOrEmpty(vipId)) { |
| | | return new SimpleCommonGoods(vipId, Constant.SOURCE_TYPE_VIP); |
| | | } |
| | | String dyProductId= DYUtil.parseProdectIdFromLink(link); |
| | | String dyProductId = DYUtil.parseProdectIdFromLink(link); |
| | | if (!StringUtil.isNullOrEmpty(dyProductId)) { |
| | | return new SimpleCommonGoods(dyProductId, Constant.SOURCE_TYPE_DY); |
| | | } |
| | |
| | | this.goodsType = goodsType; |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | //String originText, String platform, String version |
| | | Set<ClipboardContentType> sets = parseContentType("【淘宝】https://m.tb.cn/h.5bfPu3j?tk=r6fUdGRXH5y CZ0001 「宜恩斯指纹锁家用入户防盗门电子密码锁人脸识别可视智能门锁智选」\n" + |
| | | "点击链接直接打开 或者 淘宝搜索直接打开", "android", "100"); |
| | | System.out.println(sets); |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @author Administrator |
| | | */ |
| | | |
| | | |
| | |
| | | URLEncoder.encode(fromEmail, "UTF-8"), URLEncoder.encode(fromEmailPwd, "UTF-8"), |
| | | URLEncoder.encode(toEmail, "UTF-8"), URLEncoder.encode(title, "UTF-8"), |
| | | URLEncoder.encode(content, "UTF-8")); |
| | | System.out.println(url); |
| | | String result = HttpUtil.get(url); |
| | | JSONObject data = JSONObject.fromObject(result); |
| | | if (data.optInt("code") == 0) |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String username = "kuaisheng110@163.com"; |
| | | String pwd = "CMZASWUPTJSFXCNP"; |
| | | MailSendInfo mailInfo = new MailSendInfo(); |
| | | mailInfo.setMailServerHost("smtp." + username.split("@")[1]); |
| | | mailInfo.setMailServerPort("25"); |
| | | mailInfo.setValidate(true); |
| | | |
| | | mailInfo.setUserName(username); |
| | | mailInfo.setPassword(pwd); |
| | | mailInfo.setFromAddress(username); |
| | | mailInfo.setToAddress("hexiaohui@banliapp.com"); |
| | | mailInfo.setSubject("测试发送标题"); |
| | | StringBuffer buffer = new StringBuffer(); |
| | | buffer.append("测试发送内容"); |
| | | mailInfo.setContent(buffer.toString()); |
| | | sendTextMail(mailInfo); |
| | | String fromEmail="ohaicao@163.com"; |
| | | String fromEmailPwd="admin123456"; |
| | | String title="测试标题"; |
| | | String content="测试内容"; |
| | | sendEmail("liuhongrui@banliapp.com",fromEmail,fromEmailPwd,title,content); |
| | | } |
| | | } |
| | |
| | | import org.apache.commons.httpclient.methods.PostMethod; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | |
| | | * @date 2022/8/8 15:45 |
| | | */ |
| | | public class CSJCPSApiUtil { |
| | | private static Logger debugLog=LoggerFactory.getLogger("debugLog"); |
| | | private static Logger debugLog = LoggerFactory.getLogger("debugLog"); |
| | | |
| | | private static String post(String url, String entity) { |
| | | HttpClient client = new HttpClient(); |
| | |
| | | private static String baseRequest(String path, JSONObject data, CSJAppInfo appInfo) { |
| | | String url = "http://ecom.pangolin-sdk-toutiao.com" + path; |
| | | |
| | | debugLog.info("抖音请求开始:链接-{}",url); |
| | | debugLog.info("抖音请求开始:链接-{}", url); |
| | | |
| | | com.alibaba.fastjson.JSONObject params = new com.alibaba.fastjson.JSONObject(); |
| | | params.put("app_id", appInfo.getAppId()); |
| | |
| | | * @param: extra_info 媒体传递扩展参数的字段, 字符只允许字⺟⼤⼩写、数字、 下划线,⻓度不超过20 |
| | | * @param: product_ext 商品搜索接⼝返回的 product.ext 字段, 尽量填写 |
| | | **/ |
| | | public static DYConvertResult goodsConvert(String product_url, String extra_info, String product_ext) { |
| | | public static DYConvertResult goodsConvert(String product_url, String extra_info, String product_ext) throws Exception { |
| | | JSONObject data = new JSONObject(); |
| | | data.put("product_url", product_url); |
| | | data.put("external_info", extra_info); |
| | |
| | | System.out.println(result); |
| | | JSONObject resultJson = JSONObject.fromObject(result); |
| | | if (resultJson.optInt("code") != 0) { |
| | | return null; |
| | | throw new Exception(resultJson.optString("desc")); |
| | | } |
| | | JSONObject dataJson = resultJson.optJSONObject("data"); |
| | | DYConvertResult bean = new DYConvertResult(); |
| | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | // DYOrderFilter filter=new DYOrderFilter(); |
| | | // filter.setTime_type("update"); |
| | | // filter.setOrder_type(1); |
| | | // filter.setSize(50); |
| | | // filter.setCursor("0"); |
| | | // filter.setStart_time(TimeUtil.convertToTimeTemp("2022-12-18","yyyy-MM-dd")/1000); |
| | | // filter.setEnd_time(TimeUtil.convertToTimeTemp("2022-12-19","yyyy-MM-dd")/1000); |
| | | // |
| | | // DYOrderResult result = orderList(filter); |
| | | // System.out.println(result); |
| | | goodsDetails(Arrays.asList(new Long[]{3549871967593209780L})); |
| | | // DYOrder order = getOrderDetail("5005828634543277401", 1); |
| | | |
| | | public static void main(String[] args) throws Exception { |
| | | DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong("3610681443753307139")); |
| | | DYConvertResult link = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createFanLiExtraInfo(437032L), |
| | | ""); |
| | | System.out.println(link); |
| | | } |
| | | |
| | | |
| | |
| | | import net.sf.json.JSONObject; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.MoneyBigDecimalUtil; |
| | | import org.yeshi.utils.NumberUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | import org.yeshi.utils.taobao.TbImgUtil; |
| | | |
| | |
| | | */ |
| | | public static TaoBaoGoodsBrief getSimpleGoodsInfo(String id) throws TaobaoGoodsDownException { |
| | | Map<String, String> map = new HashMap<>(); |
| | | //TODO 临时接口 taobao.tbk.item.info.get |
| | | |
| | | map.put("method", "taobao.tbk.item.info.get"); |
| | | // map.put("biz_scene_id", 2 + ""); |
| | | |
| | | map.put("num_iids", id + ""); |
| | | String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | String resultStr = null; |
| | | if(!NumberUtil.isNumeric(id)){ |
| | | resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | }else{ |
| | | map.put("biz_scene_id", "2"); |
| | | resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, TaoBaoConstant.getSpecialAuthAppInfo(TaoBaoConstant.TAOBAO_PID_DEFAULT)); |
| | | } |
| | | System.out.println(resultStr); |
| | | JSONObject data = JSONObject.fromObject(resultStr); |
| | | // 商品下架 |
| | |
| | | if (array != null && array.size() > 0) { |
| | | JSONObject item = array.optJSONObject(0); |
| | | TaoBaoGoodsBrief goods = parseSimpleGoodsInfo(item); |
| | | if(goods!=null){ |
| | | if(goods!=null&&!NumberUtil.isNumeric(id)){ |
| | | goods.setAuctionId(id); |
| | | } |
| | | return goods; |
| | |
| | | PageEntity pageEntity = new PageEntity(); |
| | | TaoBaoSearchResult taoBaoSearchResult = new TaoBaoSearchResult(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | //TODO 临时接口taobao.tbk.dg.material.optional |
| | | map.put("method", "taobao.tbk.dg.material.optional"); |
| | | map.put("page_size", filter.getPageSize() == 0 ? "20" : filter.getPageSize() + ""); |
| | | map.put("page_no", (filter.getPage() <= 0 ? 1 : filter.getPage()) + ""); |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) throws TaoBaoTokenParseException, TaobaoGoodsDownException { |
| | | TaoBaoGoodsBrief goods = getSimpleGoodsInfo("qYtrU8tgk7CWt0-GmgDAKHqqGm3XDwHZj"); |
| | | System.out.println(goods.getAuctionId()); |
| | | // SearchFilter sf =new SearchFilter(); |
| | | // sf.setKey("https://s.click.taobao.com/HCsB7Du"); |
| | | // sf.setPageSize(10); |
| | | // sf.setPage(1); |
| | | // searchWuLiao(sf,null,null); |
| | | // tokenConvert("【淘宝】https://m.tb.cn/h.5YFsc7F?tk=A8wSdGRxsjm CZ0001 「俄罗斯风味迷你提拉米苏蜂蜜奶油千层甜品蛋糕早餐整箱3000克零食」\n" + |
| | | // "点击链接直接打开 或者 淘宝搜索直接打开"); |
| | | |
| | | TaoBaoGoodsBrief goods = getSimpleGoodsInfo("666444715990"); |
| | | System.out.println(goods); |
| | | // System.out.println(goods.getAuctionId()); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("method", "taobao.tbk.item.info.get"); |
| | | // map.put("biz_scene_id", "2"); |
| | | // map.put("num_iids", "708395859317"); |
| | | // String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true); |
| | | // System.out.println(resultStr); |
| | | } |
| | | |
| | | } |
| | |
| | | if (taoKeAppInfo == null) { |
| | | System.out.println("请求。。。。。"); |
| | | String result = null; |
| | | try { |
| | | result = HttpUtil.get("http://193.112.35.168:8091/tb/taoke/getcanuseapp"); |
| | | } catch (Exception e) { |
| | | } |
| | | // try { |
| | | // result = HttpUtil.get("http://193.112.35.168:8091/tb/taoke/getcanuseapp"); |
| | | // } catch (Exception e) { |
| | | // } |
| | | |
| | | // 接口请求失败,默认设置成影视大全IOS的媒体信息 |
| | | if (StringUtil.isNullOrEmpty(result)) { |
| | |
| | | |
| | | <dubbo:annotation package="com.yeshi.fanli"></dubbo:annotation> |
| | | |
| | | <!--<dubbo:registry address="zookeeper://172.16.16.46:2181"/>--> |
| | | <dubbo:registry address="zookeeper://193.112.35.168:2182"/> |
| | | <dubbo:registry address="zookeeper://172.16.16.46:2181"/> |
| | | <!--<dubbo:registry address="zookeeper://193.112.35.168:2182"/>--> |
| | | |
| | | <!-- url=dubbo://192.168.3.122:20882/com.yeshi.goods.facade.service.TaoBaoCouponCacheService --> |
| | | |