Commit 1415e20023ff6a78128dd7918b2aa943c0bf1731

Authored by 李康
1 parent ef2ec63d9b
Exists in master

server doc

Showing 1 changed file with 85 additions and 0 deletions Inline Diff

File was created 1 1. 充值通知第三方服务端接口(需提供回调地址)
2 -----------------------------
3 参数列表:
4 orderId: parter订单号
5 tradId: 平台订单号
6 appId: 游戏接入分配appid
7 userId: 平台用户id
8 product: 购买商品名字(50字符)
9 currency: 币种 (目前仅有CNY)
10 amount: 充值金额(分)
11 channel:支付渠道(对应详情见4)
12 sig: 签名(算法详见3)
13
14 第三方server端返回值:
15 如果第三方验证成功,则返回字符串"success"即可,否则会通知10次后停止.如重复通知,注意校验平台订单号,如重复忽略.
16
17
18 2. 登录验证(可选)
19 -----------------------------------
20 url: http://inner-sdk.letsgame.mobi/v1/sdk/login_verify.do
21 参数:
22 userId:uid
23 appKey:第三方渠道的key
24 sessionKey:验证key
25
26 返回值:
27 {
28 "code":100000(100000:成功,100012:用户不存在,-1:失败),
29 "msg":"xxxxxx",
30 "userId":1234
31 }
32
33 3.签名算法
34 --------------------------------
35
36 注意:签名参数不能写成固定数量,一定要获取全部参数并且除sig参数外,然后按照字母升序排列。
37 ```java
38
39 /**
40 * 签名算法
41 * @param request
42 * @return
43 */
44 public String sig(HttpServletRequest request, String key){
45
46 Enumeration names = request.getParameterNames();
47 SortedSet<String> allParams = Sets.newTreeSet();
48
49 while (names.hasMoreElements()) {
50 String name = (String) names.nextElement();
51 if (name.equals("sig")) {
52 continue;
53 }
54
55 try {
56 allParams.add(name + "=" + URLEncoder.encode(request.getParameter(name), "utf-8"));
57 } catch (UnsupportedEncodingException e) {
58 e.printStackTrace();
59 }
60 }
61
62 String params = Joiner.on("&").join(allParams)+key;
63 String computedToken = DigestUtils.md5DigestAsHex(params.getBytes());
64 return computedToken;
65 }
66 ```
67
68
69
70 注意:参数是按字母升序排列 akey=value&bkey=value.... + secretkey(对应渠道的应用ID)
71
72 4.channel详情(部分上线)
73 --------------------------------
74
75 100100:丫丫玩 √
76 100200:小皮 √
77 100300:安智
78 100400:豌豆荚
79 100500:应用宝 √
80 100600:机锋 √
81 100700:泡椒
82 100800:木蚂蚁 √
83 100900:靠谱助手 √
84 101000:游戏群(熊猫玩)
85 101100:琵琶网