|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | package com.secondworld.sdk.command; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.quicksdk.entity.GameRoleInfo; | 
|---|
|  |  |  | import com.quicksdk.entity.OrderInfo; | 
|---|
|  |  |  | import com.secondworld.sdk.GameAppProxy; | 
|---|
|  |  |  | import com.secondworld.sdk.PlatformDiff; | 
|---|
|  |  |  | 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"));//设置游戏角色等级 | 
|---|
|  |  |  | String familyName = json.getString("familyName").trim().replace(" ",""); | 
|---|
|  |  |  | if (familyName.isEmpty()) | 
|---|
|  |  |  | { | 
|---|
|  |  |  | familyName = "default"; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | roleInfo.setPartyName(familyName);//设置帮派名称 | 
|---|
|  |  |  | roleInfo.setRoleCreateTime(json.getString("createTime")); //UC,当乐与1881,TT渠道必传,值为10位数时间戳 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | roleInfo.setPartyId(json.getString("familyID")); //设置帮派id,必须为整型字符串 | 
|---|
|  |  |  | roleInfo.setGameRoleGender("男"); | 
|---|
|  |  |  | roleInfo.setGameRolePower(json.getString("fightPower")); //设置角色战力,必须为整型字符串 | 
|---|
|  |  |  | roleInfo.setPartyRoleId("11"); //设置角色在帮派中的id | 
|---|
|  |  |  | roleInfo.setPartyRoleName("帮主"); //设置角色在帮派中的名称 | 
|---|
|  |  |  | roleInfo.setProfessionId("-1"); //设置角色职业id,必须为整型字符串 | 
|---|
|  |  |  | roleInfo.setProfession("-1"); //设置角色职业名称 | 
|---|
|  |  |  | roleInfo.setFriendlist("无"); //设置好友关系列表,格式请参考: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); | 
|---|
|  |  |  | PlatformDiff.I.PrePayEvent(json.getString("title"), json.getString("cpInfo"), json.getDouble("mount")); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|