Browse Source

add SimpleUser, build support python output

yokyo 5 years ago
parent
commit
6f1d337303
2 changed files with 40 additions and 11 deletions
  1. 26 10
      build
  2. 14 1
      redis.proto

+ 26 - 10
build

@@ -1,14 +1,30 @@
 #!/usr/bin/env python
 import os
-print('compile proto to go file')
-for cur, dirs, files in os.walk('.'):
-    if cur[2:8] == 'google':
-        continue
-    for file in files:
-        f, ext = os.path.splitext(file)
-        if ext != '.proto':
+import argparse
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('-g', '--golang', help='build proto to golang output', action='store_true')
+    parser.add_argument('-p', '--python', help='build proto to python output', action='store_true')
+    args = parser.parse_args()
+
+    for cur, dirs, files in os.walk('.'):
+        if cur[2:8] == 'google':
             continue
-        os.system('protoc --go_out=. {}'.format(os.path.join(cur,file)))
-        print('.')
+        for file in files:
+            f, ext = os.path.splitext(file)
+            if ext != '.proto':
+                continue
+            if args.golang:
+                os.system('protoc --go_out=. {}'.format(os.path.join(cur,file)))
+            if args.python:
+                os.system('protoc --python_out=. {}'.format(os.path.join(cur, file)))
+            print('.')
+
+
+
+
 
-print('done. check if there any errors')
+if __name__ == '__main__':
+    main()
+    print('done. check if any errors.')

+ 14 - 1
redis.proto

@@ -2,16 +2,29 @@ syntax="proto3";
 package protos;
 
 
+// 用户基本信息,主要用于 login 服务器使用
+message UserBase {
+    uint64 guid         = 1;
+    string email        = 2;
+    string nickname     = 3;
+    string password     = 4;
+    int32 platform      = 5;
+    int32 from          = 6;
+}
+
 message User {
     uint64 guid         = 1;
     string email        = 2;
     string nickname     = 3;
     int32 headerIcon    = 4;
+    int32 platform      = 5;    // 客户端
+    int32 from          = 6;    // 注册渠道
     string password     = 8;
     string token        = 10;
+    int32 gender        = 11;
     int64  birthday     = 12;
     uint64 score        = 13;
-    int32 kickoff       = 14;
+    int32 kickoff       = 14;       // 当前是否被踢
     string eosWallet    = 20;
     string ethWallet    = 21;
     string usdtWallet   = 22;