逍遥西游后台的gamesign数值详细解说
部分后台可能出现后台发送物品客户端不到账情况
那么是因为什么原因呢
那是因为
gamesign数值 后台和服务端不匹配所导致的
那么我们就要去检查我们的后台和服务端的gamesign数值
服务端位置在:/home/nomogaserver/paycenter/src/gamelogicw/rlchnl/
quick.lua 这个文件内所记录的就是gamesign数值
由于原始文件内的gamesign数值 比较混淆
不容易修改和查找
那么我们就提供了一份可供修改的
quick.lua 文件
文件内容:
01.
02.local httpc = require "http.httpc"
03.local cjson = require "cjson"
04.local md5 = require "md5"
05.local crypt = require "crypt"
06.requiregamelogic "objects.payordermanager"
07.requiregamelogic "objects.gmcmdmanager"
08.require "util.sysutil"
09.local skynet = require "skynet"
10.local tableutil = require "util.tableutil"
11.
12.
13.--------------------------------------------------------------------------------------
14.local xml = require("xmlSimple").newParser()
15.require('bit32')
16.require('string')
17.
18.function getByte(data, flag)
19. local array = {}
20. local lens = string.len(data)
21. if (flag == false)
22. then
23. for i=1,lens do
24. array = string.byte(data, i)
25. end
26. return array
27. else
28. for i=1,lens do
29. array[i-1] = string.byte(data, i)
30. end
31. end
32. return array,lens
33.end
34.
35.function getChars(bytes)
36. local array = {}
37. for key, val in pairs(bytes) do
38. array[key] = string.char(val)
39. end
40. return array
41.end
42.
43.function encryptData(data, keys)
44. local result = ""
45. local dataArr = getByte(data, false)
46. local keyArr,keyLen = getByte(keys, true)
47. for index,value in pairs(dataArr) do
48. result = result.."@"..tostring((0xFF and value) + (0xFF and keyArr[(index-1) % keyLen]))
49. end
50. return result
51.end
52.
53.function decryptData(data, keys)
54. local result = ""
55. local dataArr = string.split(data, '@')
56. local keyArr,keyLen = getByte(keys, true)
57. for index,value in pairs(dataArr) do
58. bytes = tonumber(value) - (0xFF and keyArr[(index-1) % keyLen])
59. result = result..string.char(bytes)
60. end
61. return result
62.end
63.
64.function string.split( str,reps )
65. local resultStrList = {}
66. string.gsub(str,'[^'..reps..']+',function ( w )
67. table.insert(resultStrList,w)
68. end)
69. return resultStrList
70.end
71.--------------------------------------------------------------------------------------
72.
73.
74.
75.if not rlchnl_quick then
76. rlchnl_quick = {
77. typeflag = "quick", -- 这个flag会与支付数据一起落地,不能修改
78. order_tablename = "quick_pay_order",
79. testmode = false,
80. basedt = {},
81. gameId2Flag = {},
82. payedOrderCache = {
83. --[[
84. [gf/gameflag] = {
85. [kid] = {
86. [acctId] = {
87. bodyObj,bodyObj,bodyObj,...
88. }
89. },
90. },
91. ]]
92. },
93. urls = {
94. logincheckf = "sdk.g.uc.cn",
95. logincheckt = "sdk.test4.g.uc.cn",
96. },
97. payordermanager = object_payordermanager.new(),
98. gmcmdmanager = object_gmcmdmanager.new(),
99. }
100.end
101.
102.
103.skynet.error("string:urlencode" .. string.urlencode("gf=xiyou#kid=md_yios_1#rid=10022#gid=2#did=2"))
104.
105.rlchnl_quick.basedt.xiyou = {
106. apiKey = "4e1c27908606818f73df9620b7a778",
107. cpId = 41096,
108. gameId = 552521,
109.}
110.
111.--[[
112. 西游传奇在UC-SDK接入参数如下:
113. apiKey:4e1c27908606818f73df9620b7a7785c
114. cpId:41096
115. gameId:552521
116.
117. *了解参数及相关接口说明,请查看:http://doc.game.open.uc.cn/doc/detail/21#doc
118.
119.]]
120.
121.-----------------------------------------------------------------------------
122.
123.for gameflag,gdt in pairs(rlchnl_quick.basedt) do
124. rlchnl_quick.gameId2Flag[gdt.gameId] = gameflag
125.end
126.
127.function rlchnl_quick:getAccount(accountId)
128. local account = string.format("%s@quick",accountId)
129. return account
130.end
131.
132.function rlchnl_quick:init()
133. self.payordermanager.rlchnlObj = rlchnl_quick
134. self.payordermanager.tablename = "quick_pay_cache"
135. self.payordermanager.order_tablename = self.order_tablename
136. print("MD:",self.payordermanager)
137. self.payordermanager:loadPayedOrderCache()
138. self.gmcmdmanager.rlchnlObj = rlchnl_quick
139.end
140.
141.------------------------------------------------------------------------------
142.
143.function rlchnl_quick:genUniqueId()
144. local now = os.time()
145. if now ~= self.unique_sec then
146. self.unique_sec = now
147. self.unique_id = 1
148. else
149. self.unique_id = self.unique_id + 1
150. end
151. return self.unique_sec * 1000 + self.unique_id
152.end
153.
154.function rlchnl_quick:comfirmFinishOrder(kid,orderid,...)
155. rlchnl_init:comfirmFinishOrder(self,kid,orderid,...)
156.end
157.
158.--------------------------------------------------------------
159.function rlchnl_quick.nethttp_echo2(reqArgs,bodyObj)
160. return "nethttp_echo"
161.end
162.
163.function rlchnl_quick.nethttp_echo(reqArgs,bodyObj,bRedirect)
164. if bRedirect then
165. return false,rlchnl_quick.nethttp_echo2(reqArgs,bodyObj)
166. else
167. return rlchnl_quick.nethttp_echo2(reqArgs,bodyObj)
168. end
169.end
170.
171.
172.function rlchnl_quick.checksign()
173.
174.
175.end
176.
177.function rlchnl_quick.nethttp_payed2(reqArgs,bodyObj)
178.
179. local nSign = string.format("%s%s%s",
180. bodyObj.nt_data,
181. bodyObj.sign,
182. "fdgfdsg12321321321sd")
183. g_serverinfo:loggerex("quickpaytest","w before md5 nSign 2",nSign)
184. nSign = md5.sumhexa(nSign)
185. bodyObj.nSign = nSign
186. local bSignRs = false
187. if bodyObj.md5Sign == nSign then
188. bSignRs = true
189. else
190. g_serverinfo:loggerex("quickpaytest","w rlchnl_quick.nethttp_payed2 sign error",bodyObj)
191. return "sign error"..nSign
192. end
193.
194. local ff = decryptData(bodyObj.nt_data, "0244407911396383213237468493135538279")
195. g_serverinfo:loggerex("quickpaytest","xml data = ",ff)
196. local parsedXml = xmlarseXmlText(ff)
197. --g_serverinfo:loggerex("quickpaytest","w rlchnl_quick.nethttp_payed2 bodyObj= ",bodyObj)
198.
199. local bodyCache = {
200. data = {
201. orderid = parsedXml.quicksdk_message.message.order_no:value(),
202. username = parsedXml.quicksdk_message.message.channel_uid:value(),
203. gameid="2005",
204. roleid=parsedXml.quicksdk_message.message.channel_uid:value(),
205. serverid=0,
206. paytype=0,
207. amount=tonumber(parsedXml.quicksdk_message.message.amount:value()),
208. paytime=tonumber(os.time()),
209. attach = crypt.base64decode(parsedXml.quicksdk_message.message.extras_params:value()),
210. sign = bodyObj.md5Sign
211. }
212. }
213.
214. g_serverinfo:loggerex("quickpaytest","print xml data bodyCache", bodyCache)
215.
216. local oldBodyObj = g_gamedb:gdbQuery(rlchnl_quick.order_tablename,bodyCache.data.orderid)
217. if oldBodyObj then
218. if bSignRs then
219. return "SUCCESS"
220. else
221. return "fail"
222. end
223. else
224. local checkRs = false
225. if bSignRs then
226. local gf,kid,rid,gid = rlchnl_quick.payordermanager:parseCbInfo(bodyCache.data.attach)
227. if gf and kid and rid and gid then
228. rid = tonumber(rid)
229. gid = tonumber(gid)
230. --bodyObj.data = bodyObj or {}
231. bodyCache.data.rid = rid
232. bodyCache.data.cbinfo = {
233. gf = gf,
234. kid = kid,
235. rid = rid,
236. gid = gid,
237. sta = 0,
238. date = os.date("%Y-%m-%d") ,
239. time = os.date("%H:%M:%S") ,
240. }
241. rlchnl_quick.payordermanager:cacheBodyObj(rid,bodyCache,gf,kid,rid,gid)
242. checkRs = true
243. else
244. g_serverinfo:loggerex("quickpaytest","test",bodyCache)
245. end
246. else
247. end
248.
249. g_serverinfo:loggerex("quickpaytest","w 123 ",bodyCache)
250. g_gamedb:gdbInsert(rlchnl_quick.order_tablename,bodyCache.data.orderid,bodyCache)
251. g_serverinfo:loggerex("quickpaytest","w gbInsert data= ",bodyCache)
252. if bSignRs and checkRs then
253. g_serverinfo:loggerex("quickpaytest","w gbInsert success",bodyCache)
254. return "SUCCESS"
255. else
256. return "fail"
257. end
258. end
259.end
260.
261.function rlchnl_quick.nethttp_payed(reqArgs,bodyObj,bRedirect)
262. g_serverinfo:loggerex("quickpaytest","w rlchnl_quick.nethttp_payed", bodyObj)
263. if bRedirect then
264. local gf,kid,rid,gid,did = rlchnl_quick.payordermanager:parseCbInfo(bodyObj.data.callbackInfo)
265. did = tonumber(did or 0)
266. if did == 2 then
267. return true,rlchnl_quick.nethttp_payed2(reqArgs,bodyObj,bRedirect)
268. else
269. return false
270. end
271. else
272. return rlchnl_quick.nethttp_payed2(reqArgs,bodyObj,bRedirect)
273. end
274.end
275.
276.
277.function rlchnl_quick.nethttp_gmcmd(reqArgs,bodyObj)
278. --Form data
279. --[[
280. kid
281. cmd
282. sign
283. ]]
284.
285. local nSign = string.format("%s%s%s",
286. bodyObj.kid,
287. bodyObj.content,
288. "<font color="red">www.duozy.cn</font>")
289.
290. g_serverinfo:loggerex("quickgmcmdtest","w before md5 nSign 2",nSign)
291. nSign = md5.sumhexa(nSign)
292. bodyObj.nSign = nSign
293. local bSignRs = false
294. if bodyObj.sign == nSign or bodyObj.sign == "<font color="red">www.duozy.cn</font>" then
295. bSignRs = true
296. else
297. g_serverinfo:loggerex("quickgmcmdtest","w rlchnl_quick.nethttp_gmcmd sign error",bodyObj)
298. return "sign error05"
299. end
300.
301. g_serverinfo:loggerex("quickgmcmdtest","w rlchnl_quick.nethttp_gmcmd bodyObj= ",bodyObj)
302.
303. local server_kid_map = {
304. [1] = "md_s_1",
305. [2] = "md_s_2",
306. }
307.
308. local getsid = string.gmatch( bodyObj.kid, "%d+")
309. local mserverId = getsid()
310. --local server_kid = server_kid_map[tonumber(mserverId)]
311. local server_kid = "md_s_"..mserverId
312. --g_serverinfo:loggerex("quickgmcmdtest","w rlchnl_quick 123 ",mserverId, server_kid, server_kid_map)
313. if server_kid == nil then
314. return "gf error"
315. end
316.
317. local bodyCache = {
318. gf = "xiyou",
319. kid = server_kid,
320. cmd = bodyObj.content,
321. }
322.
323. g_serverinfo:loggerex("quickgmcmdtest","w rlchnl_quick.nethttp_gmcmd bodyCache= ",bodyCache)
324.
325.
326. --local bodyCache = {
327. -- gf = bodyObj.gf,
328. -- kid = bodyObj.kid,
329. -- cmd = bodyObj.content,
330. -- }
331.
332. rlchnl_quick.gmcmdmanager:cacheBodyObj(bodyCache)
333.
334. --[[local gfCache = rlchnl_dashi.gmCmdCache[bodyObj.gf]
335. if not gfCache then
336. gfCache = {}
337. end
338. local kidCache = gfCache[bodyObj.kid]
339. if not kidCache then
340. kidCache = {}
341. end
342. kidCache[#kidCache + 1] = bodyObj.content --]]
343. return "OK"
344.
345.end
346.
347.
348.----------------------------------------------------------------
349.local scmdMap = {
350. echo = rlchnl_quick.nethttp_echo,
351. payed = rlchnl_quick.nethttp_payed,
352. gmcmd = rlchnl_quick.nethttp_gmcmd,
353.}
354.
355.---------------------------------------------------------------
356.
357.function rlchnl_quick.nethttpcommand(subpath,reqArgs,bRedirect)
358. return net_reqnet.nethttpcommand_sub(subpath,reqArgs,scmdMap,bRedirect)
359.end
360.
361.return rlchnl_quick
362.
复制代码其中为修改
gamesign数值
大家可以直接搜索
进行替换也可以
由于编码的原因可能会导致轻微错乱
我会给打包一份单独的文件可供下载
普通带授权后台的
这种带授权的gamesign数值 修改位置为:/user/gmquery.php
这个文件gmquery.php 内修改 gamesign数值
01.$url = "http://134.175.49.56:8001/quick/gmcmd?sign=874804605&kid=md_s_1&content=" . $send;
复制代码
874804605代表
的是 gamesign数值
那么 繁华后台 所需要修改 gamesign数值的位置
18行的位置为gamesign数值
需要注意的就是 我们的后台 gamesign数值 一定要和服务端匹配
如果只修改后台的gamesign数值 是无法使用的
如果只修改服务端也是无法使用的
很多人都只修改了后台 所以没有办法使用
同理 内充的sign也需要统一
|