admin
2019-01-23 e179d8660bf4837455a38c24e74320143e0d2e17
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -1463,25 +1463,41 @@
   }
   public static String getAccessToken(String code, String appKey, String appSecret) {
      Map<String, String> map = new HashMap<>();
      map.put("method", "taobao.top.auth.token.create");
      map.put("code", code);
      TaoKeAppInfo app = new TaoKeAppInfo();
      app.setAppKey(appKey);
      app.setAppSecret(appSecret);
      try {
         JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
         if (json != null)
            return json.toString();
      } catch (TaoKeApiException e) {
         e.printStackTrace();
      }
      return null;
   }
   /**
    * 渠道邀请码
    * 
    * @param relationId
    * @return
    */
   public static String getInviteCode(Long relationId, String accessToken) {
   public static String getInviteCode(Long relationId, String accessToken, String appKey, String appSecret) {
      Map<String, String> map = new HashMap<>();
      map.put("method", "taobao.tbk.sc.invitecode.get");
      map.put("session", accessToken);
      map.put("relation_id", relationId + "");
      map.put("code_type", "2");
      map.put("relation_app", "返利券");
      map.put("code_type", "1");
      map.put("relation_app", "common");
      JSONObject resultJSON = null;
      try {
         TaoKeAppInfo app = new TaoKeAppInfo();
         app.setAppKey("24567001");
         app.setAppSecret("e26a8d0f8726883d44bf04742829b533");
         app.setAdzoneId("123123");
         TaoKeAppInfo app = new TaoKeAppInfo();
         app.setAppKey(appKey);
         app.setAppSecret(appSecret);
         resultJSON = TaoKeBaseUtil.baseRequest(map, app);
      } catch (TaoKeApiException e) {
         e.printStackTrace();
@@ -1490,7 +1506,27 @@
         return null;
      return null;
   }
   public static String beiAnQuDao(Long relationId, String accessToken, String appKey, String appSecret) {
      Map<String, String> map = new HashMap<>();
      map.put("method", "taobao.tbk.sc.publisher.info.save");
      map.put("session", accessToken);
      map.put("inviter_code", "A2QnGL");
      map.put("info_type", "1");
      JSONObject resultJSON = null;
      try {
         TaoKeAppInfo app = new TaoKeAppInfo();
         app.setAppKey(appKey);
         app.setAppSecret(appSecret);
         resultJSON = TaoKeBaseUtil.baseRequest(map, app);
      } catch (TaoKeApiException e) {
         e.printStackTrace();
      }
      if (resultJSON == null)
         return null;
      return null;
   }
   private static TaoBaoGoodsBrief parseWuLiaoItemFromMaterialId(JSONObject item) {