Commit 0603c6213553e15f34c23117be1c3ac738ce24ab
1 parent
742f245144
Exists in
master
edit
Showing 1 changed file with 2 additions and 2 deletions Inline Diff
ServerDocument.md
| 1 | ## GumpTech服务端接口文档 | 1 | ## GumpTech服务端接口文档 |
| 2 | 2 | ||
| 3 | 1. 用户登录验证接口 | 3 | 1. 用户登录验证接口 |
| 4 | ---------------------------- | 4 | ---------------------------- |
| 5 | 接口地址:http://sdk.letsgame.mobi/v1/user/verify_user.do | 5 | 接口地址:http://sdk.letsgame.mobi/v1/user/verify_user.do |
| 6 | 参数: | 6 | 参数: |
| 7 | appId: 游戏接入分配appid | 7 | appId: 游戏接入分配appid |
| 8 | appkey: 注意appkey都为小写字母 | 8 | appkey: 注意appkey都为小写字母 |
| 9 | userId: GumpTech平台的用户id | 9 | userId: GumpTech平台的用户id |
| 10 | sessionKey: 登录后回调给给第三方 | 10 | sessionKey: 登录后回调给给第三方 |
| 11 | 11 | ||
| 12 | 返回值: | 12 | 返回值: |
| 13 | { | 13 | { |
| 14 | "code":100000 | 14 | "code":100000 |
| 15 | "msg":"xxxxxx" | 15 | "msg":"xxxxxx" |
| 16 | "data":{ | 16 | "data":{ |
| 17 | "userId":23444 | 17 | "userId":23444 |
| 18 | "sessionKey":"xxx" | 18 | "sessionKey":"xxx" |
| 19 | } | 19 | } |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | 2. 充值通知第三方服务端接口 | 24 | 2. 充值通知第三方服务端接口 |
| 25 | ----------------------------- | 25 | ----------------------------- |
| 26 | 参数列表: | 26 | 参数列表: |
| 27 | orderId: 订单id | 27 | orderId: 订单id |
| 28 | appId: 游戏接入分配appid | 28 | appId: 游戏接入分配appid |
| 29 | userId: 平台用户id | 29 | userId: 平台用户id |
| 30 | product: 购买商品名字 | 30 | product: 购买商品名字 |
| 31 | extraInfo:游戏接入方传入自定义参数,200字符,页面支付值为:web_pay:[serverId]_[roleName] | 31 | extraInfo:游戏接入方传入自定义参数,200字符,页面支付值为:web_pay:[serverId]_[roleName] |
| 32 | currency:币种 exp:USD RMB | 32 | currency:币种 exp:USD RMB |
| 33 | amount:支付过程中选中额度,第三方可以忽略此参数 | 33 | amount:支付过程中选中额度,第三方可以忽略此参数 |
| 34 | realAmount: 最终用户支付的额度 | 34 | realAmount: 最终用户支付的额度 |
| 35 | sig: 签名 | 35 | sig: 签名 |
| 36 | 36 | ||
| 37 | 第三方server端返回值: | 37 | 第三方server端返回值: |
| 38 | 如果第三方验证成功,则返回字符串:success即可。 | 38 | 如果第三方验证成功,则返回字符串:success即可。 |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | 3.签名算法 | 41 | 3.签名算法 |
| 42 | -------------------------------- | 42 | -------------------------------- |
| 43 | 43 | ||
| 44 | 44 | ||
| 45 | ···java | 45 | ```java |
| 46 | 46 | ||
| 47 | /** | 47 | /** |
| 48 | * 签名算法 | 48 | * 签名算法 |
| 49 | * @param userOrder | 49 | * @param userOrder |
| 50 | * @param key | 50 | * @param key |
| 51 | * @return | 51 | * @return |
| 52 | */ | 52 | */ |
| 53 | private String sig(UserOrder userOrder, String key) { | 53 | private String sig(UserOrder userOrder, String key) { |
| 54 | 54 | ||
| 55 | SortedSet<String> allParams = Sets.newTreeSet(); | 55 | SortedSet<String> allParams = Sets.newTreeSet(); |
| 56 | try { | 56 | try { |
| 57 | 57 | ||
| 58 | allParams.add(Constants.Keys.ORDER_ID + "=" + URLEncoder.encode(userOrder.getId()+"", "utf-8")); | 58 | allParams.add(Constants.Keys.ORDER_ID + "=" + URLEncoder.encode(userOrder.getId()+"", "utf-8")); |
| 59 | allParams.add(Constants.Keys.APPID + "=" + URLEncoder.encode(userOrder.getAppId()+"", "utf-8")); | 59 | allParams.add(Constants.Keys.APPID + "=" + URLEncoder.encode(userOrder.getAppId()+"", "utf-8")); |
| 60 | allParams.add(Constants.Keys.USER_ID + "=" + URLEncoder.encode(userOrder.getUserId()+"", "utf-8")); | 60 | allParams.add(Constants.Keys.USER_ID + "=" + URLEncoder.encode(userOrder.getUserId()+"", "utf-8")); |
| 61 | allParams.add(Constants.Keys.PRODUCT + "=" + URLEncoder.encode(userOrder.getProduct(), "utf-8")); | 61 | allParams.add(Constants.Keys.PRODUCT + "=" + URLEncoder.encode(userOrder.getProduct(), "utf-8")); |
| 62 | 62 | ||
| 63 | allParams.add(Constants.Keys.EXTRA_INFO + "=" + URLEncoder.encode(userOrder.getExtraInfo(), "utf-8")); | 63 | allParams.add(Constants.Keys.EXTRA_INFO + "=" + URLEncoder.encode(userOrder.getExtraInfo(), "utf-8")); |
| 64 | allParams.add(Constants.Keys.CURRENCY + "=" + URLEncoder.encode(userOrder.getCurrency(), "utf-8")); | 64 | allParams.add(Constants.Keys.CURRENCY + "=" + URLEncoder.encode(userOrder.getCurrency(), "utf-8")); |
| 65 | allParams.add(Constants.Keys.AMOUNT + "=" + URLEncoder.encode(userOrder.getAmount()+"", "utf-8")); | 65 | allParams.add(Constants.Keys.AMOUNT + "=" + URLEncoder.encode(userOrder.getAmount()+"", "utf-8")); |
| 66 | allParams.add(Constants.Keys.REAL_AMOUNT + "=" + URLEncoder.encode(userOrder.getRealAmount()+"", "utf-8")); | 66 | allParams.add(Constants.Keys.REAL_AMOUNT + "=" + URLEncoder.encode(userOrder.getRealAmount()+"", "utf-8")); |
| 67 | 67 | ||
| 68 | } catch (UnsupportedEncodingException e) { | 68 | } catch (UnsupportedEncodingException e) { |
| 69 | e.printStackTrace(); | 69 | e.printStackTrace(); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | String params = Joiner.on("&").join(allParams) + key; | 72 | String params = Joiner.on("&").join(allParams) + key; |
| 73 | log.info("sig:" + params); | 73 | log.info("sig:" + params); |
| 74 | String computedToken = DigestUtils.md5DigestAsHex(params.getBytes()); | 74 | String computedToken = DigestUtils.md5DigestAsHex(params.getBytes()); |
| 75 | return computedToken; | 75 | return computedToken; |
| 76 | } | 76 | } |
| 77 | ··· |