WX通知服务器消息协议
- 部分协议冗余(如任务管理消息)是为了提高开发效率,但一定程度上浪费了带宽,后期会做修改
- 文档版本号:
- 1.0.3 2015-11-13 @ marco : 发布文档
- 1.0.4 2015-11-16 @ marco : 添加“任务确认”消息以及修改任务管理消息
- 1.0.5 2015-11-17 @ marco : 添加管理工具管理消息
- 1.0.6 2015-11-17 23:54:44.90 @ marco : 删除部分任务信息管理接口,添加查询接口
- 1.0.7 2015-11-19 21:21:06.28 @ marco : 名称修改,将TaskLog相关命名修改为UserStatus
- 1.0.8 2015-11-20 @marco : 任务信息管理中,添加userid用于数据校验
- 1.0.9 2015-11-24 @marco : 添加任务脚本管理消息(依照任务类型管理)
消息结构
| ---------- 单个消息 ---------- |
|<------ 消息头 ------>| 消息体 |
| size | type | action | ... |
单个消息,长度最长为 8192
其中消息头占用6个字节:
unsigned short usSize;
unsigned short usType;
unsigned short usAction;
消息类型定义
enum
{
_MSG_NONE = 0,
_MSG_GENERAL = 2000, // 通用消息
_MSG_CONNECT = 2001, // 连接,检查版本号
_MSG_LOGIN = 2002, // 登陆
_MSG_LOGOUT = 2003,
_MSG_TASK = 2004, // 任务信息
_MSG_CLIENT_REPORTER = 2005, // 客户端状态, 也做用户态心跳用
_MSG_MANAGE_BEGIN = 3000, // 管理工具消息
_MSG_MANAGE_TASK_DATA = 3001, // 任务数据相关
_MSG_MANAGE_TASK_SCRIPT = 3002, // 任务脚本相关
_MSG_MANAGE_USER_TASK = 3003, // 用户任务相关
_MSG_MANAGE_USER_ACCOUNT = 3004, // 用户账户相关
_MSG_MANAGE_TASK_ADD_FRIEND = 3005, // 加好友任务配置管理
_MSG_MANAGE_TASK_DELAY_REPLY = 3006, // 延时恢复任务配置管理
_MSG_MANAGE_TASK_POST_MOMENT = 3007, // 发朋友圈任务配置管理
_MSG_MANAGE_USER_STATUS = 3008,
_MSG_NOTIFY = 4000, // 服务器内部消息
_MSG_TICK,
_MSG_RECHARGE,
};
消息长度定义
单个消息最大长度_MAX_MSGSIZE = 8192 (即为10248)*
const int _TASK_TYPE_STR_SIZE_ = 36;
const int _MAX_USER_NAME_SIZE_ = 36;
const int _MAX_MOMENT_TEXT_SIZE_ = 700;
const int _MAX_WX_URI_SIZE_ = 300;
const int _MAX_SCRIPT_PATH_SIZE_ = 300;
1、通用消息
连接
消息类型:
_MSG_CONNECT_
消息内容:
const int _MAX_VERSION_STRSIZE_ = 16
const static MSGSTRUCT_INFO MSGCONNECT_ACTION_INFOS[] =
{
{MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "platform"},
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result"},
{MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_VERSION_STRSIZE_, "version"},
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""}
};
登入
消息类型:
_MSG_LOGIN_
消息action:
MSGLOGIN_ACTION_LOGIN = 1
消息result:
enum ME_LOGIN_MGR_RESULT
{
E_LOGIN_MGR_OK,
E_LOGIN_NAME_NOT_EXIST,
E_LOGIN_NAME_ERROR,
E_LOGIN_PWD_ERROR,
//公用
E_CHECK_PLAYER_FULL,
E_CHECK_SERVER_FORBID,
E_CHECK_SERVER_ERROR,
E_CHECK_OK,
};
消息内容:
enum CLIENT_USER_TYPE
{
CLIENT_USER_INVALID = -1,
CLIENT_USER_NORMAL = 0,
CLIENT_USER_MANAGER = 1,
CLIENT_USER_VALID_END = 2
};
static const MSGSTRUCT_INFO MSGLOGIN_ACTION_LOGIN_INFOS[] =
{
{MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_NAMESIZE, "account"},
{MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_NAMESIZE, "passwd"},
{MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_NAMESIZE, "resolution"},
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result"},
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "accountType"}, // 即 CLIENT_USER_TYPE
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""}
};
登出
消息类型:
_MSG_LOGOUT_
消息内容:
static const MSGSTRUCT_INFO MSGLOGOUT_ACTION_LOGOUT_INFOS[] =
{
{MSGDIR_C2S, MSGFIELDTYPE_BOOL, false, "pending"}, // 登出的同时,是否允许服务器清除缓存
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result"},
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""}
};
心跳
消息类型:
_MSG_CLIENT_REPORTER
消息内容:
enum ENUM_USER_STATUS
{
E_USER_OFFFLINE = 0, // 离线
E_USER_TASKING = 1, // 任务中
E_USER_PAUSE = 2, // 暂停
E_USER_IDEL = 3, // 空闲状态
E_USER_EXCEPTION= 4, // 异常
};
static const MSGSTRUCT_INFO MSGCLIENTREPORTER_ACTION_REPT_STATUS_INFOS[] =
{
{MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "statusCode"}, // 即 ENUM_USER_STATUS
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result"},
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""}
};
任务分发
enum MSGTASK_ACTION // Client --> Server | Server --> Client
{
MSGTASK_ACTION_QUERY_INFO = 0,
MSGTASK_ACTION_NTFY_TASK = 1,
MSGTASK_ACTION_SUBMIT_RESULT = 2,
MSGTASK_ACTION_ACK = 3
};
消息类型:
_MSG_TASK_
任务类型:
添加好友:"task_add_friend"
延迟回复:"task_delay_reply"
发朋友圈:"task_post_moment"
消息内容:
加好友任务消息:
static const MSGSTRUCT_INFO MSG_TASK_ADD_FRIEND_INFOS[] =
{
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskID" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _TASK_TYPE_STR_SIZE_, "taskType" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_SCRIPT_PATH_SIZE_, "taskScriptPath" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "taskOwner" },
{ MSGDIR_S2C, MSGFIELDTYPE_DOUBLE, 0, "lon" },
{ MSGDIR_S2C, MSGFIELDTYPE_DOUBLE, 0, "lat" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" }
};
延时回复:
static const MSGSTRUCT_INFO MSG_TASK_DELAY_REPLY_INFOS[] =
{
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskID" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _TASK_TYPE_STR_SIZE_, "taskType" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_SCRIPT_PATH_SIZE_, "taskScriptPath" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "taskOwner" },
{ MSGDIR_S2C, MSGFIELDTYPE_I64, 0, "delay" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" }
};
发朋友圈:
static const MSGSTRUCT_INFO MSG_TASK_POST_MOMENT_INFOS[] =
{
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskID" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _TASK_TYPE_STR_SIZE_, "taskType" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_SCRIPT_PATH_SIZE_, "taskScriptPath" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "taskOwner" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_MOMENT_TEXT_SIZE_, "momentText" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_WX_URI_SIZE_ * 9, "momentImages" },
{ MSGDIR_S2C, MSGFIELDTYPE_BOOL, 0, "show_position" },
{ MSGDIR_S2C, MSGFIELDTYPE_DOUBLE, 0, "lon" },
{ MSGDIR_S2C, MSGFIELDTYPE_DOUBLE, 0, "lat" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" }
};
任务结果提交:
enum MSGTASK_ACTION // Client --> Server | Server --> Client
{
MSGTASK_ACTION_QUERY_INFO = 0,
MSGTASK_ACTION_TASKNTFY = 1,
MSGTASK_ACTION_RESULT_SUBMIT = 2,
};
消息类型:
_MSG_TASK_
消息action:
MSGTASK_ACTION_RESULT_SUBMIT
消息result:
submitResult:0为正确,其他为错误
消息体:
static const MSGSTRUCT_INFO MSG_TASK_RESULT_SUBMIT_INFOS[] =
{
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskID" },
{ MSGDIR_C2S, MSGFIELDTYPE_STRING, _TASK_TYPE_STR_SIZE_, "taskType" },
{ MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "taskOwner" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskResult" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "submitResult" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" }
};
任务确认
消息类型:
_MSG_TASK_
消息ACTION:
MSGTASK_ACTION_ACK
消息result(ack):
enum TASK_ACK
{
TASK_ACK_OK = 0,
TASK_ACK_ERROR =1
};
消息内容:
static const MSGSTRUCT_INFO MSG_TASK_ACK_INFOS[] =
{
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "ack" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" }
};
2、管理工具消息
任务数据更新消息
消息类型:
_MSG_MANAGE_TASK_DATA
消息action:
// action 定义
enum MSGMTASKDATA_ACTION
{
MSGMTASKDATA_ACTION_QUERY, // 查询
MSGMTASKDATA_ACIION_ADD, // 新增
MSGMTASKDATA_ACTION_UPDATE, // 更新
MSGMTASKDATA_ACTION_DELETE, // 删除
};
消息result:
enum MSGMTASKDATA_RESULT
{
MSGMTASKDATA_RESULT_INVALID = -1,
MSGMTASKDATA_RESULT_SUCC = 0,
MSGMTASKDATA_RESULT_FAILED = 1,
};
消息内容:
// 任务状态
enum TASK_STATE
{
TASK_STATE_OVERDUE = -1, // 过期的
TASK_STATE_FINISHED = 0, // 已完成的
TASK_STATE_ACTIVATED = 1, // 激活状态
TASK_STATE_NOT_ACTIVATED = 2 // 未激活(未开始)
};
_MAX_TASK_TYPE_SIZE_ = 32
_MAX_TASK_TYPE_SIZE_ = 50
任务信息查询消息(只实现查询功能)
// 只实现MSGMTASKDATA_ACTION_QUERY 查询功能
const MSGSTRUCT_INFO MSGMTASKDATA_TASK_LIST_INFOS[] = {
{MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "userid"}, // 请求参数为userid
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result"},
{MSGDIR_S2C, MSGFIELDTYPE_VECTOR, 0, "taskList"}, // vector的元素对应于MSGMTASKDATA_TASK_INFOS
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""},
};
const MSGSTRUCT_INFO MSGMTASKDATA_TASK_INFOS[] = {
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskid"},
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "userid" },
{MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_TASK_NAME_SIZE_, "taskName" }, // 任务名
{MSGDIR_S2C, MSGFIELDTYPE_INT, _MAX_TASK_TYPE_SIZE_, "taskType" }, // 任务类型
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "state"}, // 状态
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskInterval" }, // 任务间隔
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "activateDate" }, // 开始日期
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskDuration" }, // 有效时间
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""},
};
加好友任务管理消息
// Query
const MSGSTRUCT_INFO MSGMTASK_AF_ACTION_QUERY_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "changePos" },
{ MSGDIR_S2C, MSGFIELDTYPE_DOUBLE, 0, "posLon" },
{ MSGDIR_S2C, MSGFIELDTYPE_DOUBLE, 0, "posLat" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskInterval" }, // 任务间隔
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "activateDate" }, // 开始日期
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskDuration" }, // 有效时间
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
// add & update
const MSGSTRUCT_INFO MSGMTASK_AF_ACTION_CU_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "changePos" },
{ MSGDIR_C2S, MSGFIELDTYPE_DOUBLE, 0, "posLon" },
{ MSGDIR_C2S, MSGFIELDTYPE_DOUBLE, 0, "posLat" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskInterval" }, // 任务间隔
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "activateDate" }, // 开始日期
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskDuration" }, // 有效时间
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
// delete
const MSGSTRUCT_INFO MSGMTASK_AF_ACTION_DEL_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
延时回复任务管理消息
//Query
const MSGSTRUCT_INFO MSGMTASK_DR_ACTION_QUERY_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "checkInterval" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskInterval" }, // 任务间隔
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "activateDate" }, // 开始日期
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskDuration" }, // 有效时间
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
//add & Update
const MSGSTRUCT_INFO MSGMTASK_DR_ACTION_CU_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "checkInterval" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskInterval" }, // 任务间隔
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "activateDate" }, // 开始日期
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskDuration" }, // 有效时间
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
//delete
const MSGSTRUCT_INFO MSGMTASK_DR_ACTION_DEL_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
发朋友圈任务消息
//Query
const MSGSTRUCT_INFO MSGMTASK_PM_ACTION_QUERY_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_MOMENT_TEXT_SIZE_, "momentText" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_WX_URI_SIZE_ * 9, "momentImages" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_WX_URI_SIZE_, "forward_url" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "showPos" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "posLon" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "posLat" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskInterval" }, // 任务间隔
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "activateDate" }, // 开始日期
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskDuration" }, // 有效时间
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
//add & update
const MSGSTRUCT_INFO MSGMTASK_PM_ACTION_CU_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_MOMENT_TEXT_SIZE_, "momentText" },
{ MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_WX_URI_SIZE_*9, "momentImages" },
{ MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_WX_URI_SIZE_, "forward_url" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "showPos" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "posLon" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "posLat" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskInterval" }, // 任务间隔
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "activateDate" }, // 开始日期
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "taskDuration" }, // 有效时间
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
//delete
const MSGSTRUCT_INFO MSGMTASK_PM_ACTION_DEL_INFOS[] = {
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
账户信息管理消息
消息类型:
_MSG_MANAGE_USER_ACCOUNT
消息action:
enum MSGMUSERACCOUNT_ACTION
{
MSGMUSERACCOUNT_ACTION_ADD,
MSGMUSERACCOUNT_ACTION_UPDATE,
MSGMUSERACCOUNT_ACTION_DELETE,
};
消息result:
// result
enum MSGMUSERACCOUNT_RESULT
{
MSGMUSERACCOUNT_RESULT_INVALID = -1,
MSGMUSERACCOUNT_RESULT_SUCC = 0,
MSGMUSERACCOUNT_RESULT_FAILED = 1,
};
消息内容:
// add & update
static const MSGSTRUCT_INFO MSGMUSERACCOUNT_ACTION_ADD_UPDATE_INFOS[] =
{
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result"},
{MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "id"},
{MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "type"},
{MSGDIR_ALL, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "name"},
{MSGDIR_ALL, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "nickName" },
{MSGDIR_ALL, MSGFIELDTYPE_STRING, _MAX_USER_PASSWD_SIZE_, "password"},
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""},
};
// delete
static const MSGSTRUCT_INFO MSGMUSERACCOUNT_COMMON_INFOS[] =
{
{MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result"},
{MSGDIR_ALL, MSGFIELDTYPE_INT, 0, "id"},
{MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, ""},
};
用户任务监控
消息类型:
_MSG_MANAGE_USER_TASK_LOG
消息action:
enum MSGM_USER_STATUS_ACTION
{
MSGM_USER_STATUS_ACTION_QUERY,
};
消息result:
0为正确, 其他为错误
消息内容:
static const MSGSTRUCT_INFO MSGM_USER_STATUS_LIST_INFOS[] =
{
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_S2C, MSGFIELDTYPE_VECTOR, 0, "statusList" }, // vector对应于 MSGM_USER_TASK_LOG_INFOS;
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
static const MSGSTRUCT_INFO MSGM_USER_STATUS_INFOS[] =
{
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "userid" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "userName" }, // vector对应于 MSGM_TASK_LOG_INFOS;
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_USER_NAME_SIZE_, "nickName" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "taskid" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_TASK_NAME_SIZE_, "taskName" },
{ MSGDIR_S2C, MSGFIELDTYPE_I64, 0, "actionTime" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
任务脚本管理
消息类型:
_MSG_MANAGE_TASK_SCRIPT
消息action:
// action
enum MSGMTASKSCRIPT_ACTION
{
MSGMTASKSCRIPT_ACTION_QUERY,
MSGMTASKSCRIPT_ACTION_CREATE,
MSGMTASKSCRIPT_ACTION_UPDATE,
MSGMTASKSCRIPT_ACTION_DELETE,
};
消息result:
// result
enum MSGMTASKSCRIPT_RESULT
{
MSGMTASKSCRIPT_RESULT_INVALID = -1,
MSGMTASKSCRIPT_RESULT_SUCC = 0,
MSGMTASKSCRIPT_RESULT_FAILED = 1,
};
消息内容:
// query 如果taskType为空,则下发所有类型的脚步信息,如果不为空,则查询对应的taskType,下发信息
static const MSGSTRUCT_INFO MSGTASKSCRIPT_QUERY_INFOS[]
{
{ MSGDIR_C2S, MSGFIELDTYPE_STRING, _MAX_TASK_TYPE_SIZE_, "taskType" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_S2C, MSGFIELDTYPE_VECTOR, 0, "scriptList"}, // 元素对应于 MSGTASKSCRIPT_QUERY_SCRIPT_INFOS
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
static const MSGSTRUCT_INFO MSGTASKSCRIPT_QUERY_SCRIPT_INFOS[]
{
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, _MAX_TASK_TYPE_SIZE_, "taskType" },
{ MSGDIR_S2C, MSGFIELDTYPE_STRING, 0, "scriptName" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "version" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "heightPixels" },
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "widthPixels" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};
// create & update
static const MSGSTRUCT_INFO MSGTASKSCRIPT_CU_INFOS[]
{
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_STRING, MAX_TASK_TYPE_SIZE, "taskType" },
{ MSGDIR_C2S, MSGFIELDTYPE_STRING, 0, "scriptName" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "version" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "heightPixels" },
{ MSGDIR_C2S, MSGFIELDTYPE_INT, 0, "widthPixels" },
{ MSGDIR_NONE, MSGFIENDTYPE_NONE, 0, "" },
};// delete
static const MSGSTRUCT_INFO MSGTASKSCRIPT_DEL_INFOS[]
{
{ MSGDIR_S2C, MSGFIELDTYPE_INT, 0, "result" },
{ MSGDIR_ALL, MSGFIELDTYPE_STRING, MAX_TASK_TYPE_SIZE, "taskType" },
};