Skip to content

Commit 3bf8c73

Browse files
committed
added:time plugin of lua
1 parent 0a07ff9 commit 3bf8c73

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

XEngine_Release/XEngine_Config/XEngine_Config.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
"LogLeave":32
2020
},
2121
"XSql":{
22-
"SQLAddr":"192.168.1.12",
22+
"SQLAddr":"192.168.1.10",
2323
"SQLPort":3306,
24-
"SQLUser":"ruiyue",
25-
"SQLPass":"123123Ruiyue"
24+
"SQLUser":"root",
25+
"SQLPass":"123123aa"
2626
},
2727
"XApi":{
2828
"tszBankUrl":"https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?cardNo=%s&cardBinCheck=true",

XEngine_Release/XEngine_Config/XEngine_PluginLua.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"PluginEnable":true,
55
"PluginMethod":"cal",
66
"PluginFile":"./XEngine_LuaPlugin/ModulePlugin_Calculation.lua"
7+
},
8+
{
9+
"PluginEnable":true,
10+
"PluginMethod":"time",
11+
"PluginFile":"./XEngine_LuaPlugin/ModulePlugin_OSTime.lua"
712
}
813
]
914
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
function PluginCore_Init()
2+
return true
3+
end
4+
5+
function PluginCore_UnInit()
6+
end
7+
8+
function PluginCore_URLSqlit(str,reps)
9+
local resultStrList = {}
10+
string.gsub(str,'[^'..reps..']+',function (w)
11+
table.insert(resultStrList,w)
12+
end)
13+
return resultStrList
14+
end
15+
16+
function PluginCore_Call(lpszStrUrl, nListCount, lpszMsgBuffer, nMsgLen)
17+
if nListCount < 1 then
18+
PInt_HTTPCode = 200
19+
PtszMsgBuffer = "{\"code\":1001,\"msg\":\"request parament is incorrent\"}"
20+
PInt_MsgLen = #PtszMsgBuffer
21+
return true
22+
end
23+
24+
local tszValue = 0
25+
local HDRArray = PluginCore_URLSqlit(lpszStrUrl,'&')
26+
local HDRObjectType = PluginCore_URLSqlit(HDRArray[1],'=')
27+
28+
if '0' == HDRObjectType[2] then
29+
tszValue = os.date("%Y-%m-%d %H:%M:%S")
30+
elseif '1' == HDRObjectType[2] then
31+
tszValue = os.clock()
32+
elseif '2' == HDRObjectType[2] then
33+
tszValue = os.time()
34+
else
35+
PInt_HTTPCode = 200
36+
PtszMsgBuffer = "{\"code\":1002,\"msg\":\"type does not support\"}"
37+
PInt_MsgLen = #PtszMsgBuffer
38+
return true
39+
end
40+
41+
PInt_HTTPCode = 200
42+
PtszMsgBuffer = "{\"code\":0,\"msg\":\"success\",\"data\":{\"Time\":\"" .. tszValue .. "\"}}"
43+
PInt_MsgLen = #PtszMsgBuffer
44+
45+
return true
46+
end
47+
48+
-- PluginCore_Call("",0,"",0)

0 commit comments

Comments
 (0)