您好, 之前我也试过直接全量同步积分到有赞,但提示open_user_id不存在
1. 调用登录接口将用户信息同步到有赞商城
MultiValueMap<String, String> params= new LinkedMultiValueMap<String, String>(); params.add("kdt_id", "41150775"); params.add("client_id", YouzanyunUtil.CLIENT_ID); params.add("client_secret", YouzanyunUtil.CLIENT_SECRET); params.add("nick_name", user.getNickName()); params.add("telephone", user.getMobile()); params.add("open_user_id", user.getUserId()); // userId: 6a225264aaa84e8391d71d9b11614ba3 return restUtil.send("https://uic.youzan.com/sso/open/login", params);
2. 调用全量同步积分接口同步积分
YZClient client = new DefaultYZClient(new Token(YouzanyunUtil.TOKEN)); //new Sign(appKey, appSecret) YouzanCrmCustomerPointsSyncParams youzanCrmCustomerPointsSyncParams = new YouzanCrmCustomerPointsSyncParams(); youzanCrmCustomerPointsSyncParams.setPoints((long)user.getPoint()); youzanCrmCustomerPointsSyncParams.setReason(YouzanyunUtil.SYNC_POINT_DESC); youzanCrmCustomerPointsSyncParams.setOpenUserId(user.getUserId()); YouzanCrmCustomerPointsSync youzanCrmCustomerPointsSync = new YouzanCrmCustomerPointsSync(); youzanCrmCustomerPointsSync.setAPIParams(youzanCrmCustomerPointsSyncParams); YouzanCrmCustomerPointsSyncResult result = client.invoke(youzanCrmCustomerPointsSync);
第2步返回信息:
ErrorResponse{code='141503104', msg='不存在该openUserId'}
第2步的token我是在“有赞开放API调试工具”中拿的测试token
|