| | |
| | | import com.tejia.lijin.app.ShoppingApi; |
| | | import com.tejia.lijin.app.entity.TbPidInfo; |
| | | import com.tejia.lijin.app.entity.common.GoodsConvertLinkJumpLink; |
| | | import com.tejia.lijin.app.entity.user.UserLijinLevelInfoVO; |
| | | import com.tejia.lijin.app.util.Constant; |
| | | import com.tejia.lijin.app.util.GoodsBuyJumpUtil; |
| | | import com.tejia.lijin.app.util.baichuan.AlibcTradeUtil; |
| | |
| | | buyJD(activity, requestInfo, resultListener); |
| | | break; |
| | | case Constant.GOODS_TYPE_PDD: |
| | | buyPDD(context, requestInfo, resultListener); |
| | | buyPDD(activity, requestInfo, resultListener); |
| | | break; |
| | | case Constant.GOODS_TYPE_VIP: |
| | | buyVIP(context, requestInfo, resultListener); |
| | | buyVIP(activity, requestInfo, resultListener); |
| | | break; |
| | | case Constant.GOODS_TYPE_SUNING: |
| | | buySuning(context, requestInfo, resultListener); |
| | | buySuning(activity, requestInfo, resultListener); |
| | | break; |
| | | } |
| | | |
| | |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | Gson gson = new GsonBuilder().serializeNulls().create(); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | TbPidInfo tInfo = null; |
| | | String clickUrl = null; |
| | | String couponUrl = null; |
| | | if (jsonObject.optJSONObject("data").optJSONObject("tbPidInfo") != null) |
| | | tInfo = gson.fromJson(jsonObject.optJSONObject("data").optJSONObject("tbPidInfo").toString(), TbPidInfo.class); |
| | | if (data.optJSONObject("tbPidInfo") != null) |
| | | tInfo = gson.fromJson(data.optJSONObject("tbPidInfo").toString(), TbPidInfo.class); |
| | | |
| | | JSONObject object = jsonObject.optJSONObject("data").optJSONObject("link"); |
| | | JSONObject object = data.optJSONObject("link"); |
| | | if (object != null) { |
| | | clickUrl = object.optString("clickUrl"); |
| | | couponUrl = object.optString("couponUrl"); |
| | | } |
| | | |
| | | buyGoodsResultListener.onConvertLinkSuccess(); |
| | | jumpTB(activity, tInfo, clickUrl, couponUrl, buyGoodsResultListener); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpTB(activity, tInfo, clickUrl, couponUrl,userLevel, buyGoodsResultListener); |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpJD(activity, jumpLink, new GoodsBuyJumpUtil.IJumpResult() { |
| | | |
| | | @Override |
| | | public void onSuccess() { |
| | | buyGoodsResultListener.onJumpThirdAppSuccess(); |
| | | } |
| | | |
| | | @Override |
| | | public void onFail(String msg) { |
| | | buyGoodsResultListener.onJumpThirdAppFail(); |
| | | } |
| | | }); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpJD(activity, jumpLink, userLevel, null); |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private static void buyPDD(final Context context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | private static void buyPDD(final Activity context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | ShoppingApi.getPDDLinkInfo(context, requestInfo.getUid(), requestInfo.getGoodsId(), requestInfo.getFrom(), "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink pddJumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink pddJumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpPDD(context, pddJumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpPDD(context, pddJumpLink, userLevel); |
| | | |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | private static void buyVIP(final Context context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | private static void buyVIP(final Activity context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | ShoppingApi.getVIPLinkInfo(context, requestInfo.getUid(), requestInfo.getGoodsId(), requestInfo.getFrom(), "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpVIPShop(context, jumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpVIPShop(context, jumpLink, userLevel); |
| | | |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | private static void buySuning(final Context context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | private static void buySuning(final Activity context, GoodsBuyRequestInfo requestInfo, final IBuyGoodsResultListener buyGoodsResultListener) { |
| | | ShoppingApi.getSuningLinkInfo(context, requestInfo.getUid(), requestInfo.getGoodsId(), requestInfo.getFrom(), "", new BasicTextHttpResponseHandler() { |
| | | @Override |
| | | public void onSuccessPerfect(int statusCode, Header[] headers, JSONObject jsonObject) throws Exception { |
| | | if (jsonObject.optString("code").equalsIgnoreCase("0")) { |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(jsonObject.optJSONObject("data").toString(), GoodsConvertLinkJumpLink.class); |
| | | JSONObject data = jsonObject.optJSONObject("data"); |
| | | GoodsConvertLinkJumpLink jumpLink = new Gson().fromJson(data.toString(), GoodsConvertLinkJumpLink.class); |
| | | buyGoodsResultListener.onJumpThirdAppStart(); |
| | | GoodsBuyJumpUtil.jumpSuning(context, jumpLink); |
| | | UserLijinLevelInfoVO userLevel = null; |
| | | if (data.optJSONObject("userLevel") != null) { |
| | | userLevel = new Gson().fromJson(data.optJSONObject("userLevel").toString(), UserLijinLevelInfoVO.class); |
| | | } |
| | | GoodsBuyJumpUtil.jumpSuning(context, jumpLink, userLevel); |
| | | } else { |
| | | buyGoodsResultListener.onConvertLinkFail(jsonObject.optString("msg")); |
| | | } |