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
573d7fa4
Commit
573d7fa4
authored
Jul 01, 2020
by
Li Feifei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
develop
parent
d5cdb5f2
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
24 additions
and
6 deletions
+24
-6
db.go
db/db.go
+1
-1
db_struct.go
db/db_struct.go
+15
-0
chat_room_db.go
sevice/im_chat_room/chat_room_db.go
+5
-4
im_base_db.go
sevice/im_configure/im_base_db.go
+1
-1
db.go
sevice/im_user_relationship/db.go
+1
-0
main.go
sevice/im_user_relationship/main.go
+1
-0
im_user_relationship.proto
u-proto/im_user_relationship.proto
+0
-0
No files found.
db/db.go
View file @
573d7fa4
...
@@ -54,7 +54,7 @@ func newMysqlClient() {
...
@@ -54,7 +54,7 @@ func newMysqlClient() {
log
.
Println
(
"db connect error => "
,
err
)
log
.
Println
(
"db connect error => "
,
err
)
return
return
}
}
orm
.
RegisterModel
(
new
(
CompanyApp
),
new
(
ImBase
),
new
(
ImChatRoom
))
orm
.
RegisterModel
(
new
(
CompanyApp
),
new
(
ImBase
),
new
(
ImChatRoom
)
,
new
(
ImUserRelationship
)
)
MysqlClient
=
orm
.
NewOrm
()
MysqlClient
=
orm
.
NewOrm
()
log
.
Println
(
"MySQL connect success"
)
log
.
Println
(
"MySQL connect success"
)
}
}
db/db_struct.go
View file @
573d7fa4
...
@@ -25,3 +25,17 @@ type ImChatRoom struct {
...
@@ -25,3 +25,17 @@ type ImChatRoom struct {
Createtime
string
Createtime
string
Updatetime
string
Updatetime
string
}
}
type
ImUserRelationship
struct
{
Id
int
Accid
string
Faccid
string
Type
int
Msg
string
Blacklist
int
Mute
int
Serverex
string
Createtime
string
Updatetime
string
}
\ No newline at end of file
helper
/chat_room_db.go
→
sevice/im_chat_room
/chat_room_db.go
View file @
573d7fa4
package
helper
package
im_chat_room
import
(
import
(
"errors"
"errors"
"im-microservice/helper"
"im-microservice/db"
"im-microservice/db"
"im-microservice/pb"
"im-microservice/pb"
...
@@ -22,7 +23,7 @@ const (
...
@@ -22,7 +23,7 @@ const (
func
AddChatRoom
(
addStruct
*
validator_struct
.
ChatRoomAddStruct
)
(
int64
,
error
)
{
func
AddChatRoom
(
addStruct
*
validator_struct
.
ChatRoomAddStruct
)
(
int64
,
error
)
{
var
chat
db
.
ImChatRoom
var
chat
db
.
ImChatRoom
now
:=
GetNowTime
()
now
:=
helper
.
GetNowTime
()
chat
.
Name
=
addStruct
.
Name
chat
.
Name
=
addStruct
.
Name
chat
.
Announcement
=
addStruct
.
Announcement
chat
.
Announcement
=
addStruct
.
Announcement
chat
.
Creator
=
addStruct
.
Creator
chat
.
Creator
=
addStruct
.
Creator
...
@@ -48,7 +49,7 @@ func UpdateChatRoom( update *validator_struct.ChatRoomUpdate) error {
...
@@ -48,7 +49,7 @@ func UpdateChatRoom( update *validator_struct.ChatRoomUpdate) error {
if
len
(
orm_params
)
==
0
{
if
len
(
orm_params
)
==
0
{
return
errors
.
New
(
"修改房间的参数为空"
)
return
errors
.
New
(
"修改房间的参数为空"
)
}
}
orm_params
[
"updatetime"
]
=
GetNowTime
()
orm_params
[
"updatetime"
]
=
helper
.
GetNowTime
()
_
,
err
:=
db
.
MysqlClient
.
QueryTable
(
chat_table_name
)
.
Filter
(
chat_room_id
,
update
.
RoomId
)
.
Update
(
orm_params
)
_
,
err
:=
db
.
MysqlClient
.
QueryTable
(
chat_table_name
)
.
Filter
(
chat_room_id
,
update
.
RoomId
)
.
Update
(
orm_params
)
return
err
return
err
...
@@ -101,7 +102,7 @@ func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{
...
@@ -101,7 +102,7 @@ func GetChatRooms(request *pb.ChatRoomAllRequest) (results map[string]interface{
return
return
}
}
// 获取查询条件聊天室的总数
// 获取查询条件聊天室的总数
offset
,
total_page
:=
Paginate
(
ctn
,
20
,
page
)
offset
,
total_page
:=
helper
.
Paginate
(
ctn
,
20
,
page
)
// 查询数据
// 查询数据
var
chat_rooms
[]
db
.
ImChatRoom
var
chat_rooms
[]
db
.
ImChatRoom
...
...
helper
/im_base_db.go
→
sevice/im_configure
/im_base_db.go
View file @
573d7fa4
package
helper
package
im_configure
import
(
import
(
"errors"
"errors"
...
...
sevice/im_user_relationship/db.go
0 → 100644
View file @
573d7fa4
package
im_user_relationship
sevice/im_user_relationship/main.go
0 → 100644
View file @
573d7fa4
package
im_user_relationship
u-proto/im_user_relationship.proto
0 → 100644
View file @
573d7fa4
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