无标题文章

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" },
    };

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 205,386评论 6 479
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,939评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,851评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,953评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,971评论 5 369
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,784评论 1 283
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,126评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,765评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,148评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,744评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,858评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,479评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,080评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,053评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,278评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,245评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,590评论 2 343

推荐阅读更多精彩内容

  • 标签 如果要配置的标签,那么必须要先配置标签,代表的包的概念。 包含的属性 name包的名称,要求是唯一的,管理a...
    偷偷得路过阅读 1,312评论 0 0
  • 第5章 引用类型(返回首页) 本章内容 使用对象 创建并操作数组 理解基本的JavaScript类型 使用基本类型...
    大学一百阅读 3,211评论 0 4
  • 转至元数据结尾创建: 董潇伟,最新修改于: 十二月 23, 2016 转至元数据起始第一章:isa和Class一....
    40c0490e5268阅读 1,678评论 0 9
  • 概述 这篇文章中,我不会说多线程是什么、线程和进程的区别、多线程有什么用,当然我也不会说什么是串行、什么是并行等问...
    hashakey阅读 292评论 0 0
  • 我想,对于大多数女人来说,找老公的标准,应该都无外乎高大,帅气,温柔,体贴,有钱……吧。 这样的男人确实很讨女人喜...
    一股妖风阅读 252评论 0 1