| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381 |
- syntax = "proto3";
- option go_package = "api/app";
- package app.v1;
- import "google/protobuf/duration.proto";
- import "google/protobuf/timestamp.proto";
- enum ErrorCode{
- OK = 0;
- TokenExpire = 1000;
- UserBan = 1001;
- VfCodeExpire = 1002;
- SmsSendFail = 1003;
- UserStatusErr = 1008;
- StatusErr = 1009;
- PhoneNotExist = 2001;
- UnknownErr = 2002;
- ParamErr = 5000;
- HeadSourceErr = 5001;
- DATABASE = 9000;
- NoRecord = 9001;
- }
- message Image {
- string ext = 1;
- bytes data = 2;
- }
- /* 需验证身份的接口均在metadata中添加auth字段,填充登录返回的token值,version字段检查版本兼容性,不兼容
- 报unimplemented错误,且message为 "VERSION_TOO_LOW"
- */
- service ApiApp {
- rpc AuthSendCodeToPhone(AuthSendCodeToPhoneRequest) returns (DefaultReply); //获取短信验证码
- rpc GetVfPic(DefaultRequest) returns (Image); //获取滑动校验图片
- rpc SignOut (SignOutRequest) returns (DefaultReply); //登出
- rpc Unsubscribe (DefaultRequest) returns (DefaultReply); //注销
- rpc SignIn(SignInRequest) returns(SignInReply); //手机App用户登录
- rpc SignUp (SignUpRequest) returns (SignInReply); //注册
- rpc UserNameEdit(UserNameEditRequest) returns(DefaultReply); //用户名称修改
- rpc ProviderList(ProviderListRequest) returns (ProviderListReply); //商家列表,根据传入的经纬度来排序
- rpc ProviderDetail(IdRequest) returns (ProviderDetailReply); //商家详情
- rpc ProjectListByPosition(PositionRequest) returns (ProjectListReply); //方案列表查询根据传入的经纬度
- rpc ProjectListByProvider(IdRequest) returns (ProjectListReply); //方案列表查询通过商家ID
- rpc ProjectDetail(IdRequest) returns (ProjectDetailReply); //方案详情,传入方案ID
- rpc GameStart(GameStartRequest) returns (GameStartReply); //游戏开始
- rpc GameSaveUpload(GameSaveUploadRequest) returns (DefaultReply); //游戏中上报打点信息
- //rpc GameGiveUp(DefaultRequest) returns (DefaultReply); //游戏放弃
- rpc GameFinish(GameFinishRequest) returns (GameDetailReply); //游戏放弃
- rpc GetRegion(DefaultRequest) returns(Region); //获取区域
- rpc RegionList(RegionListRequest)returns(RegionListReply); //区域列表查询
- rpc GetInGameData(DefaultRequest)returns(GetInGameDataReply); //获取进行中的游戏数据,若没有,报notFound错误
- rpc GetServerTime(DefaultRequest)returns(GetServerTimeReply); //获取系统时间
- rpc GetSmsSendLeftTime(GetSmsSendLeftTimeRequest)returns(GetSmsSendLeftTimeReply); //查询下次短信发送剩余时间
- rpc GetUpdateVersion(GetUpdateVersionRequest)returns(GetUpdateVersionReply); //查询升级信息
- rpc MyHistoryGame(DefaultRequest)returns(MyHistoryGameReply); //查询历史记录
- rpc HistoryGameDetail(IdRequest)returns(GameDetailReply); //历史记录详情
- rpc MyUserQuery(DefaultRequest)returns(MyUserQueryReply); //用户自身信息查询
- rpc AssShopList(DefaultRequest) returns (AssShopListReply); //管理助手商家列表
- rpc AssControlInfoList(IdRequest) returns (AssControlInfoListReply); //管理助手商家下属检查点列表
- rpc AssControlInfoDetail(IdRequest) returns (AssControlInfoDetailReply); //管理助手检查点详情
- rpc AssControlInfoSave(AssControlInfoSaveRequest) returns (DefaultReply); //管理助手上报点位信息
- rpc AssControlInfoGpsSave(AssControlInfoGpsSaveRequest) returns (DefaultReply); //管理助手上报点位gps信息
- rpc AssVerification(AssVerificationRequest) returns (DefaultReply); // 管理助手核销
- }
- message GameFinishRequest{
- int32 game_id = 1; //游戏记录id
- bool isDrop =2; //是否中途退赛,中途未打卡结束点为 true ,其余为false
- }
- message GameDetailReply{
- int32 game_id = 1; //游戏记录id
- bool isComplete = 2; //是否成功完赛 中途退赛,没有打卡结束点为false,打卡结束点为 true
- google.protobuf.Timestamp start_at = 3; //开始时间
- repeated GameControlPoint checked_sorted_list = 4; //检查点
- google.protobuf.Duration duration = 5; //从游戏开始到上报的时间差
- google.protobuf.Timestamp stop_at = 6;//结束时间//0为未结束
- string qrJsonCode = 7;//生成核销二维码的字符串
- }
- message GameControlPoint{
- int64 id = 1; //检查点id
- string sn = 2; //检查点编号,如:A51
- CType cType = 3; //1开始点 2途径点 3结束点
- int32 orderNo = 4; //正确的途经点序号
- bool is_check_success=5; //是否成功
- google.protobuf.Duration check_after_last =6; //打卡相对于上一个点时间,给检查点显示用
- google.protobuf.Timestamp punchTime = 7;//打点时间,给开始点结束点显示用
- }
- message AssVerificationRequest{
- int32 userId = 1; //用户id
- int32 uoId =2; //游戏记录id
- }
- message GameHistory {
- int64 game_id = 1; //实例Id ,对应数据库uoId
- string name = 2; //方案名称
- string shopName = 3; //商家名称
- bool isComplete = 4;//比赛完成状态 true:完赛 false:退赛
- google.protobuf.Timestamp game_time = 5; //开始时间
- NetImage image = 6; //方案图片
- }
- message NetImage{
- string url = 1;
- bytes md5 =2;
- }
- message Position{
- double longitude = 1;
- double latitude = 2;
- }
- message ControlPointInfo{
- NetImage image = 1; //检查点内容图片(文创)
- string content = 2; //检查点内容文字
- }
- message ControlPoint{
- int64 id = 1; //检查点id
- ControlPointInfo info = 2; //检查点显示信息
- repeated string nfc_id_list = 3; //nfcId
- int64 on_map_x = 4; //地图X坐标
- int64 on_map_y = 5; //地图Y坐标
- string sn = 6; //检查点编号,如:A51
- }
- message ControlPointSimple{
- int64 id = 1; //检查点id
- repeated string nfc_id_list = 2; //nfcId
- string sn = 3; // 检查点编号,如:A51
- }
- message GameData{
- int64 game_id = 1; //用户定向记录Id,对应数据库uoId
- NetImage map_image = 2; //路线地图
- int64 map_width_cm = 3; //场地实际
- int64 map_height_cm = 4; //场地实际
- repeated ControlPoint control_point_sorted_list = 5; //按打点顺序排列的检查点序列
- google.protobuf.Duration max_duration = 6; //正常结束时间
- google.protobuf.Duration max_forced_end_duration = 7; //强制结束时间
- double map_direction_offset_angle = 8; //地图正上与北偏移角度
- Position map_left_bottom_position = 9; //原点经纬度
- google.protobuf.Timestamp game_start = 10; //游戏开始时间
- repeated ControlPointSimple control_point_all = 11; //范围内所有检查点
- NetImage legend_image = 12; //图例
- }
- message GameSaveControlPoint{
- int64 control_point_id = 1; //检查点Id
- bool is_check_success=2; //是否成功
- google.protobuf.Duration check_after_start =3; //打卡相对于开始时间
- }
- // 游戏进度存档
- message GameSave{
- int64 game_id = 1; //实例Id ,对应数据库uoId
- google.protobuf.Timestamp start_at =2; //开始时间
- repeated GameSaveControlPoint checked_sorted_list = 3; //检查点
- google.protobuf.Duration duration = 4; //从游戏开始到上报的时间差
- google.protobuf.Timestamp stop_at = 5;//结束时间//0为未结束
- }
- //======================================================== Request ===============================================
- message AuthSendCodeToPhoneRequest {
- string phone = 1;
- UserType userType = 2;
- SmsType smsType = 3;
- }
- message PositionRequest{
- Position position = 1;
- }
- message IdRequest{
- int64 id = 1;
- }
- message SignOutRequest {
- string name = 1;
- }
- message UserNameEditRequest {
- string name = 1;
- }
- message GetSmsSendLeftTimeRequest{
- string phone = 1;
- }
- message ProviderListRequest{
- Position position = 1;
- string name = 2;
- int32 is_open = 3; // 是否营业中,0或空为全部,1是2否
- string region_id = 4; // 地区编号
- }
- message AssControlInfoSaveRequest {
- int32 ciId =1; //点位id
- repeated string nfcCodeList = 2; //nfcCode,如04AA8642591390,不含冒号
- }
- message AssControlInfoGpsSaveRequest {
- int32 ciId =1; //点位id
- Position position = 2; //经纬度
- }
- message GetUpdateVersionRequest {
- string vCode = 1; //当前版本号
- }
- message DefaultRequest{
- }
- message SignUpRequest {
- string phone = 1;
- string password = 2;
- string nickname = 3;
- UserType userType = 4;
- string headUrl = 5; //用户头像,可为空,后台随机分配
- User.Sex sex = 6;
- }
- message User{
- enum Sex{
- UnDefine = 0;
- Male = 1;
- Female = 2;
- }
- }
- message SignInRequest{
- string name = 1;
- string password = 2;
- string deviceId = 3;
- }
- message GameStartRequest{
- int64 project_id = 1;
- int64 map_route_id = 2;
- }
- message GameSaveUploadRequest{
- GameSave game_save= 1;
- }
- //======================================================== Reply ===============================================
- message DefaultReply{}
- message SignInReply{
- string token = 1;
- }
- message HistoryGameDetailReply {
- GameData game_data = 1;
- GameSave game_save =2;
- }
- message MyHistoryGameReply {
- repeated GameHistory games = 1; //历史游戏记录
- }
- message ProviderInfoSimple{
- int64 id = 1;
- string name = 2;
- Position position = 3;
- string address = 4;
- NetImage image = 5;
- double distance = 6;
- bool is_open = 7; // 是否营业中 0 关店 1 营业中
- int32 project_num = 8; // 方案数量
- string phone = 9;//电话
- }
- message ProviderListReply {
- repeated ProviderInfoSimple list = 1;
- }
- message ProviderDetailReply {
- ProviderInfoSimple base = 1;
- google.protobuf.Timestamp open_begin = 2; // 营业时间开始
- google.protobuf.Timestamp open_end = 3; // 营业时间结束
- string telephone =4;
- string introduction =5; // 商家简介
- }
- message ProjectInfoSimple{
- int64 rsId = 1; //方案Id
- string rsName = 2; //方案名称
- NetImage projectImage = 3;//方案图片
- string shopName = 4;//商家名称
- Position Position = 5;//商家位置
- string addr = 6;//商家地址
- double distance = 7; //距离
- bool isInGame = 8; // 是否游戏中
- }
- message ProjectListReply{
- repeated ProjectInfoSimple list = 1;
- }
- message MapRoute{
- int64 id = 1; //路线id
- string name = 2;//路线名称
- NetImage image = 3;//路线底图信息
- }
- message ProjectDetailReply{
- ProjectInfoSimple base_info = 1;
- ProjectContentType content_type = 2;//项目介绍类型
- string content = 3; //项目介绍
- int32 lockup = 4;//关门时间单位:秒
- int32 forcedEntTime = 5;//强制结束时间单位:秒
- int32 totalControlNum = 6;//总计打点数
- int32 maxRange = 7;//直线最大距离,单位:米
- NetImage image = 8;//宣传图片
- int32 mapScaleNumber = 9;//比例尺,例:1:1500 为 1500
- int32 contourInterval = 10;//等高距 单位:米
- repeated MapRoute routes = 11; // 路线数组
- }
- message GameStartReply{
- GameData game_data = 1;
- }
- message GetRegionReply{
- string province = 1; // 省份
- string provinceId = 2; // 省份代码
- string city = 3; // 城市
- string cityId = 4; // 城市代码
- }
- message RegionListRequest{
- string country_code = 1;// 国家代码(ISO 3166-1): 中国 CN
- }
- // example: code = 370000 name = 山东省;code = 370100 name = 济南市;code = 370102 name = 历下区
- message Region{
- string code = 1;
- string name = 2;
- }
- // 省市区编码列表
- message RegionListReply{
- repeated Region region = 1;
- }
- message GetInGameDataReply{
- GameData data = 1;
- GameSave save = 2;
- }
- message MyUserQueryReply {
- int32 userId =1; //用户id
- string name = 2; //名称
- NetImage head =3; //头像
- int32 sysPoint =4; //百味豆
- string phone = 5; //手机
- }
- message AssShopListReply {
- repeated ShopList list = 1;
- }
- message ShopList {
- int32 shopId =1; //商家id
- string name = 2; //名称
- }
- message AssControlInfoListReply {
- repeated ControlInfoList list = 1;
- }
- message ControlInfoList {
- int32 ciId =1; //id
- string ciCode = 2; //编码
- }
- message AssControlInfoDetailReply {
- int32 ciId =1; //id
- string ciCode = 2; //编码
- Position position = 3; //经纬度
- repeated string nfcCodeList = 4; //nfcCode,如04AA8642591390,不含冒号
- }
- message GetUpdateVersionReply {
- bool needUpdate = 1; //是否需要升级 false 最新不用升级 true需要升级
- string vCode = 2; //最新版本号
- string vMemo = 3; //升级说明
- string vUrl = 4; //下载链接
- }
- message GetSmsSendLeftTimeReply{
- int32 second = 1;
- }
- message GetServerTimeReply{
- int64 millisecondStamp = 1;
- }
- //======================================================== Enum ===============================================
- // UserType 用户类型
- enum UserType{
- UnDefine = 0;
- AppUser = 1; //手机App用户
- ParkAdmin = 2; //园区管理员
- IPAdmin = 3; //内容商管理员
- SysAdmin = 4; //系统管理员
- }
- // LoginSource 登陆来源
- enum LoginSource {
- UnDef = 0;
- UserApp = 1; //用户手机APP
- WebAdmin = 2; //网页管理端
- ShopApp = 3; //商家助手APP
- }
- enum SmsType{
- UnKnow = 0;
- Login = 1; //登录
- SignUp = 2; //注册
- }
- enum ProjectContentType{
- Text = 0;
- Html = 1;
- }
- enum CType{
- UnKnowType = 0;
- BeginType = 1; //开始点
- MiddleType = 2; //途经点
- EndType = 3; //结束点
- }
|