This commit is contained in:
2020-08-01 17:55:18 +08:00
parent 29a8a1dae3
commit 4435098171
160 changed files with 21247 additions and 2405 deletions

View File

@@ -22,14 +22,14 @@ end
NetProto.setSeverDev = function()
host = "app.ttf-cti.com"
port = 29004
port = 29000
baseUrl = joinStr("http://", host, ":", port, "/open_api/")
socketUrl = joinStr("ws://", host, ":", port, "/tr_socket/websocket/")
end
NetProto.setSeverLocal = function()
host = "192.168.1.100"
port = 29004
host = "192.168.1.11"
port = 29000
baseUrl = joinStr("http://", host, ":", port, "/open_api/")
socketUrl = joinStr("ws://", host, ":", port, "/tr_socket/websocket/")
end
@@ -122,6 +122,49 @@ local onFailedSend = function(content, params)
Utl.doCallback(failedCallback, nil, orgs)
end
-- 上传头像
NetProto.uploadUserHeadIcon = function(path, finishCallback)
NetProto._uploadFile("updateUserImg", path, "", finishCallback)
end
NetProto.uploadFile = function(path, uploadPath, finishCallback)
NetProto._uploadFile("uploadFile", path, uploadPath, finishCallback)
end
NetProto._uploadFile = function(methord, path, uploadPath, finishCallback)
local params = {
operator = NetProto.loginNo,
uploadPath = uploadPath
}
local url = joinStr(baseUrl, methord, "?", wrapSendData(params))
local www =
WWWEx.uploadFile(
url,
NetProto.httpHeader,
"uploadFile",
Path.GetFileName(path),
File.ReadAllBytes(path),
CLAssetType.text,
function(content, orgs)
content = json.decode(content)
if content.success then
Utl.doCallback(finishCallback, content)
else
printe(content.message)
Utl.doCallback(finishCallback, content)
end
end,
function(content, orgs)
Utl.doCallback(finishCallback, nil)
end,
nil,
true,
1
)
return www
end
NetProto.sendGet = function(cmd, map, callback, failedCallback, orgs, _baseUrl)
if isNilOrEmpty(NetProto.sign) and (cmd ~= NetProto.cmds.getTokenForAPI) then
MyUtl.toastW("与服务器失去联络,请重试!")
@@ -263,6 +306,13 @@ NetProto.cmds = {
delCustomerInfo = "delCustomerInfo", -- 删除客户
loadProductType = "loadProductType", -- 产品类型
pageGHQueryList = "pageGHQueryList", -- 公海列表
getFromGH = "getFromGH", -- 获取客户
list_followUp_tasks = "list_followUp_tasks", --预约记录
personal_data_query = "personal_data_query", -- 个人信息
updateUserInfo = "updateUserInfo", -- 更新用户信息
updateUserPhone = "updateUserPhone", -- 更新用户手机号
get_customerById = "get_customerById", -- 取得客户
readNotice = "readNotice", -- 已读公告
}
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
@@ -554,7 +604,7 @@ NetProto.send.create_followUp_record = function(followUpRecordJson, callback, ti
content.action = NetProto.cmds.create_followUp_record
followUpRecordJson.loginNo = NetProto.loginNo
followUpRecordJson.groupId = NetProto.groupId
followUpRecordJson.recordingTime = DateEx.nowString()
followUpRecordJson.recordingTime = followUpRecordJson.recordingTime or DateEx.nowString()
content.followUpRecordJson = followUpRecordJson
NetProto.sendSocket(content, callback, timeOutSec)
end
@@ -649,5 +699,61 @@ NetProto.send.pageGHQueryList = function(filters, queryKey, page, callback, time
content.current_page = page
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.getFromGH = function(content, callback, timeOutSec)
content = content or {}
content.action = NetProto.cmds.getFromGH
content.groupId = NetProto.groupId
-- content.ids = ids
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.list_followUp_tasks = function(filters, queryKey, page, callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.list_followUp_tasks
content.groupId = NetProto.groupId
content.filters = filters
content.keywords = queryKey
content.current_page = page
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.personal_data_query = function(callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.personal_data_query
content.groupId = NetProto.groupId
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.updateUserInfo = function(content, callback, timeOutSec)
content = content or {}
content.action = NetProto.cmds.updateUserInfo
content.groupId = NetProto.groupId
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.updateUserPhone = function(content, callback, timeOutSec)
content = content or {}
content.action = NetProto.cmds.updateUserPhone
content.groupId = NetProto.groupId
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.get_customerById = function(custId, callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.get_customerById
content.custId = custId
content.groupId = NetProto.groupId
NetProto.sendSocket(content, callback, timeOutSec)
end
NetProto.send.readNotice = function(id, callback, timeOutSec)
local content = {}
content.action = NetProto.cmds.readNotice
content.id = id
content.groupId = NetProto.groupId
NetProto.sendSocket(content, callback, timeOutSec)
end
------------------------------------------------------
return NetProto