Commit 70b91186 by Li Feifei

debug

parent 25816068
File added
No preview for this file type
...@@ -34,8 +34,8 @@ func (this *ConfigureReply) Validate() error { ...@@ -34,8 +34,8 @@ func (this *ConfigureReply) Validate() error {
return nil return nil
} }
func (this *ConfigureDelRequest) Validate() error { func (this *ConfigureDelRequest) Validate() error {
if !(this.CompanyUserId > 0) { if !(this.Id > 0) {
return github_com_mwitkow_go_proto_validators.FieldError("CompanyUserId", fmt.Errorf(`value '%v' must be greater than '0'`, this.CompanyUserId)) return github_com_mwitkow_go_proto_validators.FieldError("Id", fmt.Errorf(`value '%v' must be greater than '0'`, this.Id))
} }
return nil return nil
} }
......
...@@ -43,7 +43,7 @@ func AddImBase(im *validator_struct.ConfigureAddStruct) error { ...@@ -43,7 +43,7 @@ func AddImBase(im *validator_struct.ConfigureAddStruct) error {
func DelConfigure(user_id int64) (err error) { func DelConfigure(user_id int64) (err error) {
configure := new(db.ImBase) configure := new(db.ImBase)
configure.CompanyUserId = user_id configure.Id = int(user_id)
_, err = db.MysqlClient.Delete(configure) _, err = db.MysqlClient.Delete(configure)
if err != nil { if err != nil {
err = status.Error(codes.Internal, err.Error()) err = status.Error(codes.Internal, err.Error())
...@@ -76,6 +76,6 @@ func UpdateConfiguer(im *validator_struct.ConfigureUpdateStruct) error { ...@@ -76,6 +76,6 @@ func UpdateConfiguer(im *validator_struct.ConfigureUpdateStruct) error {
return errors.New("没有数据更改") return errors.New("没有数据更改")
} }
_, err := db.MysqlClient.QueryTable(b_table_name). _, err := db.MysqlClient.QueryTable(b_table_name).
Filter(b_user_id, im.CompanyUserId).Update(orm_params) Filter("id", im.Id).Update(orm_params)
return err return err
} }
...@@ -51,7 +51,7 @@ func (cs *ConfigureSevice) Delete(ctx context.Context, ...@@ -51,7 +51,7 @@ func (cs *ConfigureSevice) Delete(ctx context.Context,
return return
} }
// 执行删除操作 // 执行删除操作
if err = DelConfigure(in.CompanyUserId); err != nil { if err = DelConfigure(in.Id); err != nil {
return return
} }
reply = &pb.ConfigureReply{} reply = &pb.ConfigureReply{}
...@@ -77,6 +77,7 @@ func (cs *ConfigureSevice) Select(ctx context.Context, ...@@ -77,6 +77,7 @@ func (cs *ConfigureSevice) Select(ctx context.Context,
for _, v := range configs { for _, v := range configs {
reply.GetAll = append(reply.GetAll, &pb.GetAllOneReply{ reply.GetAll = append(reply.GetAll, &pb.GetAllOneReply{
Reply: &pb.Public{ Reply: &pb.Public{
Id:int64(v.Id),
CompanyUserId: v.CompanyUserId, CompanyUserId: v.CompanyUserId,
MultideviceType: v.MultideviceType, MultideviceType: v.MultideviceType,
MsgHookUrl: v.MsgHookUrl, MsgHookUrl: v.MsgHookUrl,
......
...@@ -6,22 +6,21 @@ package pb; ...@@ -6,22 +6,21 @@ package pb;
import "github.com/mwitkow/go-proto-validators/validator.proto"; import "github.com/mwitkow/go-proto-validators/validator.proto";
message Public { message Public {
int64 CompanyUserId = 1; int64 Id = 1;
int64 MultideviceType = 2; int64 CompanyUserId = 2;
string MsgHookUrl = 3; int64 MultideviceType = 3;
string MsgHookUrl = 4;
} }
message ConfigureRequest { message ConfigureRequest {
string Appkey= 1; Public Public = 1;
string Current=2; int64 AppId = 2 [(validator.field) = {int_gt: 0}];
Public Public = 3;
int64 AppId = 4 [(validator.field) = {int_gt: 0}];
} }
message ConfigureReply {} message ConfigureReply {}
message ConfigureDelRequest { message ConfigureDelRequest {
int64 CompanyUserId = 1 [(validator.field) = {int_gt: 0}]; int64 Id = 1 [(validator.field) = {int_gt: 0}];
} }
message GetAllRequest { message GetAllRequest {
......
...@@ -39,7 +39,7 @@ func NewConfigureAddStruct(inter interface{}) *ConfigureAddStruct { ...@@ -39,7 +39,7 @@ func NewConfigureAddStruct(inter interface{}) *ConfigureAddStruct {
// 修改配置 // 修改配置
type ConfigureUpdateStruct struct { type ConfigureUpdateStruct struct {
CompanyUserId int64 `validate:"required,numeric"` Id int64 `validate:"required,numeric"`
MultideviceType int64 MultideviceType int64
MsgHookUrl string MsgHookUrl string
} }
...@@ -48,28 +48,29 @@ func NewConfigureUpdateStruct(in interface{}) *ConfigureUpdateStruct { ...@@ -48,28 +48,29 @@ func NewConfigureUpdateStruct(in interface{}) *ConfigureUpdateStruct {
var config_update = &ConfigureUpdateStruct{} var config_update = &ConfigureUpdateStruct{}
switch in.(type) { switch in.(type) {
case *pb.UpdateRequest: case *pb.UpdateRequest:
var v = in.(*pb.ConfigureRequest) var v = in.(*pb.UpdateRequest)
config_update.CompanyUserId = v.Public.GetCompanyUserId()
config_update.MultideviceType = v.Public.GetMultideviceType() config_update.MultideviceType = v.Public.GetMultideviceType()
config_update.MsgHookUrl = v.Public.GetMsgHookUrl() config_update.MsgHookUrl = v.Public.GetMsgHookUrl()
config_update.Id = v.Public.Id
case map[string]interface{}: case map[string]interface{}:
var c = in.(map[string]interface{}) var c = in.(map[string]interface{})
if cui, ok := c["company_user_id"].(int64); ok {
config_update.CompanyUserId = cui
}
if mt, ok := c["multidevice_type"].(int64); ok { if mt, ok := c["multidevice_type"].(int64); ok {
config_update.MultideviceType = mt config_update.MultideviceType = mt
} }
if mhu, ok := c["msg_hook_url"].(string); ok { if mhu, ok := c["msg_hook_url"].(string); ok {
config_update.MsgHookUrl = mhu config_update.MsgHookUrl = mhu
} }
if id, ok := c["id"].(int64); ok {
config_update.Id = id
}
} }
return config_update return config_update
} }
// 删除配置 // 删除配置
type ConfigureDelStruct struct { type ConfigureDelStruct struct {
CompanyUserId int64 `validate:"required,numeric"` Id int64 `validate:"required,numeric"`
} }
func NewConfigureDelStruct(inter interface{}) *ConfigureDelStruct { func NewConfigureDelStruct(inter interface{}) *ConfigureDelStruct {
...@@ -77,11 +78,11 @@ func NewConfigureDelStruct(inter interface{}) *ConfigureDelStruct { ...@@ -77,11 +78,11 @@ func NewConfigureDelStruct(inter interface{}) *ConfigureDelStruct {
switch inter.(type) { switch inter.(type) {
case *pb.ConfigureDelRequest: case *pb.ConfigureDelRequest:
var c = inter.(*pb.ConfigureDelRequest) var c = inter.(*pb.ConfigureDelRequest)
room.CompanyUserId = c.GetCompanyUserId() room.Id = c.GetId()
case map[string]interface{}: case map[string]interface{}:
var c = inter.(map[string]interface{}) var c = inter.(map[string]interface{})
if v, ok := c["company_user_id"].(int64); ok { if v, ok := c["company_user_id"].(int64); ok {
room.CompanyUserId = v room.Id = v
} }
} }
return room return room
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment