Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
fea89ad4
O
Open-IM-Server
项目概览
zhaominxu
/
Open-IM-Server
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Open-IM-Server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fea89ad4
编写于
1月 04, 2022
作者:
W
wenxu12345
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor code
上级
3d6f1e42
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
39 addition
and
38 deletion
+39
-38
pkg/common/db/mysql_model/im_mysql_model/friend_model.go
pkg/common/db/mysql_model/im_mysql_model/friend_model.go
+5
-5
pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go
...mon/db/mysql_model/im_mysql_model/friend_request_model.go
+5
-5
pkg/common/db/mysql_model/im_mysql_model/group_member_model.go
...ommon/db/mysql_model/im_mysql_model/group_member_model.go
+11
-10
pkg/common/db/mysql_model/im_mysql_model/group_model.go
pkg/common/db/mysql_model/im_mysql_model/group_model.go
+3
-3
pkg/common/db/mysql_model/im_mysql_model/group_request_model.go
...mmon/db/mysql_model/im_mysql_model/group_request_model.go
+5
-5
pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go
...on/db/mysql_model/im_mysql_model/user_black_list_model.go
+4
-4
pkg/common/db/mysql_model/im_mysql_model/user_model.go
pkg/common/db/mysql_model/im_mysql_model/user_model.go
+6
-6
未找到文件。
pkg/common/db/mysql_model/im_mysql_model/friend_model.go
浏览文件 @
fea89ad4
...
...
@@ -13,7 +13,7 @@ func InsertToFriend(toInsertFollow *db.Friend) error {
}
toInsertFollow
.
CreateTime
=
time
.
Now
()
err
=
dbConn
.
Table
(
"friend"
)
.
Create
(
toInsertFollow
)
.
Error
err
=
dbConn
.
Table
(
"friend
s
"
)
.
Create
(
toInsertFollow
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -26,7 +26,7 @@ func GetFriendRelationshipFromFriend(OwnerUserID, FriendUserID string) (*db.Frie
return
nil
,
err
}
var
friend
db
.
Friend
err
=
dbConn
.
Table
(
"friend"
)
.
Where
(
"owner_user_id=? and friend_user_id=?"
,
OwnerUserID
,
FriendUserID
)
.
Find
(
&
friend
)
.
Error
err
=
dbConn
.
Table
(
"friend
s
"
)
.
Where
(
"owner_user_id=? and friend_user_id=?"
,
OwnerUserID
,
FriendUserID
)
.
Find
(
&
friend
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -41,7 +41,7 @@ func GetFriendListByUserID(OwnerUserID string) ([]db.Friend, error) {
var
friends
[]
db
.
Friend
var
x
db
.
Friend
x
.
OwnerUserID
=
OwnerUserID
err
=
dbConn
.
Table
(
"friend"
)
.
Where
(
"owner_user_id=?"
,
OwnerUserID
)
.
Find
(
&
friends
)
.
Error
err
=
dbConn
.
Table
(
"friend
s
"
)
.
Where
(
"owner_user_id=?"
,
OwnerUserID
)
.
Find
(
&
friends
)
.
Error
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -54,7 +54,7 @@ func UpdateFriendComment(OwnerUserID, FriendUserID, Remark string) error {
if
err
!=
nil
{
return
err
}
err
=
dbConn
.
Exec
(
"update friend set remark=? where owner_user_id=? and friend_user_id=?"
,
Remark
,
OwnerUserID
,
FriendUserID
)
.
Error
err
=
dbConn
.
Exec
(
"update friend
s
set remark=? where owner_user_id=? and friend_user_id=?"
,
Remark
,
OwnerUserID
,
FriendUserID
)
.
Error
return
err
}
...
...
@@ -63,7 +63,7 @@ func DeleteSingleFriendInfo(OwnerUserID, FriendUserID string) error {
if
err
!=
nil
{
return
err
}
err
=
dbConn
.
Table
(
"friend"
)
.
Where
(
"owner_user_id=? and friend_user_id=?"
,
OwnerUserID
,
FriendUserID
)
.
Delete
(
db
.
Friend
{})
.
Error
err
=
dbConn
.
Table
(
"friend
s
"
)
.
Where
(
"owner_user_id=? and friend_user_id=?"
,
OwnerUserID
,
FriendUserID
)
.
Delete
(
db
.
Friend
{})
.
Error
return
err
}
...
...
pkg/common/db/mysql_model/im_mysql_model/friend_request_model.go
浏览文件 @
fea89ad4
...
...
@@ -25,7 +25,7 @@ func GetReceivedFriendsApplicationListByUserID(ToUserID string) ([]db.FriendRequ
return
nil
,
err
}
var
usersInfo
[]
db
.
FriendRequest
err
=
dbConn
.
Table
(
"friend_request"
)
.
Where
(
"to_user_id=?"
,
ToUserID
)
.
Find
(
&
usersInfo
)
.
Error
err
=
dbConn
.
Table
(
"friend_request
s
"
)
.
Where
(
"to_user_id=?"
,
ToUserID
)
.
Find
(
&
usersInfo
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -39,7 +39,7 @@ func GetSendFriendApplicationListByUserID(FromUserID string) ([]db.FriendRequest
return
nil
,
err
}
var
usersInfo
[]
db
.
FriendRequest
err
=
dbConn
.
Table
(
"friend_request"
)
.
Where
(
"from_user_id=?"
,
FromUserID
)
.
Find
(
&
usersInfo
)
.
Error
err
=
dbConn
.
Table
(
"friend_request
s
"
)
.
Where
(
"from_user_id=?"
,
FromUserID
)
.
Find
(
&
usersInfo
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -53,7 +53,7 @@ func GetFriendApplicationByBothUserID(FromUserID, ToUserID string) (*db.FriendRe
return
nil
,
err
}
var
friendRequest
db
.
FriendRequest
err
=
dbConn
.
Table
(
"friend_request"
)
.
Where
(
"from_user_id=? and to_user_id=?"
,
FromUserID
,
ToUserID
)
.
Find
(
&
friendRequest
)
.
Error
err
=
dbConn
.
Table
(
"friend_request
s
"
)
.
Where
(
"from_user_id=? and to_user_id=?"
,
FromUserID
,
ToUserID
)
.
Find
(
&
friendRequest
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -67,7 +67,7 @@ func UpdateFriendApplication(friendRequest *db.FriendRequest) error {
}
friendRequest
.
CreateTime
=
time
.
Now
()
return
dbConn
.
Table
(
"friend_request"
)
.
Where
(
"from_user_id=? and to_user_id=?"
,
return
dbConn
.
Table
(
"friend_request
s
"
)
.
Where
(
"from_user_id=? and to_user_id=?"
,
friendRequest
.
FromUserID
,
friendRequest
.
ToUserID
)
.
Update
(
&
friendRequest
)
.
Error
}
...
...
@@ -82,7 +82,7 @@ func InsertFriendApplication(friendRequest *db.FriendRequest) error {
if
friendRequest
.
HandleTime
.
Unix
()
<
0
{
friendRequest
.
HandleTime
=
utils
.
UnixSecondToTime
(
0
)
}
err
=
dbConn
.
Table
(
"friend_request"
)
.
Create
(
friendRequest
)
.
Error
err
=
dbConn
.
Table
(
"friend_request
s
"
)
.
Create
(
friendRequest
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
pkg/common/db/mysql_model/im_mysql_model/group_member_model.go
浏览文件 @
fea89ad4
...
...
@@ -27,7 +27,7 @@ func InsertIntoGroupMember(toInsertInfo db.GroupMember) error {
if
toInsertInfo
.
RoleLevel
==
0
{
toInsertInfo
.
RoleLevel
=
constant
.
GroupOrdinaryUsers
}
err
=
dbConn
.
Table
(
"group_member"
)
.
Create
(
toInsertInfo
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Create
(
toInsertInfo
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -40,7 +40,7 @@ func GetGroupMemberListByUserID(userID string) ([]db.GroupMember, error) {
return
nil
,
err
}
var
groupMemberList
[]
db
.
GroupMember
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"user_id=?"
,
userID
)
.
Find
(
&
groupMemberList
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"user_id=?"
,
userID
)
.
Find
(
&
groupMemberList
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -53,7 +53,8 @@ func GetGroupMemberListByGroupID(groupID string) ([]db.GroupMember, error) {
return
nil
,
err
}
var
groupMemberList
[]
db
.
GroupMember
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=?"
,
groupID
)
.
Find
(
&
groupMemberList
)
.
Error
err
=
dbConn
.
Table
(
"group_members"
)
.
Where
(
"group_id=?"
,
groupID
)
.
Find
(
&
groupMemberList
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -66,7 +67,7 @@ func GetGroupMemberListByGroupIDAndRoleLevel(groupID string, roleLevel int32) ([
return
nil
,
err
}
var
groupMemberList
[]
db
.
GroupMember
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=? and role_level=?"
,
groupID
,
roleLevel
)
.
Find
(
&
groupMemberList
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"group_id=? and role_level=?"
,
groupID
,
roleLevel
)
.
Find
(
&
groupMemberList
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -79,7 +80,7 @@ func GetGroupMemberInfoByGroupIDAndUserID(groupID, userID string) (*db.GroupMemb
return
nil
,
err
}
var
groupMember
db
.
GroupMember
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=? and user_id=? "
,
groupID
,
userID
)
.
Limit
(
1
)
.
Find
(
&
groupMember
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"group_id=? and user_id=? "
,
groupID
,
userID
)
.
Limit
(
1
)
.
Find
(
&
groupMember
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -91,7 +92,7 @@ func DeleteGroupMemberByGroupIDAndUserID(groupID, userID string) error {
if
err
!=
nil
{
return
err
}
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=? and user_id=? "
,
groupID
,
userID
)
.
Delete
(
&
db
.
GroupMember
{})
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"group_id=? and user_id=? "
,
groupID
,
userID
)
.
Delete
(
&
db
.
GroupMember
{})
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -103,7 +104,7 @@ func UpdateGroupMemberInfo(groupMemberInfo db.GroupMember) error {
if
err
!=
nil
{
return
err
}
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=? and user_id=?"
,
groupMemberInfo
.
GroupID
,
groupMemberInfo
.
UserID
)
.
Update
(
&
groupMemberInfo
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"group_id=? and user_id=?"
,
groupMemberInfo
.
GroupID
,
groupMemberInfo
.
UserID
)
.
Update
(
&
groupMemberInfo
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -116,7 +117,7 @@ func GetOwnerManagerByGroupID(groupID string) ([]db.GroupMember, error) {
return
nil
,
err
}
var
groupMemberList
[]
db
.
GroupMember
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=? and role_level>?"
,
groupID
,
constant
.
GroupOrdinaryUsers
)
.
Find
(
&
groupMemberList
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"group_id=? and role_level>?"
,
groupID
,
constant
.
GroupOrdinaryUsers
)
.
Find
(
&
groupMemberList
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -129,7 +130,7 @@ func GetGroupMemberNumByGroupID(groupID string) uint32 {
return
0
}
var
number
uint32
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id=?"
,
groupID
)
.
Count
(
&
number
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"group_id=?"
,
groupID
)
.
Count
(
&
number
)
.
Error
if
err
!=
nil
{
return
0
}
...
...
@@ -155,7 +156,7 @@ func IsExistGroupMember(groupID, userID string) bool {
return
false
}
var
number
int32
err
=
dbConn
.
Table
(
"group_member"
)
.
Where
(
"group_id = ? and user_id = ?"
,
groupID
,
userID
)
.
Count
(
&
number
)
.
Error
err
=
dbConn
.
Table
(
"group_member
s
"
)
.
Where
(
"group_id = ? and user_id = ?"
,
groupID
,
userID
)
.
Count
(
&
number
)
.
Error
if
err
!=
nil
{
return
false
}
...
...
pkg/common/db/mysql_model/im_mysql_model/group_model.go
浏览文件 @
fea89ad4
...
...
@@ -27,7 +27,7 @@ func InsertIntoGroup(groupInfo db.Group) error {
groupInfo
.
GroupName
=
"Group Chat"
}
groupInfo
.
CreateTime
=
time
.
Now
()
err
=
dbConn
.
Table
(
"group"
)
.
Create
(
groupInfo
)
.
Error
err
=
dbConn
.
Table
(
"group
s
"
)
.
Create
(
groupInfo
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -40,7 +40,7 @@ func GetGroupInfoByGroupID(groupId string) (*db.Group, error) {
return
nil
,
err
}
var
groupInfo
db
.
Group
err
=
dbConn
.
Table
(
"group"
)
.
Where
(
"group_id=?"
,
groupId
)
.
Find
(
&
groupInfo
)
.
Error
err
=
dbConn
.
Table
(
"group
s
"
)
.
Where
(
"group_id=?"
,
groupId
)
.
Find
(
&
groupInfo
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -52,6 +52,6 @@ func SetGroupInfo(groupInfo db.Group) error {
if
err
!=
nil
{
return
err
}
err
=
dbConn
.
Table
(
"group"
)
.
Where
(
"group_id=?"
,
groupInfo
.
GroupID
)
.
Update
(
&
groupInfo
)
.
Error
err
=
dbConn
.
Table
(
"group
s
"
)
.
Where
(
"group_id=?"
,
groupInfo
.
GroupID
)
.
Update
(
&
groupInfo
)
.
Error
return
err
}
pkg/common/db/mysql_model/im_mysql_model/group_request_model.go
浏览文件 @
fea89ad4
...
...
@@ -27,7 +27,7 @@ func UpdateGroupRequest(groupRequest db.GroupRequest) error {
if
groupRequest
.
HandledTime
.
Unix
()
<
0
{
groupRequest
.
HandledTime
=
utils
.
UnixSecondToTime
(
0
)
}
return
dbConn
.
Table
(
"group_request"
)
.
Where
(
"group_id=? and user_id=?"
,
groupRequest
.
GroupID
,
groupRequest
.
UserID
)
.
Update
(
&
groupRequest
)
.
Error
return
dbConn
.
Table
(
"group_request
s
"
)
.
Where
(
"group_id=? and user_id=?"
,
groupRequest
.
GroupID
,
groupRequest
.
UserID
)
.
Update
(
&
groupRequest
)
.
Error
}
func
InsertIntoGroupRequest
(
toInsertInfo
db
.
GroupRequest
)
error
{
...
...
@@ -41,7 +41,7 @@ func InsertIntoGroupRequest(toInsertInfo db.GroupRequest) error {
toInsertInfo
.
HandledTime
=
utils
.
UnixSecondToTime
(
0
)
}
err
=
dbConn
.
Table
(
"group_request"
)
.
Create
(
&
toInsertInfo
)
.
Error
err
=
dbConn
.
Table
(
"group_request
s
"
)
.
Create
(
&
toInsertInfo
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -54,7 +54,7 @@ func GetGroupRequestByGroupIDAndUserID(groupID, userID string) (*db.GroupRequest
return
nil
,
err
}
var
groupRequest
db
.
GroupRequest
err
=
dbConn
.
Table
(
"group_request"
)
.
Where
(
"user_id=? and group_id=?"
,
userID
,
groupID
)
.
Find
(
&
groupRequest
)
.
Error
err
=
dbConn
.
Table
(
"group_request
s
"
)
.
Where
(
"user_id=? and group_id=?"
,
userID
,
groupID
)
.
Find
(
&
groupRequest
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -66,7 +66,7 @@ func DelGroupRequestByGroupIDAndUserID(groupID, userID string) error {
if
err
!=
nil
{
return
err
}
err
=
dbConn
.
Table
(
"group_request"
)
.
Where
(
"group_id=? and user_id=?"
,
groupID
,
userID
)
.
Delete
(
&
db
.
GroupRequest
{})
.
Error
err
=
dbConn
.
Table
(
"group_request
s
"
)
.
Where
(
"group_id=? and user_id=?"
,
groupID
,
userID
)
.
Delete
(
&
db
.
GroupRequest
{})
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -79,7 +79,7 @@ func GetGroupRequestByGroupID(groupID string) ([]db.GroupRequest, error) {
return
nil
,
err
}
var
groupRequestList
[]
db
.
GroupRequest
err
=
dbConn
.
Table
(
"group_request"
)
.
Where
(
"group_id=?"
,
groupID
)
.
Find
(
&
groupRequestList
)
.
Error
err
=
dbConn
.
Table
(
"group_request
s
"
)
.
Where
(
"group_id=?"
,
groupID
)
.
Find
(
&
groupRequestList
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
pkg/common/db/mysql_model/im_mysql_model/user_black_list_model.go
浏览文件 @
fea89ad4
...
...
@@ -11,7 +11,7 @@ func InsertInToUserBlackList(black db.Black) error {
return
err
}
black
.
CreateTime
=
time
.
Now
()
err
=
dbConn
.
Table
(
"
user_black_list
"
)
.
Create
(
black
)
.
Error
err
=
dbConn
.
Table
(
"
blacks
"
)
.
Create
(
black
)
.
Error
return
err
}
...
...
@@ -30,7 +30,7 @@ func CheckBlack(ownerUserID, blockUserID string) error {
return
err
}
var
black
db
.
Black
err
=
dbConn
.
Table
(
"
user_black_list
"
)
.
Where
(
"owner_user_id=? and block_user_id=?"
,
ownerUserID
,
blockUserID
)
.
Find
(
&
black
)
.
Error
err
=
dbConn
.
Table
(
"
blacks
"
)
.
Where
(
"owner_user_id=? and block_user_id=?"
,
ownerUserID
,
blockUserID
)
.
Find
(
&
black
)
.
Error
return
err
}
...
...
@@ -40,7 +40,7 @@ func RemoveBlackList(ownerUserID, blockUserID string) error {
return
err
}
err
=
dbConn
.
Table
(
"
user_black_list
"
)
.
Where
(
"owner_user_id=? and block_user_id=?"
,
ownerUserID
,
blockUserID
)
.
Delete
(
&
db
.
Black
{})
.
Error
err
=
dbConn
.
Table
(
"
blacks
"
)
.
Where
(
"owner_user_id=? and block_user_id=?"
,
ownerUserID
,
blockUserID
)
.
Delete
(
&
db
.
Black
{})
.
Error
return
err
}
...
...
@@ -50,7 +50,7 @@ func GetBlackListByUserID(ownerUserID string) ([]db.Black, error) {
return
nil
,
err
}
var
blackListUsersInfo
[]
db
.
Black
err
=
dbConn
.
Table
(
"
user_black_list
"
)
.
Where
(
"owner_user_id=?"
,
ownerUserID
)
.
Find
(
&
blackListUsersInfo
)
.
Error
err
=
dbConn
.
Table
(
"
blacks
"
)
.
Where
(
"owner_user_id=?"
,
ownerUserID
)
.
Find
(
&
blackListUsersInfo
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
pkg/common/db/mysql_model/im_mysql_model/user_model.go
浏览文件 @
fea89ad4
...
...
@@ -43,7 +43,7 @@ func UserRegister(user db.User) error {
if
user
.
Birth
.
Unix
()
<
0
{
user
.
Birth
=
utils
.
UnixSecondToTime
(
0
)
}
err
=
dbConn
.
Table
(
"user"
)
.
Create
(
&
user
)
.
Error
err
=
dbConn
.
Table
(
"user
s
"
)
.
Create
(
&
user
)
.
Error
if
err
!=
nil
{
return
err
}
...
...
@@ -67,7 +67,7 @@ func DeleteUser(userID string) (i int64) {
if
err
!=
nil
{
return
0
}
i
=
dbConn
.
Table
(
"user"
)
.
Where
(
"user_id=?"
,
userID
)
.
Delete
(
db
.
User
{})
.
RowsAffected
i
=
dbConn
.
Table
(
"user
s
"
)
.
Where
(
"user_id=?"
,
userID
)
.
Delete
(
db
.
User
{})
.
RowsAffected
return
i
}
...
...
@@ -77,7 +77,7 @@ func GetUserByUserID(userID string) (*db.User, error) {
return
nil
,
err
}
var
user
db
.
User
err
=
dbConn
.
Table
(
"user"
)
.
Where
(
"user_id=?"
,
userID
)
.
First
(
&
user
)
.
Error
err
=
dbConn
.
Table
(
"user
s
"
)
.
Where
(
"user_id=?"
,
userID
)
.
First
(
&
user
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -90,7 +90,7 @@ func UpdateUserInfo(user db.User) error {
return
err
}
err
=
dbConn
.
Table
(
"user"
)
.
Where
(
"user_id=?"
,
user
.
UserID
)
.
Update
(
&
user
)
.
Error
err
=
dbConn
.
Table
(
"user
s
"
)
.
Where
(
"user_id=?"
,
user
.
UserID
)
.
Update
(
&
user
)
.
Error
return
err
}
...
...
@@ -100,7 +100,7 @@ func SelectAllUserID() ([]string, error) {
return
nil
,
err
}
var
resultArr
[]
string
err
=
dbConn
.
Table
(
"user"
)
.
Pluck
(
"user_id"
,
&
resultArr
)
.
Error
err
=
dbConn
.
Table
(
"user
s
"
)
.
Pluck
(
"user_id"
,
&
resultArr
)
.
Error
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -114,7 +114,7 @@ func SelectSomeUserID(userIDList []string) ([]string, error) {
return
nil
,
err
}
var
resultArr
[]
string
err
=
dbConn
.
Table
(
"user"
)
.
Where
(
"user_id IN (?) "
,
userIDList
)
.
Pluck
(
"user_id"
,
&
resultArr
)
.
Error
err
=
dbConn
.
Table
(
"user
s
"
)
.
Where
(
"user_id IN (?) "
,
userIDList
)
.
Pluck
(
"user_id"
,
&
resultArr
)
.
Error
if
err
!=
nil
{
return
nil
,
err
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录