Skip to content

Commit 5464e8b

Browse files
committed
update:cal lua script
1 parent bdcdd8b commit 5464e8b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

XEngine_Release/XEngine_LuaPlugin/ModulePlugin_Calculation.lua

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ end
1717

1818
function PluginCore_Call(lpszStrUrl, nListCount, lpszMsgBuffer, nMsgLen)
1919
if nListCount < 3 then
20-
return false
20+
PInt_HTTPCode = 200
21+
PtszMsgBuffer = "{\"code\":1001,\"msg\":\"request parament is incorrent\"}"
22+
PInt_MsgLen = #PtszMsgBuffer
23+
return true
2124
end
2225

2326
local nValue = 0
@@ -34,13 +37,18 @@ function PluginCore_Call(lpszStrUrl, nListCount, lpszMsgBuffer, nMsgLen)
3437
nValue = HDRObjectValue1[2] * HDRObjectValue2[2]
3538
elseif '3' == HDRObjectType[2] then
3639
nValue = HDRObjectValue1[2] / HDRObjectValue2[2]
40+
else
41+
PInt_HTTPCode = 200
42+
PtszMsgBuffer = "{\"code\":1002,\"msg\":\"type does not support\"}"
43+
PInt_MsgLen = #PtszMsgBuffer
44+
return true
3745
end
3846

3947
PInt_HTTPCode = 200
40-
PtszMsgBuffer = "{\"code\":0,\"value\":" .. nValue .. "}"
48+
PtszMsgBuffer = "{\"code\":0,\"msg\":\"success\",\"data\":{\"nType\":" .. HDRObjectType[2] .. ",\"nValue1\":" .. HDRObjectValue1[2] .. ",\"nValue2\":" .. HDRObjectValue2[2] .. ",\"nCal\":" .. nValue .. "}}"
4149
PInt_MsgLen = #PtszMsgBuffer
4250

4351
return true
4452
end
4553

46-
-- PluginCore_Call1("param1=1&param2=2&param3=0",3,"hello",5)
54+
-- PluginCore_Call("param1=1&param2=2&param3=0",3,"hello",5)

0 commit comments

Comments
 (0)