yujian
2019-07-10 aad0554cc7f18a6ec05e2e5e646b5e501d41617d
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -1948,10 +1948,10 @@
   // 淘礼金创建
   public static TaoLiJinDTO createTaoLiJin(Long auctionId, String name, BigDecimal perface, int totalNum,
         Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime) {
         Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime,String pid) throws TaoKeApiException{
      Map<String, String> map = new HashMap<>();
      map.put("method", "taobao.tbk.dg.vegas.tlj.create");
      map.put("adzone_id", TaoBaoConstant.TAOBAO_RELATION_PID_DEFAULT.split("_")[3]);
      map.put("adzone_id", pid.split("_")[3]);
      map.put("item_id", auctionId + "");
      map.put("total_num", totalNum + "");
      map.put("name", name);
@@ -1981,6 +1981,7 @@
         System.out.println(json);
         JSONObject root = json.optJSONObject("tbk_dg_vegas_tlj_create_response");
         if (root != null && root.optJSONObject("result") != null) {
            if (root.optJSONObject("result").optBoolean("success")) {
               JSONObject modelJson = root.optJSONObject("result").optJSONObject("model");
               TaoLiJinDTO dto = new TaoLiJinDTO();
@@ -1988,7 +1989,22 @@
               dto.setSendUrl(modelJson.optString("send_url"));
               return dto;
            }
            // 接口返回异常
            String msgCode = root.optJSONObject("result").optString("msg_code");
            if (!StringUtil.isNullOrEmpty(msgCode)) {
                switch(msgCode){
                 case "FAIL_BIZ_ITEM_FORBIDDEN":
                    throw new TaoKeApiException(TaoKeApiException.CODE_TLJ_FORBIDDEN, "该商品不支持创建淘礼金红包");
                 case "2":
                    throw new TaoKeApiException(TaoKeApiException.CODE_TLJ_NO_MONEY, "官方玩法钱包余额不足");
                 default:
                    return null;
               }
            }
         }
      } catch (TaoKeApiException e) {
          throw e;
      } catch (Exception e) {
         LogHelper.errorDetailInfo(e);
      }