diff --git a/app/hdl/member_center/hdl_user_management.go b/app/hdl/member_center/hdl_user_management.go index d2c9e7c..df581d2 100644 --- a/app/hdl/member_center/hdl_user_management.go +++ b/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 { diff --git a/app/md/member_center/md_user_management.go b/app/md/member_center/md_user_management.go index f1d2e8e..abd4236 100644 --- a/app/md/member_center/md_user_management.go +++ b/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"` diff --git a/app/svc/advertising/svc_list.go b/app/svc/advertising/svc_list.go index 1225c1a..270305b 100644 --- a/app/svc/advertising/svc_list.go +++ b/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, " ", "") diff --git a/app/svc/financial_center/svc_withdraw.go b/app/svc/financial_center/svc_withdraw.go index a138c95..b0ef5af 100644 --- a/app/svc/financial_center/svc_withdraw.go +++ b/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 { diff --git a/app/svc/im/svc_group.go b/app/svc/im/svc_group.go index f4b75e3..454e641 100644 --- a/app/svc/im/svc_group.go +++ b/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) diff --git a/app/svc/member_center/svc_user_management.go b/app/svc/member_center/svc_user_management.go index 3dd1d48..ed637df 100644 --- a/app/svc/member_center/svc_user_management.go +++ b/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 } diff --git a/app/task/svc/svc_auto_delete_table_advertising_callback.go b/app/task/svc/svc_auto_delete_table_advertising_callback.go new file mode 100644 index 0000000..1643bf9 --- /dev/null +++ b/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-------------------------------") +} 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 index d38e6e9..9dabbd0 100644 --- a/app/task/svc/svc_egg_energy_auto_update_user_access.go +++ b/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-------------------------------") } diff --git a/app/task/svc/svc_egg_energy_automatic_scoring.go b/app/task/svc/svc_egg_energy_automatic_scoring.go index f03ee7e..a27f76a 100644 --- a/app/task/svc/svc_egg_energy_automatic_scoring.go +++ b/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 } diff --git a/docs/docs.go b/docs/docs.go index 5fa4cfc..95bf4a9 100644 --- a/docs/docs.go +++ b/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" diff --git a/docs/swagger.json b/docs/swagger.json index 7a429ae..0c237db 100644 --- a/docs/swagger.json +++ b/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" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index ad84fc6..8267843 100644 --- a/docs/swagger.yaml +++ b/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 diff --git a/go.mod b/go.mod index b429e86..5f8d07b 100644 --- a/go.mod +++ b/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