Browse Source

update

master
shenjiachi 1 month ago
parent
commit
f4264eccb1
13 changed files with 2831 additions and 134 deletions
  1. +4
    -4
      app/hdl/comm/hdl_comm.go
  2. +94
    -0
      app/hdl/friend_circle/hdl_basic.go
  3. +154
    -0
      app/hdl/friend_circle/hdl_black_list.go
  4. +303
    -0
      app/hdl/friend_circle/hdl_dynamic.go
  5. +17
    -0
      app/md/friend_circle/md_basic.go
  6. +38
    -0
      app/md/friend_circle/md_black_list.go
  7. +55
    -0
      app/md/friend_circle/md_dynamic.go
  8. +26
    -3
      app/router/router.go
  9. +29
    -0
      app/svc/friend_circle/svc_black_list.go
  10. +791
    -50
      docs/docs.go
  11. +791
    -50
      docs/swagger.json
  12. +527
    -25
      docs/swagger.yaml
  13. +2
    -2
      go.mod

+ 4
- 4
app/hdl/comm/hdl_comm.go View File

@@ -202,15 +202,15 @@ type GetSTSVoucherResp struct {
}

// GetSTSVoucher
// @Summary 通用请求-对象存储-STS临时访问凭证(获取)
// @Tags 对象存储
// @Summary 通用请求-打包机使用-STS临时访问凭证(获取)
// @Tags 打包机使用
// @Description STS临时访问凭证(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} comm.GetSTSVoucherResp "凭证及其他信息"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/comm/getSTSVoucher [GET]
// @Router /api/getSTSVoucher [GET]
func GetSTSVoucher(c *gin.Context) {
redisConn := cache.GetPool().Get()
sysCfgDb := implement.NewSysCfgDb(db.Db, redisConn)
@@ -269,7 +269,7 @@ func GetSTSVoucher(c *gin.Context) {
}

bucket := cfgMap[enum2.AliyunOssBucketName]
region := strings.Split(bucket, ".")[0]
region := strings.Split(endpoint, ".")[0]

resp := GetSTSVoucherResp{
STSToken: credentials,


+ 94
- 0
app/hdl/friend_circle/hdl_basic.go View File

@@ -0,0 +1,94 @@
package friend_circle

import (
"applet/app/db"
"applet/app/e"
md "applet/app/md/friend_circle"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"github.com/gin-gonic/gin"
"time"
)

// GetFriendCircleBasicSettings
// @Summary 社交管理-动态设置-基础设置(获取)
// @Tags 动态设置
// @Description 基础设置(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.GetFriendCircleBasicSettingsResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/basic/index [GET]
func GetFriendCircleBasicSettings(c *gin.Context) {
basicDb := implement.NewEggFriendCircleBasicDb(db.Db)
basic, err := basicDb.EggFriendCircleBasicGetOne()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if basic == nil {
now := time.Now()
m := model.EggFriendCircleBasic{
CommentIsRealName: 1,
PublishIsRealName: 1,
CommentNumsEveryDay: 0,
PublishNumsEveryDay: 0,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
_, err := basicDb.EggFriendCircleBasicInsert(&m)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
basic, err = basicDb.EggFriendCircleBasicGetOne()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
}
resp := md.GetFriendCircleBasicSettingsResp{
Id: basic.Id,
CommentIsRealName: basic.CommentIsRealName,
PublishIsRealName: basic.PublishIsRealName,
CommentNumsEveryDay: basic.CommentNumsEveryDay,
PublishNumsEveryDay: basic.PublishNumsEveryDay,
}

e.OutSuc(c, resp, nil)
}

// UpdateFriendCircleBasicSettings
// @Summary 社交管理-动态设置-基础设置(更新)
// @Tags 动态设置
// @Description 基础设置(更新)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.UpdateFriendCircleBasicSettingsReq true "id 必填"
// @Success 200 {int} "修改数据条数"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/basic/save [POST]
func UpdateFriendCircleBasicSettings(c *gin.Context) {
var req *md.UpdateFriendCircleBasicSettingsReq
if err := c.ShouldBindJSON(&req); err != nil {
e.OutErr(c, e.ERR_INVALID_ARGS, err)
return
}
m := model.EggFriendCircleBasic{
Id: req.Id,
CommentIsRealName: req.CommentIsRealName,
PublishIsRealName: req.PublishIsRealName,
CommentNumsEveryDay: req.CommentNumsEveryDay,
PublishNumsEveryDay: req.PublishNumsEveryDay,
}
columns := []string{"publish_nums_every_day", "comment_nums_every_day", "publish_is_real_name", "comment_is_real_name"}
basicDb := implement.NewEggFriendCircleBasicDb(db.Db)
affected, err := basicDb.UpdateEggFriendCircleBasic(&m, columns...)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
e.OutSuc(c, affected, nil)
}

+ 154
- 0
app/hdl/friend_circle/hdl_black_list.go View File

@@ -0,0 +1,154 @@
package friend_circle

import (
"applet/app/db"
"applet/app/e"
md "applet/app/md/friend_circle"
"applet/app/svc"
svc2 "applet/app/svc/friend_circle"
"applet/app/utils"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"github.com/gin-gonic/gin"
"time"
)

// GetBlackList
// @Summary 社交管理-动态设置-黑名单(获取)
// @Tags 动态设置
// @Description 黑名单(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param limit query int true "每页大小"
// @Param page query int true "页数"
// @Param phone query int true "手机号"
// @Param nickname query int true "用户名"
// @Param uid query int true "用户id"
// @Success 200 {object} md.GetBlackListResp "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/blackList/index [GET]
func GetBlackList(c *gin.Context) {
pageStr := c.DefaultQuery("page", "1")
limitStr := c.DefaultQuery("limit", "10")
phone := c.Query("phone")
nickname := c.Query("nickname")
uid := c.Query("uid")

page := utils.StrToInt(pageStr)
limit := utils.StrToInt(limitStr)

blackList, total, err2 := svc2.GetBlackList(page, limit, phone, nickname, uid)
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
return
}

adminIds := make([]int, 0, len(blackList))
for _, list := range blackList {
adminIds = append(adminIds, list.AdmId)
}
adminDb := implement.NewAdminDb(db.Db)
admins, err := adminDb.AdminFindByParams(map[string]interface{}{
"key": "adm_id",
"value": adminIds,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, nil)
return
}
adminMap := make(map[int]model.Admin, len(admins))
for _, admin := range admins {
adminMap[admin.AdmId] = admin
}
list := make([]md.GetBlackListNode, 0, len(blackList))
for _, black := range blackList {
node := md.GetBlackListNode{
BlackListId: black.Id,
Memo: black.Memo,
Uid: black.Uid,
UserNickname: black.UserNickname,
AdminId: black.AdmId,
AdminNickname: adminMap[black.AdmId].Username,
CreatedAt: black.CreateAt,
}
list = append(list, node)
}
resp := md.GetBlackListResp{
List: list,
Paginate: md.Paginate{
Limit: limit,
Page: page,
Total: total,
},
}
e.OutSuc(c, resp, nil)
}

// AddBlackList
// @Summary 社交管理-动态设置-黑名单(新增)
// @Tags 动态设置
// @Description 黑名单(新增)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.AddBlackListReq true "用户id 必填"
// @Success 200 {string} "生成的黑名单id"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/blackList/add [POST]
func AddBlackList(c *gin.Context) {
var req md.AddBlackListReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = svc.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

admin := svc.GetUser(c)
now := time.Now()
blackList := model.EggFriendCircleUserBlackList{
Uid: req.Uid,
AdmId: admin.AdmId,
Memo: req.Memo,
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
blackListDb := implement.NewEggFriendCircleUserBlackListDb(db.Db)
blackListId, err := blackListDb.EggFriendCircleUserBlackListInsert(&blackList)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, nil)
return
}
e.OutSuc(c, blackListId, nil)
}

// DeleteBlackList
// @Summary 社交管理-动态设置-黑名单(删除)
// @Tags 动态设置
// @Description 黑名单(删除)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.DeleteBlackListReq true "黑名单id 必填"
// @Success 200 {string} "删除数据数量"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/blackList/del [DELETE]
func DeleteBlackList(c *gin.Context) {
var req md.DeleteBlackListReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = svc.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
blackListDb := implement.NewEggFriendCircleUserBlackListDb(db.Db)
affected, err := blackListDb.EggFriendCircleUserBlackListDeleteById(req.BlackListId)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, nil)
return
}
e.OutSuc(c, affected, nil)
}

+ 303
- 0
app/hdl/friend_circle/hdl_dynamic.go View File

@@ -0,0 +1,303 @@
package friend_circle

import (
"applet/app/db"
"applet/app/e"
md "applet/app/md/friend_circle"
"applet/app/svc"
"applet/app/utils"
"applet/app/utils/cache"
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
svc2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/svc"
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
"context"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"github.com/olivere/elastic/v7"
"time"
)

// GetDynamic
// @Summary 社交管理-动态设置-动态(获取)
// @Tags 动态设置
// @Description 动态(获取)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.GetDynamicReq false "筛选条件"
// @Success 200 {object} md.GetDynamicResp "生成的黑名单id"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/dynamic/index [POST]
func GetDynamic(c *gin.Context) {
var req md.GetDynamicReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = svc.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

var userIds []int64
if req.Nickname != "" {
var users []md.UserIdsGetFromNickname
nickname := "%" + req.Nickname + "%"
err = db.Db.Table("user").Where("nickname like ?", nickname).Find(&users)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
for _, user := range users {
userIds = append(userIds, user.Id)
}
}

if req.Uid != "" {
uid := utils.StrToInt64(req.Uid)
userIds = append(userIds, uid)
}

if req.Page == 0 {
req.Page = 1
}
if req.Limit == 0 {
req.Limit = 10
}

aliasName := md2.EggFriendCircleEsAlias
boolQuery := elastic.NewBoolQuery()
if userIds != nil {
boolQuery.Filter(elastic.NewTermsQuery("uid", userIds))
}
if req.BeginAt != "" && req.EndAt != "" {
boolQuery.Filter(elastic.NewRangeQuery("created_at").Gte(req.BeginAt).Lte(req.EndAt).Format("yyyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"))
}
searchResult, err := es.EsClient.Search().
Index(aliasName).
Query(boolQuery).
From((req.Page-1)*req.Limit).Size(req.Limit).
Sort("created_at", true).
Pretty(true).
Do(context.Background())
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

var docs []md.EggFriendCircleNode
var docUserIds []int64
var total int64
// 检查是否有结果
if searchResult.Hits.TotalHits.Value != 0 {
// 解析结果
total = searchResult.Hits.TotalHits.Value
for _, hit := range searchResult.Hits.Hits {
var doc md.EggFriendCircleNode
err = json.Unmarshal(hit.Source, &doc)
if err != nil {
return
}
docUserIds = append(docUserIds, doc.Uid)
docs = append(docs, doc)
}
}

adminDb := implement.NewAdminDb(db.Db)
admins, err := adminDb.AdminFindByParams(map[string]interface{}{
"key": "adm_id",
"value": docUserIds,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
adminMap := make(map[int64]string)
for _, admin := range admins {
adminMap[int64(admin.AdmId)] = admin.Username
}

userDb := implement.NewUserDb(db.Db)
users, err := userDb.UserFindByParams(map[string]interface{}{
"key": "id",
"value": docUserIds,
})
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
userMap := make(map[int64]string)
for _, user := range users {
userMap[user.Id] = user.Nickname
}
redisConn := cache.GetPool().Get()
scheme, domain := svc2.ImageBucket(db.Db, redisConn)
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)
}

resp := md.GetDynamicResp{
List: docs,
Paginate: md.Paginate{
Limit: req.Limit,
Page: req.Page,
Total: total,
},
}
e.OutSuc(c, resp, nil)
}

// UpdateDynamic
// @Summary 社交管理-动态设置-动态(更新)
// @Tags 动态设置
// @Description 动态(更新)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.UpdateDynamicReq true "更新动态id必填"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/dynamic/update [POST]
func UpdateDynamic(c *gin.Context) {
var req md.UpdateDynamicReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = svc.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}
updateMap := make(map[string]interface{})
if req.State != 0 {
updateMap["state"] = req.State
}
if req.IsTopUp != 0 {
updateMap["is_top_up"] = req.IsTopUp
}
if req.IsPraise != 0 {
updateMap["is_praise"] = req.IsPraise
}

aliasName := md2.EggFriendCircleEsAlias
_, err = es.EsClient.Update().
Index(aliasName).
Id(req.IndexId).
Doc(updateMap).
Do(context.Background())
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

e.OutSuc(c, "success", nil)
}

// DeleteDynamic
// @Summary 社交管理-动态设置-动态(删除)
// @Tags 动态设置
// @Description 动态(删除)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.DeleteDynamicReq true "删除动态id必填"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/dynamic/del [DELETE]
func DeleteDynamic(c *gin.Context) {
var req md.DeleteDynamicReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = svc.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

aliasName := md2.EggFriendCircleEsAlias
_, err = es.EsClient.Delete().
Index(aliasName).
Id(req.IndexId).
Do(context.Background())
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

e.OutSuc(c, "success", nil)
}

// ReleaseDynamic
// @Summary 社交管理-动态设置-动态(发布)
// @Tags 动态设置
// @Description 动态(发布)
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param req body md.ReleaseDynamicReq true "发布动态信息"
// @Success 200 {string} "success"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/friendCircleSettings/dynamic/release [POST]
func ReleaseDynamic(c *gin.Context) {
var req md.ReleaseDynamicReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = svc.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

user := svc.GetUser(c)
if req.State == 0 {
req.State = 1
}
if req.Kind == 0 {
req.Kind = 1
}
if req.IsPraise == 0 {
req.IsPraise = 2
}
if req.IsTopUp == 0 {
req.IsTopUp = 2
}

now := time.Now()
m := md2.EggFriendCircleEs{
Uid: int64(user.AdmId),
Kind: req.Kind,
Content: req.Content,
Image: req.Image,
Video: req.Video,
LikesNums: 0,
ShareNums: 0,
CommentNums: 0,
State: req.State,
IsTopUp: req.IsTopUp,
IsPraise: req.IsPraise,
CreatedAt: now.Format("2006-01-02 15:04:05"),
UpdatedAt: now.Format("2006-01-02 15:04:05"),
}
id := fmt.Sprintf("%d-%d", now.Unix(), user.AdmId)

aliasName := md2.EggFriendCircleEsAlias
_, err = es.EsClient.Index().
Index(aliasName).
Id(id).
BodyJson(m).
Do(context.Background())
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}

e.OutSuc(c, "success", nil)
}

+ 17
- 0
app/md/friend_circle/md_basic.go View File

@@ -0,0 +1,17 @@
package md

type GetFriendCircleBasicSettingsResp struct {
Id int `json:"id"`
CommentIsRealName int `json:"comment_is_real_name"` // 评论是否需要实名认证(1:是 2:否)
PublishIsRealName int `json:"publish_is_real_name"` // 发布是否需要实名认证(1:是 2:否)
CommentNumsEveryDay int `json:"comment_nums_every_day"` // 评论每天次数
PublishNumsEveryDay int `json:"publish_nums_every_day"` // 发布每天次数
}

type UpdateFriendCircleBasicSettingsReq struct {
Id int `json:"id,required"`
CommentIsRealName int `json:"comment_is_real_name"` // 评论是否需要实名认证(1:是 2:否)
PublishIsRealName int `json:"publish_is_real_name"` // 发布是否需要实名认证(1:是 2:否)
CommentNumsEveryDay int `json:"comment_nums_every_day"` // 评论每天次数
PublishNumsEveryDay int `json:"publish_nums_every_day"` // 发布每天次数
}

+ 38
- 0
app/md/friend_circle/md_black_list.go View File

@@ -0,0 +1,38 @@
package md

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type Paginate struct {
Limit int `json:"limit"` // 每页大小
Page int `json:"page"` // 页数
Total int64 `json:"total"` // 总数据量
}

type GetBlackListNode struct {
BlackListId int `json:"black_list_id"` // 黑名单 id
Memo string `json:"memo"` // 备注
Uid int64 `json:"uid"` // 用户 id
UserNickname string `json:"user_nickname"` // 用户名称
AdminId int `json:"admin_id"` // 管理员 id
AdminNickname string `json:"admin_nickname"` // 管理员名称
CreatedAt string `json:"created_at"` // 添加时间
}

type GetBlackListResp struct {
List []GetBlackListNode `json:"list"` // 具体信息
Paginate Paginate `json:"paginate"` // 分页信息
}

type AddBlackListReq struct {
Uid int64 `json:"uid,required"` // 用户 id
Memo string `json:"memo"` // 备注
}

type DeleteBlackListReq struct {
BlackListId int `json:"id,required"` // 黑名单 id
}

type BlackListInfo struct {
model.EggFriendCircleUserBlackList `xorm:"extends"`
UserNickname string `xorm:"user.nickname"`
}

+ 55
- 0
app/md/friend_circle/md_dynamic.go View File

@@ -0,0 +1,55 @@
package md

type GetDynamicReq struct {
BeginAt string `json:"begin_at"` // 开始时间
EndAt string `json:"end_at"` // 结束时间
Uid string `json:"uid"` // 创建人id
Nickname string `json:"nickname"` // 创建人名称
Page int `json:"page"` // 页数
Limit int `json:"limit"` // 页面大小
}

type UserIdsGetFromNickname struct {
Id int64 `xorm:"id"`
}

type EggFriendCircleNode 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"` // 分页信息
}

type UpdateDynamicReq struct {
IndexId string `json:"index_id,required"` // 动态id
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:否)
}

type DeleteDynamicReq struct {
IndexId string `json:"index_id"` // 动态id
}

type ReleaseDynamicReq struct {
Kind int32 `json:"kind"` // 类型(1:普通 2:官方)
Content string `json:"content"` // 文本内容
Image string `json:"image"` // 图片 uri
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:否)
}

+ 26
- 3
app/router/router.go View File

@@ -8,6 +8,7 @@ import (
"applet/app/hdl/cloud_bundle"
"applet/app/hdl/comm"
"applet/app/hdl/financial_center"
"applet/app/hdl/friend_circle"
"applet/app/hdl/im"
"applet/app/hdl/institutional_management/egg_energy"
"applet/app/hdl/institutional_management/module_setting"
@@ -68,6 +69,7 @@ func route(r *gin.RouterGroup) {
r.GET("/cloudBundle/base", cloud_bundle.Base) //打包基本信息
r.GET("/cloudBundle/update/state", cloud_bundle.UpdateState) //打包更新状态
r.GET("/cloudBundle/upload", cloud_bundle.Upload) //打包 上传apk
r.GET("/getSTSVoucher", comm.GetSTSVoucher) // 获取 STS 凭证
}
r.Use(mw.Auth) // 以下接口需要JWT验证
rComm(r.Group("/comm"))
@@ -84,8 +86,9 @@ func route(r *gin.RouterGroup) {
rNotice(r.Group("/notice"))
rArticle(r.Group("/article"))
rUserFeedback(r.Group("/userFeedback"))
rCloudBundle(r.Group("/cloudBundle")) //云打包
rUserRealName(r.Group("/userRealName")) //实名认证
rCloudBundle(r.Group("/cloudBundle")) //云打包
rUserRealName(r.Group("/userRealName")) //实名认证
rFriendCircleSettings(r.Group("/friendCircleSettings")) // 朋友圈设置
}

func rSettCenter(r *gin.RouterGroup) { //设置中心
@@ -335,8 +338,28 @@ func rFinancialCenter(r *gin.RouterGroup) {
}
}

func rFriendCircleSettings(r *gin.RouterGroup) {
rBasic := r.Group("/basic")
{
rBasic.GET("/index", friend_circle.GetFriendCircleBasicSettings)
rBasic.POST("/save", friend_circle.UpdateFriendCircleBasicSettings)
}
rBlackList := r.Group("/blackList")
{
rBlackList.GET("/index", friend_circle.GetBlackList)
rBlackList.POST("/add", friend_circle.AddBlackList)
rBlackList.DELETE("/del", friend_circle.DeleteBlackList)
}
rDynamic := r.Group("/dynamic")
{
rDynamic.POST("/index", friend_circle.GetDynamic)
rDynamic.POST("/update", friend_circle.UpdateDynamic)
rDynamic.DELETE("/del", friend_circle.DeleteDynamic)
rDynamic.POST("/release", friend_circle.ReleaseDynamic)
}
}

func rComm(r *gin.RouterGroup) {
r.POST("/getMenuList", comm.MenuList) // 获取菜单栏列表
r.POST("/getOssUrl", comm.GetOssUrl) // 获取阿里云上传PutObject所需的签名URL
r.GET("/getSTSVoucher", comm.GetSTSVoucher)
}

+ 29
- 0
app/svc/friend_circle/svc_black_list.go View File

@@ -0,0 +1,29 @@
package svc

import (
"applet/app/db"
md "applet/app/md/friend_circle"
)

func GetBlackList(page, limit int, phone, nickname, uid string) ([]md.BlackListInfo, int64, error) {
blackLists := make([]md.BlackListInfo, 0)
session := db.Db.Table("egg_friend_circle_user_black_list").Alias("black").
Join("LEFT OUTER", "user", "black.uid = user.id")
if phone != "" {
phone = "%" + phone + "%"
session.Where("user.phone like ?", phone)
}
if nickname != "" {
nickname = "%" + nickname + "%"
session.Where("nickname like ?", nickname)
}
if uid != "" {
uid = "%" + uid + "%"
session.Where("uid like ?", uid)
}
total, err := session.Limit(limit, (page-1)*limit).FindAndCount(&blackLists)
if err != nil {
return nil, 0, err
}
return blackLists, total, nil
}

+ 791
- 50
docs/docs.go
File diff suppressed because it is too large
View File


+ 791
- 50
docs/swagger.json
File diff suppressed because it is too large
View File


+ 527
- 25
docs/swagger.yaml View File

@@ -18,6 +18,18 @@ definitions:
tag_name:
type: string
type: object
applet_app_md_friend_circle.Paginate:
properties:
limit:
description: 每页大小
type: integer
page:
description: 页数
type: integer
total:
description: 总数据量
type: integer
type: object
applet_app_md_im.GetBasicResp:
properties:
chat_sensitive_words:
@@ -319,6 +331,15 @@ definitions:
example: 手机号
type: string
type: object
md.AddBlackListReq:
properties:
memo:
description: 备注
type: string
uid:
description: 用户 id
type: integer
type: object
md.AddCommunityDividendsReq:
properties:
amount:
@@ -1131,6 +1152,18 @@ definitions:
example: 团队区域
type: string
type: object
md.DeleteBlackListReq:
properties:
id:
description: 黑名单 id
type: integer
type: object
md.DeleteDynamicReq:
properties:
index_id:
description: 动态id
type: string
type: object
md.DeleteEmoticonReq:
properties:
id:
@@ -1340,6 +1373,43 @@ 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.ExchangeRulesStruct:
properties:
auto_exchange_nums_by_person:
@@ -1560,6 +1630,42 @@ definitions:
description: 持有该类型用户数
type: integer
type: object
md.GetBlackListNode:
properties:
admin_id:
description: 管理员 id
type: integer
admin_nickname:
description: 管理员名称
type: string
black_list_id:
description: 黑名单 id
type: integer
created_at:
description: 添加时间
type: string
memo:
description: 备注
type: string
uid:
description: 用户 id
type: integer
user_nickname:
description: 用户名称
type: string
type: object
md.GetBlackListResp:
properties:
list:
description: 具体信息
items:
$ref: '#/definitions/md.GetBlackListNode'
type: array
paginate:
allOf:
- $ref: '#/definitions/applet_app_md_friend_circle.Paginate'
description: 分页信息
type: object
md.GetContributionValueBasicSettingResp:
properties:
hand_out_red_package:
@@ -1577,6 +1683,38 @@ definitions:
description: 发布创作获得x点
type: integer
type: object
md.GetDynamicReq:
properties:
begin_at:
description: 开始时间
type: string
end_at:
description: 结束时间
type: string
limit:
description: 页面大小
type: integer
nickname:
description: 创建人名称
type: string
page:
description: 页数
type: integer
uid:
description: 创建人id
type: string
type: object
md.GetDynamicResp:
properties:
list:
items:
$ref: '#/definitions/md.EggFriendCircleNode'
type: array
paginate:
allOf:
- $ref: '#/definitions/applet_app_md_friend_circle.Paginate'
description: 分页信息
type: object
md.GetEggCoreDataListResp:
properties:
now_energy_total_nums:
@@ -1672,6 +1810,23 @@ definitions:
- $ref: '#/definitions/applet_app_md_institutional_management_public_platoon.Paginate'
description: 分页信息
type: object
md.GetFriendCircleBasicSettingsResp:
properties:
comment_is_real_name:
description: 评论是否需要实名认证(1:是 2:否)
type: integer
comment_nums_every_day:
description: 评论每天次数
type: integer
id:
type: integer
publish_is_real_name:
description: 发布是否需要实名认证(1:是 2:否)
type: integer
publish_nums_every_day:
description: 发布每天次数
type: integer
type: object
md.GetFundDataListReq:
properties:
end_at:
@@ -2884,6 +3039,30 @@ definitions:
description: 高于x元
type: string
type: object
md.ReleaseDynamicReq:
properties:
content:
description: 文本内容
type: string
image:
description: 图片 uri
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
video:
description: 视频 uri
type: string
type: object
md.Response:
properties:
code:
@@ -3241,6 +3420,21 @@ definitions:
example: 备注
type: string
type: object
md.UpdateDynamicReq:
properties:
index_id:
description: 动态id
type: string
is_praise:
description: 是否被表扬(1:是 2:否)
type: integer
is_top_up:
description: 是否置顶(1:是 2:否)
type: integer
state:
description: 状态(1:正常 2:隐藏)
type: integer
type: object
md.UpdateEggEnergyBasicReq:
properties:
basic_setting:
@@ -3307,6 +3501,23 @@ definitions:
description: 排序
type: integer
type: object
md.UpdateFriendCircleBasicSettingsReq:
properties:
comment_is_real_name:
description: 评论是否需要实名认证(1:是 2:否)
type: integer
comment_nums_every_day:
description: 评论每天次数
type: integer
id:
type: integer
publish_is_real_name:
description: 发布是否需要实名认证(1:是 2:否)
type: integer
publish_nums_every_day:
description: 发布每天次数
type: integer
type: object
md.UpdateLevelReq:
properties:
auto_update:
@@ -5290,31 +5501,6 @@ paths:
summary: 通用请求-对象存储-上传许可链接(获取)
tags:
- 对象存储
/api/comm/getSTSVoucher:
get:
consumes:
- application/json
description: STS临时访问凭证(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 凭证及其他信息
schema:
$ref: '#/definitions/comm.GetSTSVoucherResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 通用请求-对象存储-STS临时访问凭证(获取)
tags:
- 对象存储
/api/config:
get:
consumes:
@@ -5452,6 +5638,322 @@ paths:
summary: 财务中心-提现-基础设置(更新)
tags:
- 提现
/api/friendCircleSettings/basic/index:
get:
consumes:
- application/json
description: 基础设置(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.GetFriendCircleBasicSettingsResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-基础设置(获取)
tags:
- 动态设置
/api/friendCircleSettings/basic/save:
post:
consumes:
- application/json
description: 基础设置(更新)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: id 必填
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.UpdateFriendCircleBasicSettingsReq'
produces:
- application/json
responses:
"200":
description: 修改数据条数
schema:
type: int
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-基础设置(更新)
tags:
- 动态设置
/api/friendCircleSettings/blackList/add:
post:
consumes:
- application/json
description: 黑名单(新增)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 用户id 必填
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.AddBlackListReq'
produces:
- application/json
responses:
"200":
description: 生成的黑名单id
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-黑名单(新增)
tags:
- 动态设置
/api/friendCircleSettings/blackList/del:
delete:
consumes:
- application/json
description: 黑名单(删除)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 黑名单id 必填
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.DeleteBlackListReq'
produces:
- application/json
responses:
"200":
description: 删除数据数量
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-黑名单(删除)
tags:
- 动态设置
/api/friendCircleSettings/blackList/index:
get:
consumes:
- application/json
description: 黑名单(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 每页大小
in: query
name: limit
required: true
type: integer
- description: 页数
in: query
name: page
required: true
type: integer
- description: 手机号
in: query
name: phone
required: true
type: integer
- description: 用户名
in: query
name: nickname
required: true
type: integer
- description: 用户id
in: query
name: uid
required: true
type: integer
produces:
- application/json
responses:
"200":
description: 具体数据
schema:
$ref: '#/definitions/md.GetBlackListResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-黑名单(获取)
tags:
- 动态设置
/api/friendCircleSettings/dynamic/del:
delete:
consumes:
- application/json
description: 动态(删除)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 删除动态id必填
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.DeleteDynamicReq'
produces:
- application/json
responses:
"200":
description: success
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-动态(删除)
tags:
- 动态设置
/api/friendCircleSettings/dynamic/index:
post:
consumes:
- application/json
description: 动态(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 筛选条件
in: body
name: req
schema:
$ref: '#/definitions/md.GetDynamicReq'
produces:
- application/json
responses:
"200":
description: 生成的黑名单id
schema:
$ref: '#/definitions/md.GetDynamicResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-动态(获取)
tags:
- 动态设置
/api/friendCircleSettings/dynamic/release:
post:
consumes:
- application/json
description: 动态(发布)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 发布动态信息
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.ReleaseDynamicReq'
produces:
- application/json
responses:
"200":
description: success
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-动态(发布)
tags:
- 动态设置
/api/friendCircleSettings/dynamic/update:
post:
consumes:
- application/json
description: 动态(更新)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
- description: 更新动态id必填
in: body
name: req
required: true
schema:
$ref: '#/definitions/md.UpdateDynamicReq'
produces:
- application/json
responses:
"200":
description: success
schema:
type: string
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 社交管理-动态设置-动态(更新)
tags:
- 动态设置
/api/getSTSVoucher:
get:
consumes:
- application/json
description: STS临时访问凭证(获取)
parameters:
- description: 验证参数Bearer和token空格拼接
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: 凭证及其他信息
schema:
$ref: '#/definitions/comm.GetSTSVoucherResp'
"400":
description: 具体错误
schema:
$ref: '#/definitions/md.Response'
summary: 通用请求-打包机使用-STS临时访问凭证(获取)
tags:
- 打包机使用
/api/homePage/activeData:
get:
consumes:


+ 2
- 2
go.mod View File

@@ -32,8 +32,8 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241130022153-9f7ff6c9f078
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241202132506-ba937bba9e16
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241203104348-2e593fa11d5d
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241203080408-75cfef2c6334
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
github.com/360EntSecGroup-Skylar/excelize v1.4.1


Loading…
Cancel
Save