Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
im-microservice
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Li Feifei
im-microservice
Commits
70b91186
Commit
70b91186
authored
Jul 16, 2020
by
Li Feifei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debug
parent
25816068
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
22 deletions
+23
-22
.DS_Store
.DS_Store
+0
-0
debug.log
log/debug.log
+0
-0
.DS_Store
pb/.DS_Store
+0
-0
im_base.pb.go
pb/im_base.pb.go
+0
-0
im_base.validator.pb.go
pb/im_base.validator.pb.go
+2
-2
db.go
sevice/im_configure/db.go
+2
-2
main.go
sevice/im_configure/main.go
+2
-1
im_base.proto
u-proto/im_base.proto
+7
-8
validator_strucut.go
validator_struct/validator_strucut.go
+10
-9
No files found.
.DS_Store
0 → 100644
View file @
70b91186
File added
log/debug.log
View file @
70b91186
This diff is collapsed.
Click to expand it.
pb/.DS_Store
View file @
70b91186
No preview for this file type
pb/im_base.pb.go
View file @
70b91186
This diff is collapsed.
Click to expand it.
pb/im_base.validator.pb.go
View file @
70b91186
...
...
@@ -34,8 +34,8 @@ func (this *ConfigureReply) Validate() error {
return
nil
}
func
(
this
*
ConfigureDelRequest
)
Validate
()
error
{
if
!
(
this
.
CompanyUser
Id
>
0
)
{
return
github_com_mwitkow_go_proto_validators
.
FieldError
(
"
CompanyUserId"
,
fmt
.
Errorf
(
`value '%v' must be greater than '0'`
,
this
.
CompanyUser
Id
))
if
!
(
this
.
Id
>
0
)
{
return
github_com_mwitkow_go_proto_validators
.
FieldError
(
"
Id"
,
fmt
.
Errorf
(
`value '%v' must be greater than '0'`
,
this
.
Id
))
}
return
nil
}
...
...
sevice/im_configure/db.go
View file @
70b91186
...
...
@@ -43,7 +43,7 @@ func AddImBase(im *validator_struct.ConfigureAddStruct) error {
func
DelConfigure
(
user_id
int64
)
(
err
error
)
{
configure
:=
new
(
db
.
ImBase
)
configure
.
CompanyUserId
=
user_id
configure
.
Id
=
int
(
user_id
)
_
,
err
=
db
.
MysqlClient
.
Delete
(
configure
)
if
err
!=
nil
{
err
=
status
.
Error
(
codes
.
Internal
,
err
.
Error
())
...
...
@@ -76,6 +76,6 @@ func UpdateConfiguer(im *validator_struct.ConfigureUpdateStruct) error {
return
errors
.
New
(
"没有数据更改"
)
}
_
,
err
:=
db
.
MysqlClient
.
QueryTable
(
b_table_name
)
.
Filter
(
b_user_id
,
im
.
CompanyUser
Id
)
.
Update
(
orm_params
)
Filter
(
"id"
,
im
.
Id
)
.
Update
(
orm_params
)
return
err
}
sevice/im_configure/main.go
View file @
70b91186
...
...
@@ -51,7 +51,7 @@ func (cs *ConfigureSevice) Delete(ctx context.Context,
return
}
// 执行删除操作
if
err
=
DelConfigure
(
in
.
CompanyUser
Id
);
err
!=
nil
{
if
err
=
DelConfigure
(
in
.
Id
);
err
!=
nil
{
return
}
reply
=
&
pb
.
ConfigureReply
{}
...
...
@@ -77,6 +77,7 @@ func (cs *ConfigureSevice) Select(ctx context.Context,
for
_
,
v
:=
range
configs
{
reply
.
GetAll
=
append
(
reply
.
GetAll
,
&
pb
.
GetAllOneReply
{
Reply
:
&
pb
.
Public
{
Id
:
int64
(
v
.
Id
),
CompanyUserId
:
v
.
CompanyUserId
,
MultideviceType
:
v
.
MultideviceType
,
MsgHookUrl
:
v
.
MsgHookUrl
,
...
...
u-proto/im_base.proto
View file @
70b91186
...
...
@@ -6,22 +6,21 @@ package pb;
import
"github.com/mwitkow/go-proto-validators/validator.proto"
;
message
Public
{
int64
CompanyUserId
=
1
;
int64
MultideviceType
=
2
;
string
MsgHookUrl
=
3
;
int64
Id
=
1
;
int64
CompanyUserId
=
2
;
int64
MultideviceType
=
3
;
string
MsgHookUrl
=
4
;
}
message
ConfigureRequest
{
string
Appkey
=
1
;
string
Current
=
2
;
Public
Public
=
3
;
int64
AppId
=
4
[(
validator.field
)
=
{
int_gt
:
0
}];
Public
Public
=
1
;
int64
AppId
=
2
[(
validator.field
)
=
{
int_gt
:
0
}];
}
message
ConfigureReply
{}
message
ConfigureDelRequest
{
int64
CompanyUser
Id
=
1
[(
validator.field
)
=
{
int_gt
:
0
}];
int64
Id
=
1
[(
validator.field
)
=
{
int_gt
:
0
}];
}
message
GetAllRequest
{
...
...
validator_struct/validator_strucut.go
View file @
70b91186
...
...
@@ -39,7 +39,7 @@ func NewConfigureAddStruct(inter interface{}) *ConfigureAddStruct {
// 修改配置
type
ConfigureUpdateStruct
struct
{
CompanyUserId
int64
`validate:"required,numeric"`
Id
int64
`validate:"required,numeric"`
MultideviceType
int64
MsgHookUrl
string
}
...
...
@@ -48,28 +48,29 @@ func NewConfigureUpdateStruct(in interface{}) *ConfigureUpdateStruct {
var
config_update
=
&
ConfigureUpdateStruct
{}
switch
in
.
(
type
)
{
case
*
pb
.
UpdateRequest
:
var
v
=
in
.
(
*
pb
.
ConfigureRequest
)
config_update
.
CompanyUserId
=
v
.
Public
.
GetCompanyUserId
()
var
v
=
in
.
(
*
pb
.
UpdateRequest
)
config_update
.
MultideviceType
=
v
.
Public
.
GetMultideviceType
()
config_update
.
MsgHookUrl
=
v
.
Public
.
GetMsgHookUrl
()
config_update
.
Id
=
v
.
Public
.
Id
case
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
{
config_update
.
MultideviceType
=
mt
}
if
mhu
,
ok
:=
c
[
"msg_hook_url"
]
.
(
string
);
ok
{
config_update
.
MsgHookUrl
=
mhu
}
if
id
,
ok
:=
c
[
"id"
]
.
(
int64
);
ok
{
config_update
.
Id
=
id
}
}
return
config_update
}
// 删除配置
type
ConfigureDelStruct
struct
{
CompanyUser
Id
int64
`validate:"required,numeric"`
Id
int64
`validate:"required,numeric"`
}
func
NewConfigureDelStruct
(
inter
interface
{})
*
ConfigureDelStruct
{
...
...
@@ -77,11 +78,11 @@ func NewConfigureDelStruct(inter interface{}) *ConfigureDelStruct {
switch
inter
.
(
type
)
{
case
*
pb
.
ConfigureDelRequest
:
var
c
=
inter
.
(
*
pb
.
ConfigureDelRequest
)
room
.
CompanyUserId
=
c
.
GetCompanyUser
Id
()
room
.
Id
=
c
.
Get
Id
()
case
map
[
string
]
interface
{}
:
var
c
=
inter
.
(
map
[
string
]
interface
{})
if
v
,
ok
:=
c
[
"company_user_id"
]
.
(
int64
);
ok
{
room
.
CompanyUser
Id
=
v
room
.
Id
=
v
}
}
return
room
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment