登录接口ok

This commit is contained in:
aozhiwei 2020-12-16 17:57:33 +08:00
parent 5cdaaf350c
commit 2328d6bc29
6 changed files with 28 additions and 182 deletions

View File

@ -8,7 +8,6 @@ import (
const (
MT_SERVER_INFO = iota
MT_MYSQL_CONF = iota
MT_GAME_CONF = iota
MT_MAX
)
@ -20,7 +19,7 @@ func (this *MetaMgr) Init() *MetaMgr {
this.MetaMgr.Init()
configDir := "../config/"
if !f5.IsOnlineEnv() {
configDir = "/var/data/conf_test/admin/"
configDir = "/root/pub/conf_test/admin/"
}
metaClasses := &[]f5.MetaClass{
f5.MetaClass{
@ -30,16 +29,10 @@ func (this *MetaMgr) Init() *MetaMgr {
RawMeta: (*mt.ServerInfoMetas)(nil),
WrapMeta: (*MtwServerInfo)(nil)},
f5.MetaClass{
PrimKey: "InstanceId",
FileName: configDir + "mysql.cluster.json",
FileName: configDir + "admin.mysql.json",
Idx: MT_MYSQL_CONF,
RawMeta: (*mt.MysqlConfMetas)(nil),
WrapMeta: (*MtwMysqlConf)(nil)},
f5.MetaClass{
FileName: configDir + "admin.json",
Idx: MT_GAME_CONF,
RawMeta: (*mt.GameConfMetas)(nil),
WrapMeta: (*MtwGameConf)(nil)},
}
this.MetaMgr.RegisterMetaClasses(metaClasses)
this.Load()
@ -66,7 +59,3 @@ func (this *MetaMgr) GetCurrServer() *MtwServerInfo {
func (this *MetaMgr) GetMysqlCluster() []*MtwMysqlConf {
return this.GetMetaList(MT_MYSQL_CONF).([]*MtwMysqlConf)
}
func (this *MetaMgr) GetGameConfs() []*MtwGameConf {
return this.GetMetaList(MT_GAME_CONF).([]*MtwGameConf)
}

View File

@ -9,7 +9,3 @@ type MtwServerInfo struct {
type MtwMysqlConf struct {
*mt.MysqlConf
}
type MtwGameConf struct {
*mt.GameConf
}

View File

@ -269,116 +269,6 @@ func (x *MysqlConfMetas) GetValues() []*MysqlConf {
return nil
}
type GameConf struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Gameid *int32 `protobuf:"varint,1,opt,name=gameid" json:"gameid,omitempty"`
Channel *int32 `protobuf:"varint,2,opt,name=channel" json:"channel,omitempty"`
NotifyUrl *string `protobuf:"bytes,3,opt,name=notify_url,json=notifyUrl" json:"notify_url,omitempty"`
}
func (x *GameConf) Reset() {
*x = GameConf{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GameConf) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GameConf) ProtoMessage() {}
func (x *GameConf) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GameConf.ProtoReflect.Descriptor instead.
func (*GameConf) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{4}
}
func (x *GameConf) GetGameid() int32 {
if x != nil && x.Gameid != nil {
return *x.Gameid
}
return 0
}
func (x *GameConf) GetChannel() int32 {
if x != nil && x.Channel != nil {
return *x.Channel
}
return 0
}
func (x *GameConf) GetNotifyUrl() string {
if x != nil && x.NotifyUrl != nil {
return *x.NotifyUrl
}
return ""
}
type GameConfMetas struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Values []*GameConf `protobuf:"bytes,1,rep,name=values" json:"values,omitempty"`
}
func (x *GameConfMetas) Reset() {
*x = GameConfMetas{}
if protoimpl.UnsafeEnabled {
mi := &file_mt_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GameConfMetas) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GameConfMetas) ProtoMessage() {}
func (x *GameConfMetas) ProtoReflect() protoreflect.Message {
mi := &file_mt_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GameConfMetas.ProtoReflect.Descriptor instead.
func (*GameConfMetas) Descriptor() ([]byte, []int) {
return file_mt_proto_rawDescGZIP(), []int{5}
}
func (x *GameConfMetas) GetValues() []*GameConf {
if x != nil {
return x.Values
}
return nil
}
var File_mt_proto protoreflect.FileDescriptor
var file_mt_proto_rawDesc = []byte{
@ -400,14 +290,7 @@ var file_mt_proto_rawDesc = []byte{
0x62, 0x61, 0x73, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x22, 0x2f, 0x0a, 0x0e, 0x4d, 0x79,
0x73, 0x71, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x12, 0x1d, 0x0a, 0x06,
0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x6d,
0x74, 0x2e, 0x4d, 0x79, 0x73, 0x71, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x22, 0x3f, 0x0a, 0x08, 0x47,
0x61, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x12, 0x0e, 0x0a, 0x06, 0x67, 0x61, 0x6d, 0x65, 0x69,
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x12, 0x0f, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e,
0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x12, 0x12, 0x0a, 0x0a, 0x6e, 0x6f, 0x74, 0x69,
0x66, 0x79, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x22, 0x2d, 0x0a, 0x0d,
0x47, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x4d, 0x65, 0x74, 0x61, 0x73, 0x12, 0x1c, 0x0a,
0x06, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e,
0x6d, 0x74, 0x2e, 0x47, 0x61, 0x6d, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x74, 0x2e, 0x4d, 0x79, 0x73, 0x71, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x42, 0x06, 0x5a, 0x04, 0x2e,
0x3b, 0x6d, 0x74,
}
@ -423,24 +306,21 @@ func file_mt_proto_rawDescGZIP() []byte {
return file_mt_proto_rawDescData
}
var file_mt_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_mt_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_mt_proto_goTypes = []interface{}{
(*ServerInfo)(nil), // 0: mt.ServerInfo
(*ServerInfoMetas)(nil), // 1: mt.ServerInfoMetas
(*MysqlConf)(nil), // 2: mt.MysqlConf
(*MysqlConfMetas)(nil), // 3: mt.MysqlConfMetas
(*GameConf)(nil), // 4: mt.GameConf
(*GameConfMetas)(nil), // 5: mt.GameConfMetas
}
var file_mt_proto_depIdxs = []int32{
0, // 0: mt.ServerInfoMetas.values:type_name -> mt.ServerInfo
2, // 1: mt.MysqlConfMetas.values:type_name -> mt.MysqlConf
4, // 2: mt.GameConfMetas.values:type_name -> mt.GameConf
3, // [3:3] is the sub-list for method output_type
3, // [3:3] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
2, // [2:2] is the sub-list for method output_type
2, // [2:2] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
}
func init() { file_mt_proto_init() }
@ -497,30 +377,6 @@ func file_mt_proto_init() {
return nil
}
}
file_mt_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GameConf); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_mt_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GameConfMetas); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
@ -528,7 +384,7 @@ func file_mt_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_mt_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},

View File

@ -28,15 +28,3 @@ message MysqlConfMetas
{
repeated MysqlConf values = 1;
}
message GameConf
{
optional int32 gameid = 1;
optional int32 channel = 2;
optional string notify_url = 3;
}
message GameConfMetas
{
repeated GameConf values = 1;
}

View File

@ -2,6 +2,8 @@ package main
import (
"net/http"
"q5"
"f5"
)
type UserMgr struct {
@ -19,7 +21,22 @@ func (this *UserMgr) UnInit() {
}
func (this *UserMgr) _userLogin(w *http.ResponseWriter, r *http.Request) {
username := q5.Request(r, "username").GetString()
password := q5.Request(r, "password").GetString()
url := "https://mp.kingsome.cn/api/user/login"
content := q5.NewMxoObject()
content.SetXValue("username", q5.NewXString(username))
content.SetXValue("password", q5.NewXString(password))
respStr, err := q5.HttpPostContent(url,
"application/json;charset=utf-8",
content.ToJsonStr())
if err == nil {
f5.SysLog().Debug("respStr:%s", respStr)
q5.Response(w, respStr)
} else {
q5.ResponseOk(w)
}
}
func (this *UserMgr) _userInfo(w *http.ResponseWriter, r *http.Request) {

2
third_party/q5 vendored

@ -1 +1 @@
Subproject commit a7c34b44d7244328b94beae4a3379ee4cdcc4def
Subproject commit c832144308869ebe389104a1e36392c3abc9f875