代码如图所示
private boolean getCard(String phone, String card) throws Throwable { System.out.println(phone); System.out.println(card); YouZanClient yzClient = new DefaultYZClient(); YouzanScrmCustomerCardGrant yzScrmCustomerCardGrant = new YouzanScrmCustomerCardGrant(); YouzanScrmCustomerCardGrantParams yzScrmCustomerCardGrantParams = new YouzanScrmCustomerCardGrantParams(); YouzanScrmCustomerCardGrantParams.YouzanScrmCustomerCardGrantParamsParams yzScrmCustomerCardGrantParamsParams = new YouzanScrmCustomerCardGrantParams.YouzanScrmCustomerCardGrantParamsParams(); yzScrmCustomerCardGrantParamsParams.setCardAlias(card); YouzanScrmCustomerCardGrantParams.YouzanScrmCustomerCardGrantParamsUser yzScrmCustomerCardGrantParamsUser = new YouzanScrmCustomerCardGrantParams.YouzanScrmCustomerCardGrantParamsUser(); yzScrmCustomerCardGrantParamsUser.setAccountType(5); yzScrmCustomerCardGrantParamsUser.setAccountId(phone); yzScrmCustomerCardGrantParamsParams.setUser(yzScrmCustomerCardGrantParamsUser); yzScrmCustomerCardGrantParams.setParams(yzScrmCustomerCardGrantParamsParams); yzScrmCustomerCardGrant.setAPIParams(yzScrmCustomerCardGrantParams); YouzanScrmCustomerCardGrantResult result = yzClient.invoke(yzScrmCustomerCardGrant, getToken(), YouzanScrmCustomerCardGrantResult.class); System.out.println(result.getCode()); System.out.println(result.getMessage()); System.out.println(result.getData().getCardNo()); return result.getCode() == 200; }
这个是api文档提供的代码,但是没有添加ktd_id,即店铺id。
我用postman测接口是成功的,这里虽然参数写的phone但是用的是youzan_id,在postman里不添加ktd_id是没法给用户设置权益卡的,而java这个接口里怎么设置ktd_id呢
|
|
用手机打开
收藏
赞 0
···
回复
|
|
|
|