基于手游棋牌游戏等各种APP第三四方支付宝微信收款自动回调支付接口API对接集成CODE技术分析

摘要:基于手游棋牌游戏等各种APP第三方四方支付宝微信收款自动回调支付接口API对接集成CODE技术分析!
功能描述:傲玩微星等各种棋牌手游游戏APP,会员用户充值,支付成功后,自动到账增加用户余额。实现无人自动化支付管理功能。

方法:通过支付对接API接口文档,通过对接游戏系统,在收到成功通知回调信息后,自动完成增加余额。

开发工具及编程语言:android studio,Eclipse ,Cocos creator游戏开发,LUA语言,JAVA, APP开发。服务后端编程语言:JAVA/ASPNET C#/PHP+MYSQL。

核心源码如下:

--[[
常用定义
]]
appdf = appdf or {}

appdf.bili = 1.0 -- 还原 倍数(1000 原始)

--屏幕高宽
appdf.WIDTH = 1334
appdf.HEIGHT = 750
appdf.g_scaleX = display.width / appdf.WIDTH --X坐标的缩放比例值 added ycc
appdf.g_scaleY = display.height / appdf.HEIGHT --Y坐标的缩放比例值 added ycc

appdf.BASE_SRC = "base.src."
appdf.CLIENT_SRC = "client.src."
appdf.GAME_SRC = "download."
appdf.gamepath = device.writablePath.."download/"
appdf.gamecodepath = "download."

--扩展目录
appdf.EXTERNAL_SRC = "client.src.external."
--通用定义目录
appdf.HEADER_SRC = "client.src.header."
--私人房目录
appdf.PRIVATE_SRC = "client.src.privatemode."

appdf.channelId = 1
appdf.Ratio = false

--下载信息
appdf.DOWN_PRO_INFO = 1 --下载进度
appdf.DOWN_COMPELETED = 3 --下载结果
appdf.DOWN_ERROR_PATH = 4 --路径出错
appdf.DOWN_ERROR_CREATEFILE = 5 --文件创建出错
appdf.DOWN_ERROR_CREATEURL = 6 --创建连接失败
appdf.DOWN_ERROR_NET = 7 --下载失败

appdf.CLIENT_NOTIFY = "__global_client_notify_event__" -- 客户端通知

--环境
appdf.isTest = false --(false.发布 true.测试)
--是否苹果版本
appdf.APPSTORE_VERSION = false
--网关
appdf.SERVER_LIST = {}
--api
appdf.http_api = {}
appdf.HTTP_URL = "http://112.27.6.62:2119/"
-- 当前地址索引
appdf.CURRENT_INDEX = 1
appdf.TOTAL_COUNT = #appdf.SERVER_LIST

-- 登陆地址
appdf.LOGONSERVER = appdf.SERVER_LIST[appdf.CURRENT_INDEX]

--编译码
appdf.VALIDATE = "11E9E77D-C628-4FD6-AC60-91A541DBD5C1" --@compilation

--程序版本
appdf.BASE_C_VERSION = 1 --@app_version
--资源版本
appdf.BASE_C_RESVERSION = 1000 --@client_version

--本地初始子游戏资源版本
appdf.BASE_GAME = 
{
{kind = 100, version = "-1"}, --斗地主
{kind = 101, version = "-1"}, --zha金花
{kind = 102, version = "-1"}, --百人牛牛
{kind = 103, version = "-1"}, --抢庄牛牛
{kind = 104, version = "-1"}, --红黑大战
{kind = 105, version = "-1"}, --龙虎斗
{kind = 106, version = "-1"}, --百家乐
{kind = 107, version = "-1"}, --捕鱼
{kind = 108, version = "-1"}, --一球成名
{kind = 109, version = "-1"}, --2人麻将
{kind = 110, version = "-1"}, --飞禽走兽
{kind = 111, version = "-1"}, --奔驰宝马
{kind = 113, version = "-1"}, --跑得快
{kind = 118, version = "-1"}, --德州扑克
{kind = 119, version = "-1"}, --水果机
{kind = 121, version = "-1"}, --视频百家乐
{kind = 122, version = "-1"}, --21点
{kind = 123, version = "-1"}, --俄罗斯转盘
{kind = 124, version = "-1"}, --菠BC菜(网站)
{kind = 125, version = "-1"}, --梭哈
{kind = 126, version = "-1"}, --十三水
{kind = 127, version = "-1"}, --百人骰宝
{kind = 210, version = "-1"}, --视讯骰宝
}

--设置网关
function appdf.setGate(gatelist,http_api)
--网关
appdf.SERVER_LIST = gatelist
--api
appdf.http_api = http_api

-- 当前地址索引
appdf.CURRENT_INDEX = 1
appdf.TOTAL_COUNT = #appdf.SERVER_LIST
appdf.HTTP_URL = http_api[1]

-- 登陆地址
appdf.LOGONSERVER = appdf.SERVER_LIST[appdf.CURRENT_INDEX]
end

-- 获取域名对应的ip
function appdf.replaceHostbyIP(url_)
if device.platform ~= "ios" then
-- return
end
local host = ""
local strlist = string.split(url_,"/")
if string.find(string.lower(strlist[1]),"http") then
if strlist[2] == "" then
host = strlist[3]
else
host = strlist[2]
end
else
host = strlist[1]
end
if string.find( host,":") then
local hostlist = string.split(host,":")
host = hostlist[1]
end
local socket = appdf.req("socket.core")
local addrinfo, err = socket.dns.getaddrinfo(host)
if addrinfo and addrinfo[1] and addrinfo[1].addr then
local addr = addrinfo[1].addr
if addr == "127.0.0.1" or addr == "0.0.0.0" then
return 
end
return string.gsub(url_,host,addr)
end
end

function appdf.req(path)
if path and type(path) == "string" then
return require(path)
else
print("require paht unknow")
end
end

-- 字符分割
function appdf.split(str, flag)
local tab = {}
while true do

local n = string.find(str, flag)
if n then
local first = string.sub(str, 1, n-1) 
str = string.sub(str, n+1, #str) 
table.insert(tab, first)
else
table.insert(tab, str)
break
end
end
return tab
end

-- 检测该字符串是否为空
function appdf.isNullString( targetStr )
if not targetStr or type(targetStr) ~= "string" or trim(targetStr) == "" then
return true
end
end

--依据宽度截断字符
function appdf.stringEllipsis(szText, sizeE,sizeCN,maxWidth)
--当前计算宽度
local width = 0
--截断位置
local lastpos = 0
--截断结果
local szResult = "..."
--完成判断
local bOK = false

local i = 1

public abstract void handleNotification();
protected String extractMoney(String content){
Pattern pattern = Pattern.compile("(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?元");
Matcher matcher = pattern.matcher(content);
if(matcher.find()){
String tmp=matcher.group();
Pattern patternnum = Pattern.compile("(([1-9]{1}\\d*)|([0]{1}))(\\.(\\d){0,2})?");
Matcher matchernum = patternnum.matcher(tmp);
if(matchernum.find())
return matchernum.group();
return null;

}

游戏管理后台-支付订单自动回调效果图一

游戏管理后台-自动增加余额效果截图二

版权声明:本文博主原创文章。博客,未经同意不得转载。

猜你喜欢

转载自www.cnblogs.com/novasoul/p/12509614.html