| | |
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TBPid;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.tlj.TaoLiJinCreateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeOrderApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeScApiUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | // e.printStackTrace();
|
| | | // }
|
| | |
|
| | | List<TaoBaoOrder> list = TaoKeOrderApiUtil.getTaoBaoRelationOrderList(
|
| | | TimeUtil.convertToTimeTemp("2019-12-09 10:13:52", "yyyy-MM-dd HH:mm:ss"),
|
| | | TimeUtil.convertToTimeTemp("2019-12-09 10:14:53", "yyyy-MM-dd HH:mm:ss"), 1);
|
| | | System.out.println(list);
|
| | | // List<TaoBaoOrder> list =
|
| | | // TaoKeOrderApiUtil.getTaoBaoRelationOrderList(
|
| | | // TimeUtil.convertToTimeTemp("2019-12-09 10:13:52", "yyyy-MM-dd
|
| | | // HH:mm:ss"),
|
| | | // TimeUtil.convertToTimeTemp("2019-12-09 10:14:53", "yyyy-MM-dd
|
| | | // HH:mm:ss"), 1);
|
| | | // System.out.println(list);
|
| | |
|
| | | String result = TaoKeApiUtil.officialActivityConvert("19507100253", "1571715733668", "20211660")
|
| | | .getShort_click_url();
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | @Test
|
| | |
| | |
|
| | | // TaoKeApiUtil.getQuanInfo(579875678934L,
|
| | | // "91b8984019e24fe1b1e3d6bd15479785");
|
| | | String result = TaoKeApiUtil.getActivityInfo("1583739244161", TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT,
|
| | | "511374878");
|
| | | System.out.println(result);
|
| | | // String result = TaoKeApiUtil.getActivityInfo("1583739244161", TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT,
|
| | | // "511374878");
|
| | | // System.out.println(result);
|
| | | String result="https://uland.taobao.com/taolijin/edetail?eh=2gFTo0zZuaeZuQF0XRz0iAXoB%2BDaBK5LQS0Flu%2FfbSp4QsdWMikAalrisGmre1Id0BFAqRODu11RSUolmZ1LiwZ2FMnFRDsF%2BMUwzxYlSKECGml30RY8PBx5jSVkulpmySQequ91YUPn8ckYb41tOyMTAhb7rmGydIrwSfYTDgyfcFUbN9tzknpL2ZPAakwyOfbWhbYEOF1LZWNyyCUQRu9L02t3YMA5G%2FdYx%2FWrPlG0lbyxNMIB8p2A%2Fvvgsr%2Fg9KslStkQtyrcQrNyb0ac3hVaN9HlETXhasDqmcapORh%2BOHfs5nLQGA%3D%3D&union_lens=lensId%3A0b59b01d_0bb5_172f470555e_c9b3%3Btraffic_flag%3Dlm&un=b68328d5be2676ace8f55b3b63c56d8b&share_crt_v=1&ut_sk=1.utdid_24587154_1593238990891.TaoPassword-Outside.taoketop&spm=a2159r.13376465.0.0&sp_tk=77+ld2Y1ajF3V3ZxOUbvv6U=/&relationId=20211660";
|
| | |
|
| | | String token = TaoKeApiUtil.getTKToken("http://", "口碑外卖红包", result);
|
| | |
|
| | |
| | | String appSecret = "2be7a216bee767dc3a6388aa24f11140";
|
| | | String pid = "mm_502940004_754900291_109486750166";
|
| | | TaoKeAppInfo app = new TaoKeAppInfo(appKey, appSecret, pid);
|
| | |
|
| | | try {
|
| | | TaoLiJinDTO dto = TaoKeApiUtil.createTaoLiJin(auctionId, "淘礼金", new BigDecimal(1), 1, new Date(),
|
| | | new Date(System.currentTimeMillis() + 1000 * 60 * 60 * 12L), new Date(),
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void test7() {
|
| | | Long uid = 1965358L;
|
| | | Long auctionId = 575009129060L;
|
| | | String platform = "ios";
|
| | | UserInfoService userInfoService = BeanUtil.getBean(UserInfoService.class);
|
| | | UserExtraTaoBaoInfoService userExtraTaoBaoInfoService = BeanUtil.getBean(UserExtraTaoBaoInfoService.class);
|
| | | TaoBaoBuyRelationMapService taoBaoBuyRelationMapService = BeanUtil.getBean(TaoBaoBuyRelationMapService.class);
|
| | | TBPidService tbPidService = BeanUtil.getBean(TBPidService.class);
|
| | |
|
| | | ShareGoodsService shareGoodsService = BeanUtil.getBean(ShareGoodsService.class);
|
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | |
|
| | | TaoBaoGoodsBrief goods = null;
|
| | |
|
| | | try {
|
| | | goods = TaoKeApiUtil.getSimpleGoodsInfo(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | return;
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e, "获取商品简版详情出错", auctionId + "");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | boolean isNative = false;
|
| | | String pid = null;
|
| | |
|
| | | boolean specialConvert = false;
|
| | |
|
| | | if (goods.getMaterialLibType() != null && goods.getMaterialLibType() == 1) {
|
| | | specialConvert = true;
|
| | | } else
|
| | | specialConvert = false;
|
| | |
|
| | | String specialId = null;
|
| | | String relationId = null;
|
| | | // 查询用户ID是否绑定了会员运营ID
|
| | | UserExtraTaoBaoInfo userInfo = userExtraTaoBaoInfoService.getByUid(uid);
|
| | | if (userInfo != null && !StringUtil.isNullOrEmpty(userInfo.getSpecialId()) && userInfo.getSpecialValid() != null
|
| | | && userInfo.getSpecialValid() == true) {
|
| | | specialId = userInfo.getSpecialId();
|
| | | relationId = userInfo.getRelationId();
|
| | | // 已经绑定
|
| | | if (specialConvert) {
|
| | | isNative = true;
|
| | | } else
|
| | | isNative = false;
|
| | |
|
| | | pid = TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT;
|
| | |
|
| | | } else {// 尚未绑定
|
| | | isNative = true;
|
| | | }
|
| | |
|
| | | data.put("native", isNative);
|
| | |
|
| | | int pidType = PidUser.TYPE_FANLI_ANDROID;
|
| | | if (platform.equalsIgnoreCase("ios"))
|
| | | pidType = PidUser.TYPE_FANLI_IOS;
|
| | | try {
|
| | |
|
| | | TaoBaoLink taoBaoLink = null;
|
| | | // 是返利商品库的商品
|
| | | if (specialConvert) {
|
| | | if (!StringUtil.isNullOrEmpty(specialId)) {
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForBuyWithSpecial(uid, specialId, auctionId);
|
| | | data.put("native", true);
|
| | | } else {
|
| | | if (!specialConvert && !isNative) {
|
| | | if (pidType == PidUser.TYPE_FANLI_ANDROID)
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
|
| | | tbPidService.getAndroidDefault().getPid());
|
| | | else
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
|
| | | tbPidService.getIOSDefault().getPid());
|
| | | } else
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForBuy(uid, auctionId, pidType);
|
| | | }
|
| | | } else {// 不是返利库的商品,用特殊PID替代
|
| | | try {
|
| | | relationId = taoBaoBuyRelationMapService.getRelationId(uid);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e, "uid:" + uid, null);
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(relationId)) {//
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId,
|
| | | TaoBaoConstant.TAOBAO_RELATION_AS_SPECIAL_PID);
|
| | | data.put("native", true);
|
| | | } else {
|
| | | if (pidType == PidUser.TYPE_FANLI_ANDROID)
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
|
| | | tbPidService.getAndroidDefault().getPid());
|
| | | else
|
| | | taoBaoLink = shareGoodsService.getTaoBaoLink(uid, auctionId,
|
| | | tbPidService.getIOSDefault().getPid());
|
| | | }
|
| | | }
|
| | | JSONObject link = new JSONObject();
|
| | | link.put("clickUrl", taoBaoLink.getClickUrl());
|
| | | link.put("couponUrl", taoBaoLink.getCouponLink());
|
| | | data.put("type", 1);
|
| | | data.put("link", link);
|
| | | } catch (Exception e) {
|
| | | isNative = false;
|
| | | // TBPid tbPid = null;
|
| | | // if (acceptData.getPlatform().equalsIgnoreCase("android")) {
|
| | | // tbPid = tbPidService.getTBPid(uid, PidUser.TYPE_FANLI_ANDROID);
|
| | | // } else {
|
| | | // tbPid = tbPidService.getTBPid(uid, PidUser.TYPE_FANLI_IOS);
|
| | | // }
|
| | | //
|
| | | // data.put("native", isNative);
|
| | |
|
| | | // if (tbPid != null) {
|
| | | // String siteId = tbPid.getPid().split("_")[2];
|
| | | // String adzoneId = tbPid.getPid().split("_")[3];
|
| | | // TaoBaoUnionConfig config =
|
| | | // taoBaoUnionConfigService.getConfigByAppIdCache(siteId);
|
| | | // ClientTBPid clientTBPid = new ClientTBPid(config.getAppKey(),
|
| | | // tbPid.getPid(), siteId, adzoneId);
|
| | | // data.put("type", 2);
|
| | | // data.put("tbPidInfo", clientTBPid);
|
| | | // out.print(JsonUtil.loadTrueResult(data));
|
| | | // } else {
|
| | | // out.print(JsonUtil.loadFalseResult(1, "请求失败"));
|
| | | // }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private void deleteAdzones(String adzones) {
|
| | | String url = "https://pub.alimama.com/common/adzone/adzoneDelete.json";
|
| | | Map<String, String> headers = new HashMap<>();
|
| | |
| | |
|
| | | @Test
|
| | | public void test14() {
|
| | | String code = "jlCUH3V5wnDuH9I3ahEg1KgR1380518";
|
| | |
|
| | | Long[] ids = new Long[] {
|
| | | 547050481823L,612971793223L
|
| | | };
|
| | | String result = TaoKeApiUtil.getAccessToken(code, TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
|
| | | System.out.println(result);
|
| | | JSONObject data = JSONObject.fromObject(result);
|
| | | data = data.optJSONObject("top_auth_token_create_response").optJSONObject("token_result");
|
| | | String accessToken = data.optString("access_token");
|
| | | System.out.println(accessToken);
|
| | |
|
| | | // access_token=620272221d6af090974a62a875452dfh3400a52ddf4c2c7759742701
|
| | |
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void test15() {
|
| | | // {method=taobao.tbk.sc.material.optional,
|
| | | // session=6101d231f78794fb690d4e7ecc9f1561f937e85e6a3f1393327215652,
|
| | | // adzone_id=107334300197, format=json,
|
| | | // sign=68930B8D27FF0B2687AE474667D23786, page_no=1, q=鞋,
|
| | | // app_key=24980167, v=2.0, site_id=401250386, sign_method=md5,
|
| | | // page_size=20, timestamp=2020-05-29 16:46:43}
|
| | |
|
| | | String session = "6100f00414ec21b3efd66f63a8b1b3a8e4f54bebf46f8c7759742701";
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setKey("运动鞋");
|
| | | TaoKeScApiUtil.searchWuLiao(sf, session, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY,
|
| | | TaoBaoConstant.TAOBAO_AUTH_APPSECRET, "mm_106929643_20324269_73400452"), "30125349");
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void test16() {
|
| | | SearchFilter sf=new SearchFilter();
|
| | | sf.setKey("袜子");
|
| | | sf.setStartTkRate(5000);
|
| | | sf.setEndTkRate(9000);
|
| | | sf.setPage(25);
|
| | | sf.setPageSize(50);
|
| | | TaoBaoSearchResult result= TaoKeApiUtil.searchWuLiao(sf);
|
| | | System.out.println(result);
|
| | | }
|
| | |
|
| | | @Test
|
| | | public void test17() {
|
| | | Date startTime = new Date(TimeUtil.convertToTimeTemp("2020-06-27", "yyyy-MM-dd"));
|
| | | Date endTime = new Date(TimeUtil.convertToTimeTemp("2020-06-28", "yyyy-MM-dd"));
|
| | | try {
|
| | | for (Long id : ids) {
|
| | | TaoBaoGoodsBrief goods = TaoKeApiUtil.getSimpleGoodsInfo(id);
|
| | | System.out.println(goods.getMaterialLibType());
|
| | | }
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | TaoKeApiUtil.createTaoLiJin(550151362030L, "口令", new BigDecimal("1"), 1, startTime, endTime, startTime,
|
| | | endTime, new TaoKeAppInfo(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_AUTH_APPSECRET, TaoBaoConstant.TAOBAO_TLJ_RELATION_PID_DEFAULT));
|
| | | } catch (TaoLiJinCreateException e) {
|
| | | e.printStackTrace();
|
| | | } catch (TaoKeApiException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // DaTaoKeApiUtil.convertLink(614847140426L,
|
| | | // TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT);
|
| | | }
|
| | |
|
| | | }
|