This commit is contained in:
2020-07-14 22:04:03 +08:00
parent e54411e2c2
commit a47cabede2
119 changed files with 5115 additions and 1061 deletions

View File

@@ -8,15 +8,12 @@ NetProto.send = {}
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
local host = "47.111.20.34"
local host = "app.ttf-cti.com" -- "47.111.20.34"
local port = 29004
-- local host = "192.168.1.126"
-- local port = 29000
-- local baseUrl = "http://app.ttf-cti.com:29000/open_api/"
local baseUrl = joinStr("http://", host, ":", port, "/open_api/")
-- local baseUrl2 = "http://47.111.20.34:29004/open_api/"
-- local socketUrl = "ws://app.ttf-cti.com:29000/tr_socket/websocket/"
-- local socketUrl = "ws://47.111.20.34:29004/tr_socket/websocket/"
-- local baseUrl = "http://47.111.20.34/home/open_api/"
local socketUrl = joinStr("ws://", host, ":", port, "/tr_socket/websocket/")
---@type Dist.SpringWebsocket.Client
@@ -241,8 +238,9 @@ NetProto.cmds = {
update_customer = "update_customer", -- 更新客户信息
save_customer = "save_customer", -- 新建客户
create_followUp_record = "create_followUp_record", -- 新建跟进
load_wfTicket_Settings = "load_wfTicket_Settings", -- 工单配置信息
load_wfTicket_Settings = "load_WfTicket_Settings", -- 工单配置信息
selectProductInfo = "selectProductInfo", -- 商品列表
createWfInfo = "createWfInfo", -- 创建订单
}
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
@@ -296,9 +294,9 @@ end
---@param frame Dist.SpringWebsocket.StompFrame
NetProto.OnReceiveStompMsg = function(frame)
if isDebug then
print(frame.Code, frame.Content)
end
-- if isDebug then
-- print(frame.Code, frame.Content)
-- end
if frame.Code == StompStatus.OPENSERVER then
socket:Connect(nil, NetProto.OnReceiveStompMsg)
elseif frame.Code == StompStatus.CONNECTED then
@@ -336,6 +334,10 @@ NetProto.OnReceiveStompMsg = function(frame)
end
end
end
if isDebug then
printw(cmd, frame.Content)
end
if cmd then
doCallbackSocket(content)
dispatch(content, {cmd = cmd})
@@ -362,6 +364,7 @@ NetProto.doReconnectSocket = function()
NetProto.reconnectTimes = NetProto.reconnectTimes or 0
NetProto.isReconnect = true
if NetProto.reconnectTimes > 1 then
NetProto.reconnectTimes = 0
-- 重连失败提示
CLUIUtl.showConfirm("服务器连接失败,请重试", NetProto.doReconnectSocket)
else
@@ -541,12 +544,27 @@ NetProto.send.load_wfTicket_Settings = function(callback, timeOutSec)
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.selectProductInfo = function(callback, timeOutSec)
NetProto.send.selectProductInfo = function(searchKey, page, callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.selectProductInfo
content.loginNo = NetProto.loginNo
content.groupId = NetProto.groupId
content.current_page = page
content.search = searchKey
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.createWfInfo = function(workFlowInfo, callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.createWfInfo
local user = DBUser.getUserById(NetProto.loginNo)
content.wfStatus = "正常工单"
content.loginName = user.loginName
content.loginNo = NetProto.loginNo
content.groupId = NetProto.groupId
content.workFlowInfo = workFlowInfo
NetProto.sendSocket(content, callback, timeOutSec)
end
------------------------------------------------------
return NetProto