diff --git a/app/db/im/model/customer_service.go b/app/db/im/model/customer_service.go index 120319f..d8eeb0b 100644 --- a/app/db/im/model/customer_service.go +++ b/app/db/im/model/customer_service.go @@ -1,15 +1,13 @@ package model -import "time" - // CustomerService 客服表 type CustomerService struct { Id int64 - Uid int64 // 用户id - Weight int32 // 权重 - State int32 // 状态 - HasUserNums int // 拥有用户数量 - Memo string // 备注 - CreateTime time.Time // 创建时间 - UpdateTime time.Time // 更新时间 + Uid int64 // 用户id + Weight int32 // 权重 + State int32 // 状态 + HasUserNums int // 拥有用户数量 + Memo string // 备注 + CreateTime string // 创建时间 + UpdateTime string // 更新时间 } diff --git a/app/hdl/friend_circle/hdl_dynamic.go b/app/hdl/friend_circle/hdl_dynamic.go index 6a103d4..6ee8204 100644 --- a/app/hdl/friend_circle/hdl_dynamic.go +++ b/app/hdl/friend_circle/hdl_dynamic.go @@ -17,6 +17,7 @@ import ( "github.com/gin-gonic/gin" "github.com/olivere/elastic/v7" "strconv" + "strings" "time" ) @@ -135,20 +136,37 @@ func GetDynamic(c *gin.Context) { } redisConn := cache.GetPool().Get() scheme, domain := svc2.ImageBucket(db.Db, redisConn) + list := make([]md.DynamicRespNode, len(docs)) for _, doc := range docs { switch doc.Kind { case 1: doc.Username = userMap[doc.Uid] case 2: doc.Username = adminMap[doc.Uid] - } - doc.Image = svc2.ImageFormatWithBucket(scheme, domain, doc.Image) - doc.Video = svc2.ImageFormatWithBucket(scheme, domain, doc.Video) + imageStr := svc2.ImageFormatWithBucketForDataInfo(scheme, domain, doc.Image) + videoStr := svc2.ImageFormatWithBucketForDataInfo(scheme, domain, doc.Video) + images := strings.Split(imageStr, ";") + videos := strings.Split(videoStr, ";") + temp := md.DynamicRespNode{ + IndexId: doc.IndexId, + Uid: doc.Uid, + Username: doc.Username, + Kind: doc.Kind, + Content: doc.Content, + Image: images, + Video: videos, + State: doc.State, + IsTopUp: doc.IsTopUp, + IsPraise: doc.IsPraise, + CreatedAt: doc.CreatedAt, + UpdatedAt: doc.UpdatedAt, + } + list = append(list, temp) } resp := md.GetDynamicResp{ - List: docs, + List: list, Paginate: md.Paginate{ Limit: req.Limit, Page: req.Page, @@ -271,14 +289,26 @@ func ReleaseDynamic(c *gin.Context) { if req.IsTopUp == 0 { req.IsTopUp = 2 } + redisConn := cache.GetPool().Get() + scheme, domain := svc2.ImageBucket(db.Db, redisConn) + var imageStr string + if len(req.Image) > 0 { + imageStr = strings.Join(req.Image, ";") + imageStr = strings.ReplaceAll(imageStr, fmt.Sprintf("%s://%s/", scheme, domain), "{{tempHost}}") + } + var videoStr string + if len(req.Video) > 0 { + videoStr = strings.Join(req.Video, ";") + videoStr = strings.ReplaceAll(videoStr, fmt.Sprintf("%s://%s/", scheme, domain), "{{tempHost}}") + } now := time.Now() m := md2.EggFriendCircleEs{ Uid: int64(user.AdmId), Kind: req.Kind, Content: req.Content, - Image: utils.SerializeStr(req.Image), - Video: req.Video, + Image: imageStr, + Video: videoStr, LikesNums: 0, ShareNums: 0, CommentNums: 0, diff --git a/app/hdl/im/hdl_basic.go b/app/hdl/im/hdl_basic.go index e0cda63..e9538b3 100644 --- a/app/hdl/im/hdl_basic.go +++ b/app/hdl/im/hdl_basic.go @@ -27,7 +27,7 @@ func GetBasic(c *gin.Context) { ProhibitAddGroupMembers: res[enum.ProhibitAddGroupMembers], ProhibitRemoveGroupMembers: res[enum.ProhibitRemoveGroupMembers], ProhibitUpdateGroupName: res[enum.ProhibitUpdateGroupName], - ChatSensitiveWords: res[enum.ProhibitUpdateGroupName], + ChatSensitiveWords: res[enum.ChatSensitiveWords], } e.OutSuc(c, resp, nil) diff --git a/app/md/friend_circle/md_dynamic.go b/app/md/friend_circle/md_dynamic.go index 892f50d..f8b82c9 100644 --- a/app/md/friend_circle/md_dynamic.go +++ b/app/md/friend_circle/md_dynamic.go @@ -27,10 +27,24 @@ type EggFriendCircleNode struct { CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` } +type DynamicRespNode struct { + IndexId string `json:"index_id"` // 动态id + Uid int64 `json:"uid" label:"uid"` // 用户id + Username string `json:"username"` // 用户名称 + Kind int32 `json:"kind" label:"类型(1:普通 2:官方)"` // 类型(1:普通 2:官方) + Content string `json:"content" label:"文本内容"` // 文本内容 + Image []string `json:"image" label:"图片"` // 图片 + Video []string `json:"video" label:"视频"` // 视频 + State int32 `json:"state" label:"状态(1:正常 2:隐藏)"` // 状态(1:正常 2:隐藏) + IsTopUp int32 `json:"is_top_up" label:"是否置顶(1:是 2:否)"` // 是否置顶(1:是 2:否) + IsPraise int32 `json:"is_praise" label:"是否被表扬(1:是 2:否)"` // 是否被表扬(1:是 2:否) + CreatedAt string `json:"created_at"` + UpdatedAt string `json:"updated_at"` +} type GetDynamicResp struct { - List []EggFriendCircleNode `json:"list"` - Paginate Paginate `json:"paginate"` // 分页信息 + List []DynamicRespNode `json:"list"` + Paginate Paginate `json:"paginate"` // 分页信息 } type UpdateDynamicReq struct { @@ -45,11 +59,11 @@ type DeleteDynamicReq struct { } type ReleaseDynamicReq struct { - Kind int32 `json:"kind"` // 类型(1:普通 2:官方) - Content string `json:"content"` // 文本内容 - Image string `json:"[]image"` // 图片 - Video string `json:"video"` // 视频 uri - State int32 `json:"state"` // 状态(1:正常 2:隐藏) - IsTopUp int32 `json:"is_top_up"` // 是否置顶(1:是 2:否) - IsPraise int32 `json:"is_praise"` // 是否被表扬(1:是 2:否) + Kind int32 `json:"kind"` // 类型(1:普通 2:官方) + Content string `json:"content"` // 文本内容 + Image []string `json:"image"` // 图片 + Video []string `json:"video"` // 视频 + State int32 `json:"state"` // 状态(1:正常 2:隐藏) + IsTopUp int32 `json:"is_top_up"` // 是否置顶(1:是 2:否) + IsPraise int32 `json:"is_praise"` // 是否被表扬(1:是 2:否) } diff --git a/app/md/im/md_customer_service.go b/app/md/im/md_customer_service.go index ef64ffc..2256084 100644 --- a/app/md/im/md_customer_service.go +++ b/app/md/im/md_customer_service.go @@ -5,6 +5,7 @@ type PageCustomerServiceReq struct { PageSize int `json:"page_size"` State int `json:"state"` //状态 Memo string `json:"memo" example:"备注"` + Phone string `json:"phone"` // 手机号 } type PageCustomerServiceResp struct { diff --git a/app/md/im/md_emoticon.go b/app/md/im/md_emoticon.go index 9912a20..8be78bc 100644 --- a/app/md/im/md_emoticon.go +++ b/app/md/im/md_emoticon.go @@ -5,6 +5,7 @@ type PageEmoticonReq struct { PageSize int `json:"page_size"` State int `json:"state"` //状态 Memo string `json:"memo" example:"备注"` + Name string `json:"name"` // 表情名称 } type PageEmoticonResp struct { @@ -15,9 +16,9 @@ type PageEmoticonResp struct { Id int64 `json:"id"` //记录id Name string `json:"name" example:"名称"` ImgUrl string `json:"img_url" example:"图片地址"` - Sort int `json:"Sort"` // 排序 - State int `json:"state"` // 状态0关闭,1开启 - Memo string `json:"memo" example:"备注"` // 备注 + Sort int `json:"Sort"` // 排序 + State int `json:"state"` // 状态0关闭,1开启 + Memo string `json:"memo" example:"备注"` // 备注 CreateAt string `json:"create_at" example:"创建时间"` // 创建时间 UpdateAt string `json:"update_at" example:"更新时间"` // 更新时间 } `json:"list"` @@ -27,7 +28,7 @@ type AddEmoticonReq struct { Name string `json:"name" example:"名称"` ImgUrl string `json:"img_url" example:"图片地址"` Memo string `json:"memo" example:"备注"` // 备注 - Sort int `json:"sort"` // 排序 + Sort int `json:"sort"` // 排序 } type SetEmoticonStateReq struct { @@ -40,7 +41,7 @@ type UpdateEmoticonReq struct { Name string `json:"name" example:"名称"` ImgUrl string `json:"img_url" example:"图片地址"` Memo string `json:"memo" example:"备注"` // 备注 - Sort int `json:"sort"` // 排序 + Sort int `json:"sort"` // 排序 } type DeleteEmoticonReq struct { diff --git a/app/md/member_center/md_user_management.go b/app/md/member_center/md_user_management.go index b5e98d6..deb1ef3 100644 --- a/app/md/member_center/md_user_management.go +++ b/app/md/member_center/md_user_management.go @@ -95,7 +95,7 @@ type UserManagementUpdateUserInfoReq struct { type TagNode struct { TagID int `json:"tag_id"` // 标签 ID - TagName string `json:"tag_name"` // 标签 名称 + TagName string `json:"tag_name"` // 标签名称 } type BasicInfoNode struct { @@ -179,3 +179,14 @@ type UserManagementGetVirtualCoinDetailResp struct { List []VirtualCoinDetailNode `json:"list"` Paginate Paginate `json:"paginate"` } + +type UserManagementAddTagReq struct { + Uid int64 `json:"uid"` // 用户 ID + TagId string `json:"tag_id"` // 标签 ID + Memo string `json:"memo"` // 标签备注 +} + +type UserManagementDelTagReq struct { + Uid int64 `json:"uid"` // 用户 ID + TagId string `json:"tag_id"` // 标签 ID +} diff --git a/app/svc/im/svc_customer_service.go b/app/svc/im/svc_customer_service.go index d77238b..86bccd0 100644 --- a/app/svc/im/svc_customer_service.go +++ b/app/svc/im/svc_customer_service.go @@ -4,18 +4,35 @@ import ( "applet/app/db" "applet/app/db/im/model" md "applet/app/md/im" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" "errors" "time" ) func PageCustomerService(req md.PageCustomerServiceReq) (err error, resp md.PageCustomerServiceResp) { + var userId int64 + if req.Phone != "" { + userDb := implement.NewUserDb(db.Db) + user, err := userDb.UserGetOneByParams(map[string]interface{}{ + "phone": req.Phone, + }) + if err != nil { + return err, md.PageCustomerServiceResp{} + } + userId = user.Id + } + sess := db.DbIm.Where("1=1") if req.Memo != "" { sess.And("memo LIKE ?", "%"+req.Memo+"%") } if req.State != 0 { - sess.And("memo = ?", req.State) + sess.And("state = ?", req.State) + } + if userId != 0 { + sess.And("uid = ?", userId) } + var mm []*model.CustomerService resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Asc("id").FindAndCount(&mm) if err != nil { @@ -48,8 +65,8 @@ func PageCustomerService(req md.PageCustomerServiceReq) (err error, resp md.Page State: v.State, HaasUserNums: v.HasUserNums, Memo: v.Memo, - CreateTime: v.CreateTime.Format("2006-01-02 15:04:05"), - UpdateTime: v.UpdateTime.Format("2006-01-02 15:04:05"), + CreateTime: v.CreateTime, + UpdateTime: v.UpdateTime, }) } return @@ -80,8 +97,8 @@ func AddCustomerService(req md.AddCustomerServiceReq) (err error) { State: 1, HasUserNums: 0, Memo: req.Memo, - CreateTime: time.Time{}, - UpdateTime: time.Time{}, + CreateTime: time.Now().Format("2006-01-02 15:04:05"), + UpdateTime: time.Now().Format("2006-01-02 15:04:05"), } _, err = db.DbIm.InsertOne(&cfg) if err != nil { @@ -97,7 +114,7 @@ func SetCustomerServiceState(req md.SetCustomerServiceStateReq) (err error) { if err != nil { return } - if has { + if !has { return errors.New("未查询到对应记录!") } customerService.State = req.State @@ -114,7 +131,7 @@ func UpdateCustomerServiceMemo(req md.UpdateCustomerServiceMemoReq) (err error) if err != nil { return } - if has { + if !has { return errors.New("未查询到对应记录!") } customerService.Memo = req.Memo diff --git a/app/svc/im/svc_emoticon.go b/app/svc/im/svc_emoticon.go index be75191..fd71950 100644 --- a/app/svc/im/svc_emoticon.go +++ b/app/svc/im/svc_emoticon.go @@ -14,7 +14,10 @@ func PageEmoticon(req md.PageEmoticonReq) (err error, resp md.PageEmoticonResp) sess.And("memo LIKE ?", "%"+req.Memo+"%") } if req.State != 0 { - sess.And("memo = ?", req.State) + sess.And("state = ?", req.State) + } + if req.Name != "" { + sess.And("name LIKE ?", "%"+req.Name+"%") } var mm []*model.Emoticon resp.Total, err = sess.Limit(req.PageSize, (req.Page-1)*req.PageSize).Desc("id").FindAndCount(&mm) @@ -61,7 +64,7 @@ func SetEmoticonState(req md.SetEmoticonStateReq) (err error) { if err != nil { return } - if has { + if !has { return errors.New("未查询到对应记录!") } customerService.State = req.State @@ -78,7 +81,7 @@ func UpdateEmoticon(req md.UpdateEmoticonReq) (err error) { if err != nil { return } - if has { + if !has { return errors.New("未查询到对应记录!") } customerService.Name = req.Name diff --git a/app/svc/im/svc_group.go b/app/svc/im/svc_group.go index a41e468..f4b75e3 100644 --- a/app/svc/im/svc_group.go +++ b/app/svc/im/svc_group.go @@ -82,6 +82,7 @@ func GroupList(req md.GroupListReq) (err error, resp md.GroupListResp) { tmp.Nickname = user.Nickname } } + resp.List = append(resp.List, tmp) } return } diff --git a/app/svc/member_center/svc_user_management.go b/app/svc/member_center/svc_user_management.go index aa5ed5b..e8976f7 100644 --- a/app/svc/member_center/svc_user_management.go +++ b/app/svc/member_center/svc_user_management.go @@ -133,16 +133,19 @@ func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpd if err != nil { return 0, err } - if records != nil { - recordIds := make([]int, 0) - for _, record := range *records { - recordIds = append(recordIds, record.Id) - } - - // 删除所有用户的所有标签记录 + oldRecordIds := make([]string, 0) + for _, record := range *records { + oldRecordIds = append(oldRecordIds, utils.IntToStr(record.Id)) + } + newRecordIds := strings.Split(req.Tag, ",") + // 需要删除的标签 + delTags := utils.DiffArray(oldRecordIds, newRecordIds) + addTags := utils.DiffArray(newRecordIds, oldRecordIds) + if delTags != nil { + // 删除不需要的标签记录 _, err := recordsDb.UserTagRecordsDeleteBySession(session, map[string]interface{}{ "key": "id", - "value": recordIds, + "value": delTags, }) if err != nil { return 0, err @@ -153,8 +156,7 @@ func UserManagementUpdateUserInfo(engine *xorm.Engine, req *md.UserManagementUpd if req.Tag != "" { newRecords := make([]*model.UserTagRecords, 0) now := time.Now() - tags := strings.Split(req.Tag, ",") - for _, tag := range tags { + for _, tag := range addTags { newRecord := &model.UserTagRecords{ TagId: utils.StrToInt(tag), Uid: req.UID, diff --git a/app/task/init.go b/app/task/init.go index c1633ef..43fbd50 100644 --- a/app/task/init.go +++ b/app/task/init.go @@ -96,4 +96,5 @@ func initTasks() { jobs[taskMd.CornEggEnergyDealUserPublicPlatoonPunish] = taskEggEnergyDealUserPublicPlatoonPunish // 蛋蛋能量-公排处罚 jobs[taskMd.CornEggEnergyAutoAdjustPrice] = taskEggEnergyAutoAdjustPrice // 蛋蛋能量-自动调整价格 jobs[taskMd.CornEggEnergyAutoCommunityDividends] = taskEggEnergyCommunityDividends // 蛋蛋能量-社区分红 + } diff --git a/app/task/svc/svc_egg_energy_auto_update_user_access.go b/app/task/svc/svc_egg_energy_auto_update_user_access.go new file mode 100644 index 0000000..1553879 --- /dev/null +++ b/app/task/svc/svc_egg_energy_auto_update_user_access.go @@ -0,0 +1,67 @@ +package svc + +import ( + "applet/app/utils" + "applet/app/utils/logx" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es" + es2 "code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es" + "fmt" + "time" + "xorm.io/xorm" +) + +// EggEnergyAutoUpdateUserAccess 自动更新用户访问次数记录 +func EggEnergyAutoUpdateUserAccess(engine *xorm.Engine) { + fmt.Println("svc_egg_energy_auto_update_user_access...") + defer func() { + if err := recover(); err != nil { + fmt.Println(err) + return + } + }() + + now := time.Now() + fmt.Println(now.Hour()) + if !(now.Hour() >= 2 && now.Hour() < 6) { + //TODO::只在凌晨两点 ~ 凌晨六点运行 + return + } + + // 获取当周信息 + year, week := time.Now().ISOWeek() + yearStr := utils.IntToStr(year) + weekStr := utils.IntToStr(week) + index := es.GetAppointIndexFromAlias(yearStr, weekStr) + page := 1 + limit := 100 + totalDb := implement.NewEggAccessTotalDb(engine) + for { + list, err := totalDb.EggAccessTotalGetByPage(year, week, page, limit) + if err != nil { + logx.Warn("EggEnergyAutoUpdateUserAccess:::", err) + return + } + ids := make([]string, 0, len(list)) + updateInfoMap := make([]interface{}, 0, len(list)) + for _, node := range list { + uid := node.Uid + id := fmt.Sprintf("%d%d-%d", year, week, uid) + ids = append(ids, id) + updateInfoMap = append(updateInfoMap, map[string]interface{}{ + "browse_interface_nums": node.Total, + }) + } + updateBulkDocRet, err := es2.UpdateBulkDoc(index, ids, updateInfoMap) + if err != nil { + logx.Warn("EggEnergyAutoUpdateUserAccess:::", err) + return + } + fmt.Printf("updateBulkDocRet ==> %+v \n\n", updateBulkDocRet) + if len(list) < limit { + break + } else { + page++ + } + } +} diff --git a/docs/docs.go b/docs/docs.go index e5fe7d1..d6a53dc 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1,5 +1,4 @@ -// Code generated by swaggo/swag. DO NOT EDIT. - +// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" @@ -1438,9 +1437,7 @@ const docTemplate = `{ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -7843,7 +7840,7 @@ const docTemplate = `{ "type": "integer" }, "tag_name": { - "description": "标签 名称", + "description": "标签名称", "type": "string" } } @@ -9426,6 +9423,63 @@ const docTemplate = `{ } } }, + "md.DynamicRespNode": { + "type": "object", + "properties": { + "content": { + "description": "文本内容", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "image": { + "description": "图片", + "type": "array", + "items": { + "type": "string" + } + }, + "index_id": { + "description": "动态id", + "type": "string" + }, + "is_praise": { + "description": "是否被表扬(1:是 2:否)", + "type": "integer" + }, + "is_top_up": { + "description": "是否置顶(1:是 2:否)", + "type": "integer" + }, + "kind": { + "description": "类型(1:普通 2:官方)", + "type": "integer" + }, + "state": { + "description": "状态(1:正常 2:隐藏)", + "type": "integer" + }, + "uid": { + "description": "用户id", + "type": "integer" + }, + "updated_at": { + "type": "string" + }, + "username": { + "description": "用户名称", + "type": "string" + }, + "video": { + "description": "视频", + "type": "array", + "items": { + "type": "string" + } + } + } + }, "md.EggEnergyAvailableEnergyFlow": { "type": "object", "properties": { @@ -9586,57 +9640,6 @@ const docTemplate = `{ } } }, - "md.EggFriendCircleNode": { - "type": "object", - "properties": { - "content": { - "description": "文本内容", - "type": "string" - }, - "created_at": { - "type": "string" - }, - "image": { - "description": "图片", - "type": "string" - }, - "index_id": { - "description": "动态id", - "type": "string" - }, - "is_praise": { - "description": "是否被表扬(1:是 2:否)", - "type": "integer" - }, - "is_top_up": { - "description": "是否置顶(1:是 2:否)", - "type": "integer" - }, - "kind": { - "description": "类型(1:普通 2:官方)", - "type": "integer" - }, - "state": { - "description": "状态(1:正常 2:隐藏)", - "type": "integer" - }, - "uid": { - "description": "用户id", - "type": "integer" - }, - "updated_at": { - "type": "string" - }, - "username": { - "description": "用户名称", - "type": "string" - }, - "video": { - "description": "视频", - "type": "string" - } - } - }, "md.EggPointCoefficientBatchAddReq": { "type": "object", "properties": { @@ -10146,7 +10149,7 @@ const docTemplate = `{ "list": { "type": "array", "items": { - "$ref": "#/definitions/md.EggFriendCircleNode" + "$ref": "#/definitions/md.DynamicRespNode" } }, "paginate": { @@ -12043,6 +12046,10 @@ const docTemplate = `{ "page_size": { "type": "integer" }, + "phone": { + "description": "手机号", + "type": "string" + }, "state": { "description": "状态", "type": "integer" @@ -12056,6 +12063,10 @@ const docTemplate = `{ "type": "string", "example": "备注" }, + "name": { + "description": "表情名称", + "type": "string" + }, "page": { "type": "integer" }, @@ -12199,14 +12210,17 @@ const docTemplate = `{ "md.ReleaseDynamicReq": { "type": "object", "properties": { - "[]image": { - "description": "图片", - "type": "string" - }, "content": { "description": "文本内容", "type": "string" }, + "image": { + "description": "图片", + "type": "array", + "items": { + "type": "string" + } + }, "is_praise": { "description": "是否被表扬(1:是 2:否)", "type": "integer" @@ -12224,8 +12238,11 @@ const docTemplate = `{ "type": "integer" }, "video": { - "description": "视频 uri", - "type": "string" + "description": "视频", + "type": "array", + "items": { + "type": "string" + } } } }, @@ -14589,6 +14606,8 @@ var SwaggerInfo = &swag.Spec{ Description: "管理后台接口文档", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index 1639d5e..d872bcb 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1430,9 +1430,7 @@ "name": "req", "in": "body", "required": true, - "schema": { - "type": "object" - } + "schema": {} } ], "responses": { @@ -7835,7 +7833,7 @@ "type": "integer" }, "tag_name": { - "description": "标签 名称", + "description": "标签名称", "type": "string" } } @@ -9418,6 +9416,63 @@ } } }, + "md.DynamicRespNode": { + "type": "object", + "properties": { + "content": { + "description": "文本内容", + "type": "string" + }, + "created_at": { + "type": "string" + }, + "image": { + "description": "图片", + "type": "array", + "items": { + "type": "string" + } + }, + "index_id": { + "description": "动态id", + "type": "string" + }, + "is_praise": { + "description": "是否被表扬(1:是 2:否)", + "type": "integer" + }, + "is_top_up": { + "description": "是否置顶(1:是 2:否)", + "type": "integer" + }, + "kind": { + "description": "类型(1:普通 2:官方)", + "type": "integer" + }, + "state": { + "description": "状态(1:正常 2:隐藏)", + "type": "integer" + }, + "uid": { + "description": "用户id", + "type": "integer" + }, + "updated_at": { + "type": "string" + }, + "username": { + "description": "用户名称", + "type": "string" + }, + "video": { + "description": "视频", + "type": "array", + "items": { + "type": "string" + } + } + } + }, "md.EggEnergyAvailableEnergyFlow": { "type": "object", "properties": { @@ -9578,57 +9633,6 @@ } } }, - "md.EggFriendCircleNode": { - "type": "object", - "properties": { - "content": { - "description": "文本内容", - "type": "string" - }, - "created_at": { - "type": "string" - }, - "image": { - "description": "图片", - "type": "string" - }, - "index_id": { - "description": "动态id", - "type": "string" - }, - "is_praise": { - "description": "是否被表扬(1:是 2:否)", - "type": "integer" - }, - "is_top_up": { - "description": "是否置顶(1:是 2:否)", - "type": "integer" - }, - "kind": { - "description": "类型(1:普通 2:官方)", - "type": "integer" - }, - "state": { - "description": "状态(1:正常 2:隐藏)", - "type": "integer" - }, - "uid": { - "description": "用户id", - "type": "integer" - }, - "updated_at": { - "type": "string" - }, - "username": { - "description": "用户名称", - "type": "string" - }, - "video": { - "description": "视频", - "type": "string" - } - } - }, "md.EggPointCoefficientBatchAddReq": { "type": "object", "properties": { @@ -10138,7 +10142,7 @@ "list": { "type": "array", "items": { - "$ref": "#/definitions/md.EggFriendCircleNode" + "$ref": "#/definitions/md.DynamicRespNode" } }, "paginate": { @@ -12035,6 +12039,10 @@ "page_size": { "type": "integer" }, + "phone": { + "description": "手机号", + "type": "string" + }, "state": { "description": "状态", "type": "integer" @@ -12048,6 +12056,10 @@ "type": "string", "example": "备注" }, + "name": { + "description": "表情名称", + "type": "string" + }, "page": { "type": "integer" }, @@ -12191,14 +12203,17 @@ "md.ReleaseDynamicReq": { "type": "object", "properties": { - "[]image": { - "description": "图片", - "type": "string" - }, "content": { "description": "文本内容", "type": "string" }, + "image": { + "description": "图片", + "type": "array", + "items": { + "type": "string" + } + }, "is_praise": { "description": "是否被表扬(1:是 2:否)", "type": "integer" @@ -12216,8 +12231,11 @@ "type": "integer" }, "video": { - "description": "视频 uri", - "type": "string" + "description": "视频", + "type": "array", + "items": { + "type": "string" + } } } }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 7efe25c..2fcc85a 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -171,7 +171,7 @@ definitions: description: 标签 ID type: integer tag_name: - description: 标签 名称 + description: 标签名称 type: string type: object applet_app_md_setCenter_oss_aliyun.GetBasicResp: @@ -1266,6 +1266,47 @@ definitions: paginate: $ref: '#/definitions/applet_app_md_institutional_management_egg_energy.Paginate' type: object + md.DynamicRespNode: + properties: + content: + description: 文本内容 + type: string + created_at: + type: string + image: + description: 图片 + items: + type: string + type: array + index_id: + description: 动态id + type: string + is_praise: + description: 是否被表扬(1:是 2:否) + type: integer + is_top_up: + description: 是否置顶(1:是 2:否) + type: integer + kind: + description: 类型(1:普通 2:官方) + type: integer + state: + description: 状态(1:正常 2:隐藏) + type: integer + uid: + description: 用户id + type: integer + updated_at: + type: string + username: + description: 用户名称 + type: string + video: + description: 视频 + items: + type: string + type: array + type: object md.EggEnergyAvailableEnergyFlow: properties: after_community_dividends: @@ -1382,43 +1423,6 @@ definitions: uid: type: integer type: object - md.EggFriendCircleNode: - properties: - content: - description: 文本内容 - type: string - created_at: - type: string - image: - description: 图片 - type: string - index_id: - description: 动态id - type: string - is_praise: - description: 是否被表扬(1:是 2:否) - type: integer - is_top_up: - description: 是否置顶(1:是 2:否) - type: integer - kind: - description: 类型(1:普通 2:官方) - type: integer - state: - description: 状态(1:正常 2:隐藏) - type: integer - uid: - description: 用户id - type: integer - updated_at: - type: string - username: - description: 用户名称 - type: string - video: - description: 视频 - type: string - type: object md.EggPointCoefficientBatchAddReq: properties: list: @@ -1771,7 +1775,7 @@ definitions: properties: list: items: - $ref: '#/definitions/md.EggFriendCircleNode' + $ref: '#/definitions/md.DynamicRespNode' type: array paginate: allOf: @@ -3088,6 +3092,9 @@ definitions: type: integer page_size: type: integer + phone: + description: 手机号 + type: string state: description: 状态 type: integer @@ -3097,6 +3104,9 @@ definitions: memo: example: 备注 type: string + name: + description: 表情名称 + type: string page: type: integer page_size: @@ -3200,12 +3210,14 @@ definitions: type: object md.ReleaseDynamicReq: properties: - '[]image': - description: 图片 - type: string content: description: 文本内容 type: string + image: + description: 图片 + items: + type: string + type: array is_praise: description: 是否被表扬(1:是 2:否) type: integer @@ -3219,8 +3231,10 @@ definitions: description: 状态(1:正常 2:隐藏) type: integer video: - description: 视频 uri - type: string + description: 视频 + items: + type: string + type: array type: object md.Response: properties: @@ -5778,8 +5792,7 @@ paths: in: body name: req required: true - schema: - type: object + schema: {} produces: - application/json responses: diff --git a/etc/task.yml b/etc/task.yml index 056b5ba..0aabe35 100644 --- a/etc/task.yml +++ b/etc/task.yml @@ -1,18 +1,14 @@ -# debug release test +# 当前域名 debug: true +curldebug: true prd: false local: true +# 服务器参数 +srv_addr: ':4001' # 缓存 -redis_addr: '120.24.28.6:32572' +redis_addr: '127.0.0.1:6379' +redis_password: '' -app_comm: - url: http://127.0.0.1:5003 - - -admin: - api_aes_key: e{&[^Ft(.~g]1eR-]VO - api_aes_iv: ZV`7<5X]/2brS@sz -# 数据库 db: host: '119.23.182.117:3306' name: 'egg' @@ -22,10 +18,22 @@ db: max_lifetime: 30 max_open_conns: 100 max_idle_conns: 100 - path: 'tmp/task_sql_%v.log' + path: 'tmp/%s.log' + +im_db: + host: '119.23.182.117:3306' + name: 'egg-im' + user: 'root' + psw: 'Fnuo123com@' + show_log: true + max_lifetime: 30 + max_open_conns: 100 + max_idle_conns: 100 + path: 'tmp/%s.log' # 日志 log: + app_name: 'applet' level: 'debug' # 普通日志级别 #debug, info, warn, fatal, panic is_stdout: true time_format: 'standard' # sec, second, milli, nano, standard, iso @@ -34,4 +42,24 @@ log: file_dir: './tmp/' file_max_size: 256 file_max_age: 1 - file_name: 'task.log' + file_name: 'debug.log' + +# 连接RabbitMq +mq: + host: '120.77.153.180' + port: '15672' + user: 'guest' + pwd: 'guest' + +es: + url: 'http://120.55.48.175:9200' + user: 'elastic' + pwd: 'fnuo123' + +im_business_rpc: + url: im-rpc-business.izhim.com + port: 1005 + +im_logic_rpc: + url: im-rpc-logic.izhim.com + port: 1008 \ No newline at end of file diff --git a/go.mod b/go.mod index 3e932e9..34c8776 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( ) require ( - code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241206061858-d583849c70ea + code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241207095049-e0ad89412565 code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241205075006-9c0bf995c788 code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 diff --git a/k8s/container-task.yaml b/k8s/container-task.yaml new file mode 100644 index 0000000..70502b0 --- /dev/null +++ b/k8s/container-task.yaml @@ -0,0 +1,55 @@ +kind: Deployment +apiVersion: apps/v1 +# 元数据 +metadata: + name: egg-admin-task + namespace: egg + labels: + app: egg-admin-task + annotations: + kubesphere.io/creator: admin + kubesphere.io/description: egg-admin-task +# deployment主要部分 +spec: + replicas: 1 + selector: + matchLabels: + # 名称与上面的labels对应 + app: egg-admin-task + template: + metadata: + labels: + # 名称与上面的matchLabels对应 + app: egg-admin-task + spec: + # 声明挂载卷(将外部已存在的pvc、config等挂载进来) + volumes: + # 用于时区校正 + - name: host-time + hostPath: + path: /etc/localtime + type: '' + # 将前面创建的configMap也挂载进来 + - name: egg-admin-task-cfg + configMap: + # 这里的名字就是前面创建的configMap的名字 + name: egg-admin-task-cfg + defaultMode: 420 + containers: + # 主容器 + - name: egg-admin-task-container + # 镜像地址(提前打包好并推送的镜像仓库) + image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/egg-admin-task:0.0.1' + # 将前面volume声明的需要用到的pvc、config挂载上来 + volumeMounts: + - name: host-time + readOnly: true + mountPath: /etc/localtime + - name: egg-admin-task-cfg # 该名字对应前面volumes声明的名字 + readOnly: true + # 挂载到容器的哪个路径 + mountPath: /var/egg + imagePullPolicy: Always + restartPolicy: Always + terminationGracePeriodSeconds: 30 + dnsPolicy: ClusterFirst \ No newline at end of file