hch
2023-05-16 056de02aa07079b11bc9d82696a9f5d943e90f18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.secondworld.sdk.command;
 
import com.quicksdk.entity.GameRoleInfo;
import com.quicksdk.entity.OrderInfo;
import com.secondworld.sdk.GameAppProxy;
import com.secondworld.sdk.QuickSdkMgr;
import com.secondworld.sdk.utils.CodeU2A;
 
import org.json.JSONObject;
 
import java.net.URLEncoder;
 
public class CmdPlatformPay implements ICommand {
    @Override
    public int getCode() {
        return CodeU2A.PlatformPay;
    }
 
    @Override
    public void process(JSONObject json) throws Exception {
 
 
        JSONObject extraData = new JSONObject();
        extraData.put("appid", GameAppProxy.appId);
        extraData.put("cpinfo", json.getString("cpInfo"));
        extraData.put("cporderid", json.getString("orderId"));
        extraData.put("serverid", json.getString("sid"));
        extraData.put("channelID", QuickSdkMgr.I.channelID);
 
        GameRoleInfo roleInfo = new GameRoleInfo();
        roleInfo.setServerID(json.getString("sid"));
        roleInfo.setServerName(json.getString("serverName"));
        roleInfo.setGameRoleName(json.getString("roleName").trim().replace(" ", ""));
        roleInfo.setGameRoleID(json.getString("roleID"));
        roleInfo.setGameBalance(json.getString("money"));
        roleInfo.setVipLevel(json.getString("vipLevel"));  //设置当前用户vip等级,必须为数字整型字符串,请勿传"vip1"等类似字符串
        roleInfo.setGameUserLevel(json.getString("level"));//设置游戏角色等级
        roleInfo.setPartyName(json.getString("familyName").trim().replace(" ", ""));//设置帮派名称
        roleInfo.setRoleCreateTime(json.getString("createTime")); //UC,当乐与1881,TT渠道必传,值为10位数时间戳
        roleInfo.setGameRoleGender("男");
        roleInfo.setPartyId("1100"); //360渠道参数,设置帮派id,必须为整型字符串
        roleInfo.setGameRolePower("38"); //360,TT语音渠道参数,设置角色战力,必须为整型字符串
        roleInfo.setPartyRoleId("11"); //360渠道参数,设置角色在帮派中的id
        roleInfo.setPartyRoleName("帮主"); //360渠道参数,设置角色在帮派中的名称
        roleInfo.setProfessionId("38"); //360渠道参数,设置角色职业id,必须为整型字符串
        roleInfo.setProfession("法师"); //360渠道参数,设置角色职业名称
        roleInfo.setFriendlist("无"); //360渠道参数,设置好友关系列表,格式请参考:http://open.quicksdk.net/help/detail/aid/190
 
 
        OrderInfo orderInfo = new OrderInfo();
        orderInfo.setCpOrderID(json.getString("orderId"));
        orderInfo.setGoodsName(json.getString("title"));//商品名称,不带数量
        orderInfo.setCount(1);//游戏币数量
        orderInfo.setAmount((float) json.getDouble("mount"));
        orderInfo.setGoodsID(json.getString("cpInfo"));
        orderInfo.setGoodsDesc(json.getString("title"));
        orderInfo.setExtrasParams(
                URLEncoder.encode(extraData.toString(), "utf-8"));
 
        QuickSdkMgr.I.pay(orderInfo, roleInfo);
    }
}