Compare commits

..

No commits in common. "1bb639504da944a3ceb6a85a2fecfccd2fe5ec9c" and "eb7a57c21565bd239f0e3f51a337a3f2a1888a50" have entirely different histories.

2 changed files with 10 additions and 9 deletions

View File

@ -377,13 +377,6 @@ type SyncUserReq struct {
Confirm proto.UserSyncConfirm `json:"confirm" form:"confirm"`
}
// 用户数据同步
type UserSyncResp struct {
Update []dao.User `json:"update" form:"update"` //更新用户
Add []dao.User `json:"add" form:"add"` //添加用户
Delete []proto.UserDelID `json:"delete" form:"delete"` //删除用户
}
func GetSyncUserInfo(c *gin.Context) {
var req_data SyncUserReq
if err := c.ShouldBind(&req_data); err == nil {
@ -395,7 +388,7 @@ func GetSyncUserInfo(c *gin.Context) {
if proto.Config.SERVER_USER_TYPE == "master" {
if req_data.Types == 1 { //1为全量同步
add_users := dao.GetAllUser()
resp := UserSyncResp{}
resp := proto.UserSyncResp{}
resp.Add = add_users
c.JSON(200, gin.H{"code": proto.SuccessCode, "message": "success", "data": resp})
} else if req_data.Types == 2 { //2为增量同步
@ -413,7 +406,7 @@ func GetSyncUserInfo(c *gin.Context) {
c.JSON(200, gin.H{"code": proto.OperationFailed, "message": "failed", "data": "failed"})
}
} else {
c.JSON(200, gin.H{"code": proto.ParameterError, "message": "type is error", "data": UserSyncResp{}})
c.JSON(200, gin.H{"code": proto.ParameterError, "message": "type is error", "data": proto.UserSyncResp{}})
}
} else {
c.JSON(200, gin.H{"code": proto.NoPermission, "message": "no permission,server is not master", "data": proto.UserSync{}})

View File

@ -2,6 +2,7 @@ package proto
import (
"time"
"videoplayer/dao"
)
type UpdateUserInfoReq struct {
@ -33,6 +34,13 @@ type CronInfo struct {
Every int `json:"every" form:"every"` //每隔多少秒执行一次,小于等于0表示不执行时间粒度为10s
}
// 用户数据同步
type UserSyncResp struct {
Update []dao.User `json:"update" form:"update"` //更新用户
Add []dao.User `json:"add" form:"add"` //添加用户
Delete []UserDelID `json:"delete" form:"delete"` //删除用户
}
// 用户数据同步
type UserSync struct {
Update []UserAddOrUpdate `json:"update" form:"update"` //更新用户