@@ -12,7 +12,6 @@ import ( | |||
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" | |||
"github.com/aliyun/aliyun-oss-go-sdk/oss" | |||
"github.com/gin-gonic/gin" | |||
"strings" | |||
) | |||
func MenuList(c *gin.Context) { | |||
@@ -112,7 +111,8 @@ func MenuList(c *gin.Context) { | |||
} | |||
type ImgReqUploadReq struct { | |||
FileName string `json:"file_name" binding:"required" example:"文件名"` | |||
FileName string `json:"file_name" binding:"required" example:"文件名"` | |||
ContentType string `json:"content_type,required" binding:"required" example:"image/jpeg"` | |||
} | |||
type ImgReqUploadResp struct { | |||
SignUrl string `json:"sign_url" example:"签名上传url"` | |||
@@ -158,7 +158,6 @@ func GetOssUrl(c *gin.Context) { | |||
ossBucketScheme := cfgMap[enum2.AliyunOssBucketScheme] | |||
accessKeyID := cfgMap[enum2.AliyunOssAccessKeyID] | |||
accessKeySecret := cfgMap[enum2.AliyunOssAccessKeySecret] | |||
aliyunOptions := cfgMap[enum2.AliyunOptions] | |||
// 创建OSSClient实例。 | |||
client, err := oss.New(ossBucketScheme+"://"+endpoint, accessKeyID, accessKeySecret) | |||
@@ -174,12 +173,8 @@ func GetOssUrl(c *gin.Context) { | |||
return | |||
} | |||
optionsList := strings.Split(aliyunOptions, ",") | |||
var options []oss.Option | |||
for _, option := range optionsList { | |||
options = append(options, oss.ContentType(option)) | |||
options := []oss.Option{ | |||
oss.ContentType(args.ContentType), | |||
} | |||
signedURL, err := bucket.SignURL(args.FileName, oss.HTTPPut, 60*5, options...) | |||
@@ -264,6 +264,7 @@ func UserManagementGetOneBasic(c *gin.Context) { | |||
Avatar: user.Avatar, | |||
Sex: user.Sex, | |||
Nickname: user.Nickname, | |||
LevelId: user.Level, | |||
Phone: user.Phone, | |||
UnionId: user.UnionId, | |||
Password: user.Password, | |||
@@ -283,6 +284,7 @@ func UserManagementGetOneBasic(c *gin.Context) { | |||
tagList[i].TagName = tagsMap[records.TagId] | |||
} | |||
} | |||
resp.BasicInfo.Tag = tagList | |||
if parent != nil { | |||
resp.BasicInfo.ParentUid = parent.Id | |||
resp.BasicInfo.ParentName = parent.Nickname | |||
@@ -120,7 +120,7 @@ func SetBasic(c *gin.Context) { | |||
cfgDb.SysCfgUpdate(enum2.AliyunOssEndpoint, req.OssEndpoint) | |||
} | |||
if req.OssOption != "" { | |||
cfgDb.SysCfgUpdate(enum2.AliyunOptions, req.OssEndpoint) | |||
cfgDb.SysCfgUpdate(enum2.AliyunOptions, req.OssOption) | |||
} | |||
e.OutSuc(c, "success", nil) | |||
} |
@@ -78,18 +78,19 @@ type LevelCount struct { | |||
} | |||
type UserManagementUpdateUserInfoReq struct { | |||
UID int64 `json:"uid,required"` | |||
Avatar string `json:"avatar"` // 头像 | |||
Sex string `json:"sex"` // 性别(0:未知 1:男 2:女) | |||
Level string `json:"level"` // 会员等级 ID | |||
Tag []string `json:"tag"` // 用户标签 ID列表 | |||
Phone string `json:"phone"` // 手机号 | |||
Nickname string `json:"nickname"` // 用户名 | |||
UnionId string `json:"union_id"` // 微信号 | |||
Memo string `json:"memo" example:"备注"` | |||
State string `json:"state"` // 账号状态 1正常,2冻结 | |||
LastLoginIp string `json:"last_login_ip"` // 用户最后登录 IP | |||
ParentUid string `json:"parent_uid"` // 邀请人 ID | |||
UID int64 `json:"uid,required"` | |||
Avatar string `json:"avatar"` // 头像 | |||
Sex string `json:"sex"` // 性别(0:未知 1:男 2:女) | |||
Level string `json:"level"` // 会员等级 ID | |||
Tag string `json:"tag"` // 用户标签 ID列表 | |||
Phone string `json:"phone"` // 手机号 | |||
Nickname string `json:"nickname"` // 用户名 | |||
UnionId string `json:"union_id"` // 微信号 | |||
Memo string `json:"memo" example:"备注"` | |||
State string `json:"state"` // 账号状态 1正常,2冻结 | |||
LastLoginIp string `json:"last_login_ip"` // 用户最后登录 IP | |||
ParentUid string `json:"parent_uid"` // 邀请人 ID | |||
Password string `json:"password"` // 登录密码 | |||
} | |||
type TagNode struct { | |||
@@ -102,6 +103,7 @@ type BasicInfoNode struct { | |||
Sex int `json:"sex"` // 性别 | |||
Nickname string `json:"nickname"` // 用户名称 | |||
LevelName string `json:"level_name"` // 会员等级名称 | |||
LevelId int `json:"levelId"` // 会员等级 ID | |||
Tag []TagNode `json:"tag"` // 标签名称 | |||
Phone string `json:"phone"` // 手机号 | |||
UnionId string `json:"union_id"` // 微信号 | |||
@@ -301,5 +301,5 @@ func rFinancialCenter(r *gin.RouterGroup) { | |||
func rComm(r *gin.RouterGroup) { | |||
r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表 | |||
r.GET("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL | |||
r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL | |||
} |
@@ -6,6 +6,7 @@ import ( | |||
"applet/app/utils" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
"strings" | |||
"time" | |||
"xorm.io/xorm" | |||
) | |||
@@ -89,6 +90,7 @@ func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpd | |||
Avatar: req.Avatar, | |||
LastLoginIp: req.LastLoginIp, | |||
Memo: req.Memo, | |||
Password: req.Password, | |||
} | |||
if req.Level != "" { | |||
user.Level = utils.StrToInt(req.Level) | |||
@@ -148,10 +150,11 @@ func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpd | |||
} | |||
// 新增用户标签记录 | |||
if len(req.Tag) > 0 { | |||
if req.Tag != "" { | |||
newRecords := make([]*model.UserTagRecords, 0) | |||
now := time.Now() | |||
for _, tag := range req.Tag { | |||
tags := strings.Split(req.Tag, ",") | |||
for _, tag := range tags { | |||
newRecord := &model.UserTagRecords{ | |||
TagId: utils.StrToInt(tag), | |||
Uid: req.UID, | |||
@@ -6743,6 +6743,10 @@ const docTemplate = `{ | |||
"description": "头像", | |||
"type": "string" | |||
}, | |||
"levelId": { | |||
"description": "会员等级 ID", | |||
"type": "integer" | |||
}, | |||
"level_name": { | |||
"description": "会员等级名称", | |||
"type": "string" | |||
@@ -10960,6 +10964,10 @@ const docTemplate = `{ | |||
"description": "邀请人 ID", | |||
"type": "string" | |||
}, | |||
"password": { | |||
"description": "登录密码", | |||
"type": "string" | |||
}, | |||
"phone": { | |||
"description": "手机号", | |||
"type": "string" | |||
@@ -10974,10 +10982,7 @@ const docTemplate = `{ | |||
}, | |||
"tag": { | |||
"description": "用户标签 ID列表", | |||
"type": "array", | |||
"items": { | |||
"type": "string" | |||
} | |||
"type": "string" | |||
}, | |||
"uid": { | |||
"type": "integer" | |||
@@ -6736,6 +6736,10 @@ | |||
"description": "头像", | |||
"type": "string" | |||
}, | |||
"levelId": { | |||
"description": "会员等级 ID", | |||
"type": "integer" | |||
}, | |||
"level_name": { | |||
"description": "会员等级名称", | |||
"type": "string" | |||
@@ -10953,6 +10957,10 @@ | |||
"description": "邀请人 ID", | |||
"type": "string" | |||
}, | |||
"password": { | |||
"description": "登录密码", | |||
"type": "string" | |||
}, | |||
"phone": { | |||
"description": "手机号", | |||
"type": "string" | |||
@@ -10967,10 +10975,7 @@ | |||
}, | |||
"tag": { | |||
"description": "用户标签 ID列表", | |||
"type": "array", | |||
"items": { | |||
"type": "string" | |||
} | |||
"type": "string" | |||
}, | |||
"uid": { | |||
"type": "integer" | |||
@@ -692,6 +692,9 @@ definitions: | |||
level_name: | |||
description: 会员等级名称 | |||
type: string | |||
levelId: | |||
description: 会员等级 ID | |||
type: integer | |||
memo: | |||
description: 备注 | |||
type: string | |||
@@ -3626,6 +3629,9 @@ definitions: | |||
parent_uid: | |||
description: 邀请人 ID | |||
type: string | |||
password: | |||
description: 登录密码 | |||
type: string | |||
phone: | |||
description: 手机号 | |||
type: string | |||
@@ -3637,9 +3643,7 @@ definitions: | |||
type: string | |||
tag: | |||
description: 用户标签 ID列表 | |||
items: | |||
type: string | |||
type: array | |||
type: string | |||
uid: | |||
type: integer | |||
union_id: | |||