Преглед изворни кода

Merge remote-tracking branch 'origin/master'

master
huangjiajun пре 2 дана
родитељ
комит
84988a8788
13 измењених фајлова са 87 додато и 24 уклоњено
  1. +6
    -4
      app/hdl/member_center/hdl_user_management.go
  2. +0
    -1
      app/md/member_center/md_user_management.go
  3. +3
    -1
      app/svc/advertising/svc_list.go
  4. +2
    -2
      app/svc/financial_center/svc_withdraw.go
  5. +2
    -2
      app/svc/im/svc_group.go
  6. +1
    -1
      app/svc/member_center/svc_user_management.go
  7. +49
    -0
      app/task/svc/svc_auto_delete_table_advertising_callback.go
  8. +7
    -6
      app/task/svc/svc_egg_energy_auto_update_user_access.go
  9. +10
    -0
      app/task/svc/svc_egg_energy_automatic_scoring.go
  10. +2
    -2
      docs/docs.go
  11. +2
    -2
      docs/swagger.json
  12. +2
    -2
      docs/swagger.yaml
  13. +1
    -1
      go.mod

+ 6
- 4
app/hdl/member_center/hdl_user_management.go Прегледај датотеку

@@ -586,7 +586,7 @@ func UserManagementGetOneBasic(c *gin.Context) {
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Param uid query string true "用户 ID"
// @Param type query string true "粉丝类型(1.全部 2.直推 3.二代 4.二代以后)"
// @Param type query string true "粉丝类型(0.全部 1.直推 2.二代 3.二代以后)"
// @Param limit query string true "每页大小"
// @Param page query string true "页数"
// @Success 200 {object} md.UserManagementGetFansResp "具体数据"
@@ -608,8 +608,10 @@ func UserManagementGetFans(c *gin.Context) {
level = 1
case "2":
level = 2
default:
case "3":
level = 3
default:
level = 0
}
relates, total, err := relateDb.PageFindUserRelateByParentUidAndLevel(utils.StrToInt64(uid), utils.StrToInt(page), utils.StrToInt(limit), level)
if err != nil {
@@ -639,7 +641,7 @@ func UserManagementGetFans(c *gin.Context) {
//3. 查询可提现余额
walletDb := implement.NewUserWalletDb(db.Db)
wallets, err := walletDb.FindUserWalletByParams(map[string]interface{}{
"key": uid,
"key": "uid",
"value": userIDs,
})
if err != nil {
@@ -672,7 +674,7 @@ func UserManagementGetFans(c *gin.Context) {
//5. 查询用户信息
userDb := implement.NewUserDb(db.Db)
users, err := userDb.UserFindByParams(map[string]interface{}{
"key": "uid",
"key": "id",
"value": userIDs,
})
if err != nil {


+ 0
- 1
app/md/member_center/md_user_management.go Прегледај датотеку

@@ -67,7 +67,6 @@ type UserManagementGetUserListResp struct {

type UserInfo struct {
model.User `xorm:"extends"`
TagID int `xorm:"tag_id"`
ParentPhone string `xorm:"parent_phone"`
ParentSystemInviteCode string `xorm:"parent_system_invite_code"`
ParentCustomInviteCode string `xorm:"parent_custom_invite_code"`


+ 3
- 1
app/svc/advertising/svc_list.go Прегледај датотеку

@@ -67,7 +67,9 @@ func VisitList(c *gin.Context) {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
uid = utils.Int64ToStr(user.Id)
if user != nil {
uid = utils.Int64ToStr(user.Id)
}
}
req.Platform = strings.ReplaceAll(req.Platform, " ", "")
req.Type = strings.ReplaceAll(req.Type, " ", "")


+ 2
- 2
app/svc/financial_center/svc_withdraw.go Прегледај датотеку

@@ -13,7 +13,7 @@ func WithDrawManagementGetApply(engine *xorm.Engine, req *md.GetWithdrawApplyLis
Join("LEFT OUTER", []string{"wx_user_info", "wx"}, "usera.id = wx.uid")

if req.Uid != "0" && req.Uid != "" {
session = session.Where("usera.uid = ?", req.Uid)
session = session.Where("usera.id = ?", req.Uid)
}

if req.Nickname != "" {
@@ -25,7 +25,7 @@ func WithDrawManagementGetApply(engine *xorm.Engine, req *md.GetWithdrawApplyLis
}

if req.ParentID != "0" && req.ParentID != "" {
session = session.Where("usera.parent_id = ?", req.ParentID)
session = session.Where("usera.parent_uid = ?", req.ParentID)
}

switch req.IsFirst {


+ 2
- 2
app/svc/im/svc_group.go Прегледај датотеку

@@ -4,7 +4,6 @@ import (
"applet/app/db"
"applet/app/db/im/model"
md "applet/app/md/im"
"errors"
"fmt"
)

@@ -18,7 +17,8 @@ func GroupList(req md.GroupListReq) (err error, resp md.GroupListResp) {
return
}
if !has {
return errors.New("群主账号不存在"), resp
//return errors.New("群主账号不存在"), resp
return nil, resp
}
var groupUserList []*model.GroupUser
err = db.DbIm.Where("`user_id`=? and member_type= 1", user.Id).Find(&groupUserList)


+ 1
- 1
app/svc/member_center/svc_user_management.go Прегледај датотеку

@@ -22,7 +22,7 @@ func UserManagementGetUsers(req *md.UserManagementGetUserListReq) ([]*md.UserInf
return nil, 0, err
}

err = pageSess.Distinct("a.*").Limit(req.Limit, (req.Page-1)*req.Limit).Desc("a.id").Find(&users)
err = pageSess.Select("a.*, b.phone as parent_phone, b.system_invite_code as parent_system_invite_code, b.custom_invite_code as parent_custom_invite_code").Distinct("a.*").Limit(req.Limit, (req.Page-1)*req.Limit).Desc("a.id").Find(&users)
if err != nil {
return nil, 0, err
}


+ 49
- 0
app/task/svc/svc_auto_delete_table_advertising_callback.go Прегледај датотеку

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

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
"fmt"
"time"
"xorm.io/xorm"
)

const advertisingCallbackDeleteLimit = 2

// AutoDeleteTableAdvertisingCallback 自动清除七天前 advertising_callback 表数据
func AutoDeleteTableAdvertisingCallback(engine *xorm.Engine) {
fmt.Println("auto_delete_table_advertising_callback.go...")
defer func() {
if err := recover(); err != nil {
fmt.Println(err)
return
}
}()
fmt.Println("----------------------------AutoDeleteTableAdvertisingCallback_begin-------------------------------")

now := time.Now()
if !(now.Hour() >= 2 && now.Hour() < 6) {
//TODO::只在凌晨两点 ~ 凌晨六点运行
return
}

for {
// 删除七天之前的数据
toDeleteDateStr := now.AddDate(0, 0, -7).Format("2006-01-02 15:04:05")
recordsDb := implement.NewAdvertisingCallbackDb(engine)
affected, err := recordsDb.AdvertisingCallbackDeleteByDateByPage(toDeleteDateStr, advertisingCallbackDeleteLimit)
if err != nil {
fmt.Println("AutoDeleteTableAdvertisingCallback_DeleteAdvertisingCallbackFailed:::", err)
return
}
if affected < advertisingCallbackDeleteLimit {
break
}
_, err = engine.Exec("OPTIMIZE table advertising_callback")
if err != nil {
fmt.Println("AutoDeleteTableAdvertisingCallback_OPTIMIZEFailed:::", err)
return
}
}

fmt.Println("---------------------------AutoDeleteTableAdvertisingCallback_end-------------------------------")
}

+ 7
- 6
app/task/svc/svc_egg_energy_auto_update_user_access.go Прегледај датотеку

@@ -14,7 +14,7 @@ const deleteLimit = 1000

// EggEnergyAutoUpdateUserAccess 自动更新用户访问次数记录
func EggEnergyAutoUpdateUserAccess(engine *xorm.Engine) {
fmt.Println("svc_egg_energy_auto_update_user_access...")
fmt.Println("egg_energy_auto_update_user_access...")
defer func() {
if err := recover(); err != nil {
fmt.Println(err)
@@ -77,12 +77,13 @@ func EggEnergyAutoUpdateUserAccess(engine *xorm.Engine) {
if affected < deleteLimit {
break
}
_, err = engine.Exec("OPTIMIZE table egg_access_records")
if err != nil {
fmt.Println("EggEnergyAutoUpdateUserAccess_OPTIMIZEFailed:::", err)
return
}
}
_, err := engine.Exec("OPTIMIZE table egg_access_records")
if err != nil {
fmt.Println("EggEnergyAutoUpdateUserAccess_OPTIMIZEFailed:::", err)
return
}

fmt.Println("----------------------------EggEnergyAutoUpdateUserAccess_end-------------------------------")

}

+ 10
- 0
app/task/svc/svc_egg_energy_automatic_scoring.go Прегледај датотеку

@@ -56,6 +56,7 @@ func EggEnergyAutomaticScoring(engine *xorm.Engine) {
yearString := utils.IntToStr(year)
weekString := utils.IntToStr(week)
LastWeekIndex := es.GetAppointIndexFromAlias(yearString, weekString)

// 1. 获取上周未被打分的文档
page := 1
limit := 100
@@ -111,6 +112,15 @@ func EggEnergyAutomaticScoring(engine *xorm.Engine) {
page++
}
}
nextWeekTime := now.AddDate(0, 0, 7)
nextYear, nextWeek := nextWeekTime.ISOWeek()
nextYearString := utils.IntToStr(nextYear)
nextWeekString := utils.IntToStr(nextWeek)
nextWeekIndex := es.GetAppointIndexFromAlias(nextYearString, nextWeekString)
err = es2.CreateIndexIfNotExists(nextWeekIndex, md.EggEnergyUserEggScoreEsMapping)
if err != nil {
fmt.Println("EggEnergyAutomaticScoringCreateIndex_ERR_FailedToCreateNextWeekIndex:::::", err.Error())
}
fmt.Println("------------------EggEnergyAutomaticScoring_end:finish automatic scoring------------------")
return
}

+ 2
- 2
docs/docs.go Прегледај датотеку

@@ -6741,7 +6741,7 @@ const docTemplate = `{
},
{
"type": "string",
"description": "粉丝类型(1.全部 2.直推 3.二代 4.二代以后)",
"description": "粉丝类型(0.全部 1.直推 2.二代 3.二代以后)",
"name": "type",
"in": "query",
"required": true
@@ -10751,7 +10751,7 @@ const docTemplate = `{
"md.ArticleDelReq": {
"type": "object",
"properties": {
"id": {
"ids": {
"type": "array",
"items": {
"type": "string"


+ 2
- 2
docs/swagger.json Прегледај датотеку

@@ -6734,7 +6734,7 @@
},
{
"type": "string",
"description": "粉丝类型(1.全部 2.直推 3.二代 4.二代以后)",
"description": "粉丝类型(0.全部 1.直推 2.二代 3.二代以后)",
"name": "type",
"in": "query",
"required": true
@@ -10744,7 +10744,7 @@
"md.ArticleDelReq": {
"type": "object",
"properties": {
"id": {
"ids": {
"type": "array",
"items": {
"type": "string"


+ 2
- 2
docs/swagger.yaml Прегледај датотеку

@@ -919,7 +919,7 @@ definitions:
type: object
md.ArticleDelReq:
properties:
id:
ids:
items:
type: string
type: array
@@ -9907,7 +9907,7 @@ paths:
name: uid
required: true
type: string
- description: 粉丝类型(1.全部 2.直推 3.二代 4.二代以后)
- description: 粉丝类型(0.全部 1.直推 2.二代 3.二代以后)
in: query
name: type
required: true


+ 1
- 1
go.mod Прегледај датотеку

@@ -33,7 +33,7 @@ require (
)

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241216144119-b08da56ec5ec
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241219083824-8eba71239d4f
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241217040418-3640cd7169f0
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


Loading…
Откажи
Сачувај