Skip to content

Commit

Permalink
合并主支
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaobangyu committed Oct 7, 2023
2 parents dc73da0 + 41dd4d6 commit f6b830e
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 384 deletions.
3 changes: 3 additions & 0 deletions bin/accord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ set_env("QUANTA_MODE", "3")

--协议测试
set_env("QUANTA_ACCORD_HTTP", "127.0.0.1:10401")

--服务器列表API
set_env("QUANTA_SRVLIST_API", "http://10.98.8.100:18080/server_mgr/query")
235 changes: 45 additions & 190 deletions server/robot/accord/src/bundle.lua

Large diffs are not rendered by default.

227 changes: 41 additions & 186 deletions server/robot/accord/src/index.html

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions server/robot/accord/src/net_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var NetUtils = {
this.http = http
},
post: function (name, args, callback) {
this.http.post('/'+name, args).then(function (response) {
this.http.post(name, args).then(function (response) {
var data = response.data || {}
if(response.status == 200){
if(callback){
Expand All @@ -15,12 +15,12 @@ var NetUtils = {
console.error("[Request][post] fail name(%s) args(%s) status(%s)", name, args, response.status)
}
}, function (response) {
callback(false, data)
callback(false, null)
console.error("[Request][post] fail name(%s) args(%s) status(%s)", name, args, response.status)
});
},
get: function(name, args, callback){
this.http.get('/'+name, args).then(function(response){
this.http.get(name, args).then(function(response){
var data = response.data || {}
if(response.status == 200){
if(callback){
Expand All @@ -31,7 +31,7 @@ var NetUtils = {
console.error("[Request][get] fail name(%s) args(%s) status(%s)", name, args, response.status)
}
}, function (response) {
callback(false, data)
callback(false, null)
console.error("[Request][get] fail name(%s) args(%s) status(%s)", name, args, response.status)
});
}
Expand Down
2 changes: 1 addition & 1 deletion server/robot/module/login.lua
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function LoginModule:choose_role_req()
}
local ok, res = self:call("NID_LOGIN_ROLE_CHOOSE_REQ", req_data)
if self:check_callback(ok, res) then
log_warn("[LoginModule][choose_role_req] robot:{}, ok={}, res={}", self:get_title(), ok, res)
log_warn("[LoginModule][choose_role_req] robot:{}, ok={}, res={} req_data={}", self:get_title(), ok, res, req_data)
return false
end
self.lobby = res.lobby
Expand Down
1 change: 1 addition & 0 deletions server/robot/module/session.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function SessionModule:call(cmdid, data)
if self.client then
local srv_type = self:conv_type(cmdid)
local ok, resp = self.client:call(cmdid, data, srv_type)
log_debug("call cmdid:{} data:{} srv_type:{} ok:{} resp:{}",cmdid, data, srv_type, ok, resp)
if srv_type == 0 and cmdid ~= 1001 then
if resp then
resp.req_cmd_id = cmdid
Expand Down
5 changes: 4 additions & 1 deletion server/robot/msg_mgr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local log_debug = logger.debug
local pb_enum_id = protobuf.enum
local supper = string.upper
local tunpack = table.unpack
local tcopy = qtable.copy

local protobuf_mgr = quanta.get("protobuf_mgr")

Expand Down Expand Up @@ -99,12 +100,14 @@ function MsgMgr:args_convert(cmd_id, data)
if cmd_id == 1001 then
return
end
local c_data = tcopy(data)
-- 获取协议结构
local struct = self:msg_struct(cmd_id)
-- 转换参数字段
if struct then
self:convert_fields(struct, data)
self:convert_fields(struct, c_data)
end
return c_data
end

quanta.msg_mgr = MsgMgr()
Expand Down
4 changes: 2 additions & 2 deletions server/robot/robot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ end
function Robot:push_message(cmd_id, msg)
log_debug("recv server msg:{} {}",cmd_id, msg)
msg.cmd_id = cmd_id
msg_mgr:args_convert(cmd_id, msg)
self.messages:push(msg)
local c_msg = msg_mgr:args_convert(cmd_id, msg)
self.messages:push(c_msg)
end

function Robot:get_messages()
Expand Down

0 comments on commit f6b830e

Please sign in to comment.