syntax = "proto3"; package saasapi; option go_package = "./saasapi"; // Cmds 批量命令 message SaasReq { UserIdType userid_type = 1; // 用户ID类型 string appid = 2; // 小程序/小游戏/公众号/视频号的appid repeated WriteCmd cmds = 3; // 批量写入命令 } // WriteCmd 上传命令 message WriteCmd { string userid = 1; // 用户ID WriteBytes write_bytes = 2; // byte区域 WriteUint32s write_uint32s = 3; // uint32区域 WriteFlagsWithExpire write_flags_with_expire = 4; // 标志位区域 bool is_full_overwrite = 5; // 是否全量覆盖 } // WriteBytes 写入byte message WriteBytes { bytes bytes = 1; // 写入的byte uint64 index_1 = 2; // 写入byte的索引值(0..63) uint64 index_2 = 3; // 写入byte的索引值(64..127) } // WriteUint32s 写入uint32 message WriteUint32s { repeated uint32 uint32s = 1; // 写入的uint32 uint64 index_1 = 2; // 写入uint32的索引值(0..63) //uint64 index_2 = 3; // 写入uint32的索引值(64..127) } // WriteFlagsWithExpire 写入标志位 message WriteFlagsWithExpire { repeated FlagWithExpire flags_with_expire = 1; // 写入的标志位 uint64 index_1 = 2; // 写入标志位的索引值 } // FlagWithExpire 标志位 message FlagWithExpire { bool flag = 1; // 标志位 bool default_flag = 2; // 默认值。超时后则回到默认值。 uint32 expire = 3; // 过期时间,为 0 则永不过期 } // UserIdType 用户 ID 类型 enum UserIdType { DeviceId = 0; // 设备号 OpenId = 1; // OpenId } message SaasRes { uint32 code = 1; // 返回码 string status = 2; // 返回信息 // repeated CmdsResItem cmd_res = 3; // 返回的命令 } /* //肯德基 Cmds { userid_type = OpenId, appid = "appid_kfc", [cmd{ userid = "kfc_openid", write_bytes{ write_bytes = [0x01, 0x01, 0x99], write_index_1 = 0B1011, //写入byte 区域的 0,2,3位置 write_index_2 = 0, }, write_uint32s{ write_uint32s = [4, 5, 6], write_index_1 = 0B0111, //写入uint32 区域的 0,1,2位置 }, write_flags_with_expire{ write_flags_with_expire = [true, 1753165024], //置true,过期时间为 2025-07-22 14:17:04 write_index_1 = 1<<6, //写入标志位 区域的 6 位置 } }] } //必胜客 Cmds { userid_type = OpenId, appid = "appid_pizza", [Cmd{ userid = "pizza_openid", write_bytes{ write_bytes = [0x01], write_index_1 = 1 << 49, //写入byte 区域的 49位置 write_index_2 = 0, }, write_uint32s{ write_uint32s = [33], write_index_1 = 1<< 10, //写入uint32 区域的 10位置 }, write_flags_with_expire{ write_flags_with_expire = [true, 1753165024], //置true,过期时间为 2025-07-22 14:17:04 write_index_1 = 1<< 2, //写入标志位 区域的 2位置 } }] } */