修改创角默认字段
This commit is contained in:
parent
4733acd291
commit
f73f0e407e
@ -8,15 +8,16 @@ message Cache_UserData {
|
||||
}
|
||||
|
||||
message DB_UserData {
|
||||
string uid = 1;
|
||||
string uuid = 2; //玩家唯一uuid
|
||||
string binduid = 3; //玩家账号
|
||||
string name = 4; //玩家名
|
||||
int32 sid = 5; //区服id
|
||||
string createip = 6; //创建账号时的ip
|
||||
string lastloginip = 7; //最后一次登录时的ip
|
||||
int64 ctime = 8; //玩家创号时间戳
|
||||
int64 logintime = 9; //最后一次登录时间
|
||||
int32 FriendPoint = 10; //友情点
|
||||
int32 avatar = 11; //头像
|
||||
string id = 1; // @go_tags(`bson:"_id"`) ID
|
||||
string uid = 2;
|
||||
string uuid = 3; //玩家唯一uuid
|
||||
string binduid = 4; //玩家账号
|
||||
string name = 5; //玩家名
|
||||
int32 sid = 6; //区服id
|
||||
string createip = 7; //创建账号时的ip
|
||||
string lastloginip = 8; //最后一次登录时的ip
|
||||
int64 ctime = 9; //玩家创号时间戳
|
||||
int64 logintime = 10; //最后一次登录时间
|
||||
int32 FriendPoint = 11; //友情点
|
||||
int32 avatar = 12; //头像
|
||||
}
|
@ -88,17 +88,18 @@ type DB_UserData struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
|
||||
Uuid string `protobuf:"bytes,2,opt,name=uuid,proto3" json:"uuid,omitempty"` //玩家唯一uuid
|
||||
Binduid string `protobuf:"bytes,3,opt,name=binduid,proto3" json:"binduid,omitempty"` //玩家账号
|
||||
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` //玩家名
|
||||
Sid int32 `protobuf:"varint,5,opt,name=sid,proto3" json:"sid,omitempty"` //区服id
|
||||
Createip string `protobuf:"bytes,6,opt,name=createip,proto3" json:"createip,omitempty"` //创建账号时的ip
|
||||
Lastloginip string `protobuf:"bytes,7,opt,name=lastloginip,proto3" json:"lastloginip,omitempty"` //最后一次登录时的ip
|
||||
Ctime int64 `protobuf:"varint,8,opt,name=ctime,proto3" json:"ctime,omitempty"` //玩家创号时间戳
|
||||
Logintime int64 `protobuf:"varint,9,opt,name=logintime,proto3" json:"logintime,omitempty"` //最后一次登录时间
|
||||
FriendPoint int32 `protobuf:"varint,10,opt,name=FriendPoint,proto3" json:"FriendPoint,omitempty"` //友情点
|
||||
Avatar int32 `protobuf:"varint,11,opt,name=avatar,proto3" json:"avatar,omitempty"` //头像
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty" bson:"_id"` // ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
|
||||
Uuid string `protobuf:"bytes,3,opt,name=uuid,proto3" json:"uuid,omitempty"` //玩家唯一uuid
|
||||
Binduid string `protobuf:"bytes,4,opt,name=binduid,proto3" json:"binduid,omitempty"` //玩家账号
|
||||
Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` //玩家名
|
||||
Sid int32 `protobuf:"varint,6,opt,name=sid,proto3" json:"sid,omitempty"` //区服id
|
||||
Createip string `protobuf:"bytes,7,opt,name=createip,proto3" json:"createip,omitempty"` //创建账号时的ip
|
||||
Lastloginip string `protobuf:"bytes,8,opt,name=lastloginip,proto3" json:"lastloginip,omitempty"` //最后一次登录时的ip
|
||||
Ctime int64 `protobuf:"varint,9,opt,name=ctime,proto3" json:"ctime,omitempty"` //玩家创号时间戳
|
||||
Logintime int64 `protobuf:"varint,10,opt,name=logintime,proto3" json:"logintime,omitempty"` //最后一次登录时间
|
||||
FriendPoint int32 `protobuf:"varint,11,opt,name=FriendPoint,proto3" json:"FriendPoint,omitempty"` //友情点
|
||||
Avatar int32 `protobuf:"varint,12,opt,name=avatar,proto3" json:"avatar,omitempty"` //头像
|
||||
}
|
||||
|
||||
func (x *DB_UserData) Reset() {
|
||||
@ -133,6 +134,13 @@ func (*DB_UserData) Descriptor() ([]byte, []int) {
|
||||
return file_user_user_db_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *DB_UserData) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DB_UserData) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
@ -222,25 +230,26 @@ var file_user_user_db_proto_rawDesc = []byte{
|
||||
0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49,
|
||||
0x64, 0x12, 0x28, 0x0a, 0x08, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74,
|
||||
0x61, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x22, 0x9f, 0x02, 0x0a, 0x0b,
|
||||
0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x0a, 0x03, 0x75,
|
||||
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69,
|
||||
0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x69, 0x6e, 0x64, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||
0x61, 0x52, 0x08, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x22, 0xaf, 0x02, 0x0a, 0x0b,
|
||||
0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61, 0x74, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75,
|
||||
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69,
|
||||
0x64, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x69, 0x6e, 0x64, 0x75, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x62, 0x69, 0x6e, 0x64, 0x75, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x69,
|
||||
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x69, 0x70, 0x18, 0x06, 0x20,
|
||||
0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x73, 0x69,
|
||||
0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x69, 0x70, 0x18, 0x07, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x69, 0x70, 0x12, 0x20, 0x0a,
|
||||
0x0b, 0x6c, 0x61, 0x73, 0x74, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x69, 0x70, 0x18, 0x07, 0x20, 0x01,
|
||||
0x0b, 0x6c, 0x61, 0x73, 0x74, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x69, 0x70, 0x18, 0x08, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x69, 0x70, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
|
||||
0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05,
|
||||
0x63, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x74,
|
||||
0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x6c, 0x6f, 0x67, 0x69, 0x6e, 0x74,
|
||||
0x69, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64, 0x50, 0x6f, 0x69,
|
||||
0x6e, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64,
|
||||
0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x46, 0x72, 0x69, 0x65, 0x6e, 0x64,
|
||||
0x50, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x18,
|
||||
0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x06, 0x5a,
|
||||
0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,13 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/pb"
|
||||
"time"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
|
||||
uuid "github.com/satori/go.uuid"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
@ -44,7 +47,11 @@ func (this *DB) User_FindById(id string) (*pb.DB_UserData, error) {
|
||||
}
|
||||
|
||||
func (this *DB) User_Create(user *pb.DB_UserData) (err error) {
|
||||
user.Uid = primitive.NewObjectID().Hex()
|
||||
_id := primitive.NewObjectID().Hex()
|
||||
user.Id = _id
|
||||
user.Uid = fmt.Sprintf("%d_%s", user.Sid, _id)
|
||||
user.Uuid = uuid.NewV4().String()
|
||||
user.Ctime = time.Now().Unix()
|
||||
_, err = this.mgo.InsertOne(DB_UserTable, user)
|
||||
return err
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
|
||||
func TestCreate(t *testing.T) {
|
||||
user := &pb.DB_UserData{
|
||||
Binduid: "legu3",
|
||||
Name: "乐谷3",
|
||||
Binduid: "legu131",
|
||||
Name: "legu131",
|
||||
Sid: 1,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user