Files
saasapi/proto/saascmd/cmd.proto
2025-03-28 18:44:35 +08:00

100 lines
3.2 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
syntax = "proto3";
package saascmd;
option go_package = "./saascmd";
// Cmds 批量命令
message Cmds {
UserIdType userid_type = 1; // 用户ID类型
string appid = 2; // 小程序/小游戏/公众号/视频号的appid
repeated Cmd cmd = 3; // 批量写入命令
}
// Cmd 上传命令
message Cmd {
string userid = 1; // 用户ID
WriteBytes write_bytes = 2; // byte区域
WriteUint32s write_uint32s = 3; // uint32区域
WriteFlagsWithExpire write_flags_with_expire = 4; // 标志位区域
}
// WriteBytes 写入byte
message WriteBytes {
bytes write_bytes = 1; // 写入的byte
uint64 write_index_1 = 2; // 写入byte的索引值(0..63)
uint64 write_index_2 = 3; // 写入byte的索引值(64..127)
}
// WriteUint32s 写入uint32
message WriteUint32s {
repeated uint32 write_uint32s = 1; // 写入的uint32
uint64 write_index_1 = 2; // 写入uint32的索引值(0..63)
uint64 write_index_2 = 3; // 写入uint32的索引值(64..127)
}
// WriteFlagsWithExpire 写入标志位
message WriteFlagsWithExpire {
repeated FlagWithExpire write_flags_with_expire = 1; // 写入的标志位
uint64 write_index_1 = 2; // 写入标志位的索引值
}
// FlagWithExpire 标志位
message FlagWithExpire {
bool flag = 1; // 标志位
uint32 expire = 2; // 过期时间
}
// UserIdType 用户 ID 类型
enum UserIdType {
DeviceId = 0; // 设备号
OpenId = 1; // OpenId
}
/*
//肯德基
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位置
}
}]
}
*/