diff --git a/app/hdl/hdl_add_friend.go b/app/hdl/hdl_add_friend.go index aa56d49..5009681 100644 --- a/app/hdl/hdl_add_friend.go +++ b/app/hdl/hdl_add_friend.go @@ -61,8 +61,10 @@ func EggEnergyDetails(c *gin.Context) { isAsc := false if req.Kind == "1" { // 待结 coinID = eggEnergyBasicSetting.PersonEggEnergyCoinId - } else { // 可用 + } else if req.Kind == "2" { // 可用 coinID = eggEnergyBasicSetting.TeamEggEnergyCoinId + } else { + coinID = 0 } if req.Asc == "1" { isAsc = true @@ -245,8 +247,10 @@ func EggPointDetails(c *gin.Context) { isAsc := false if req.Kind == "1" { // 待结 coinID = eggEnergyBasicSetting.PersonEggPointsCoinId - } else { // 可用 + } else if req.Kind == "2" { // 可用 coinID = eggEnergyBasicSetting.TeamEggPointsCoinId + } else { + coinID = 0 } if req.Asc == "1" { isAsc = true @@ -288,12 +292,12 @@ func EggPointDetails(c *gin.Context) { } virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) var totalEggPoints float64 - personEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) + personEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggPointsCoinId) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return } - teamEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggEnergyCoinId) + teamEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggPointsCoinId) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -406,6 +410,7 @@ func BasalRate(c *gin.Context) { ConsumedEggPoint: "0", EstimatedRevenue: "0", SignCountdown: "00:00:00", + SignTimeSecs: 0, } e.OutSuc(c, resp, nil) return @@ -444,22 +449,23 @@ func BasalRate(c *gin.Context) { basalRate := basalRateDecimal.Mul(decimal.NewFromInt(60 * 60)) // 收益倒计时 var signCountdown string - var signTimeSecs float64 + var signTimeSecs int duration := utils.TimeParseStd(eggSignIn.EndTime).Sub(now) // 计算时间差值 if duration > 0 { hours := duration / time.Hour // 获取小时部分 minutes := duration % time.Hour / time.Minute // 获取分钟部分(先除去小时后再乘以60) seconds := int64(duration/time.Second) % 60 signCountdown = fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时 - signTimeSecs = duration.Seconds() + signTimeSecs = int(duration.Seconds()) + } else { signCountdown = fmt.Sprintf("00:00:00") } resp := md.BasalRateResp{ - ConsumedTime: consumedTime.String(), + ConsumedTime: consumedTime.StringFixed(2), ConsumedEggEnergy: consumedEggEnergy.String(), - RemainingTime: remainingTime.String(), + RemainingTime: remainingTime.StringFixed(2), RemainingEggEnergy: remainingEggEnergy.String(), BasalRate: basalRate.String(), ConsumedEggPoint: eggSignIn.TotalPersonEggPoints, diff --git a/app/hdl/hdl_config.go b/app/hdl/hdl_config.go index 705bcaa..f4c6397 100644 --- a/app/hdl/hdl_config.go +++ b/app/hdl/hdl_config.go @@ -41,7 +41,7 @@ func Config(c *gin.Context) { privacyArticle, _ := NewArticleDb.GetArticle("114") if privacyArticle != nil { res.PrivacyTitle = privacyArticle.Title - res.PrivacyUrl = fmt.Sprintf("%s%s?id=%s&is_hide=1", svc.GetSysCfgStr("wap_host"), "/#/pages/course-detail-page/course-detail-page", utils.AnyToString(userArticle.Id)) + res.PrivacyUrl = fmt.Sprintf("%s%s?id=%s&is_hide=1", svc.GetSysCfgStr("wap_host"), "/#/pages/course-detail-page/course-detail-page", utils.AnyToString(privacyArticle.Id)) } res.OssUrl = svc.GetOssDomain() appCloudBundleData := svc.GetSysCfgStr("app_cloud_bundle_data") diff --git a/app/hdl/hdl_points_center.go b/app/hdl/hdl_points_center.go index d59a56f..acb67cc 100644 --- a/app/hdl/hdl_points_center.go +++ b/app/hdl/hdl_points_center.go @@ -581,7 +581,12 @@ func GetContributionValue(c *gin.Context) { } var contributionValue string if virtualAmount != nil { - contributionValue = virtualAmount.Amount + contributionValueDecimal, err := decimal.NewFromString(virtualAmount.Amount) + if err != nil { + e.OutErr(c, e.ERR_UNMARSHAL, err.Error()) + return + } + contributionValue = contributionValueDecimal.StringFixed(0) } coinDb := implement.NewVirtualCoinDb(db.Db) @@ -650,7 +655,12 @@ func GetContributionValueFlow(c *gin.Context) { list := make([]md.ContributionValueFlowNode, len(flows)) for i, flow := range flows { list[i].Title = flow.Title - list[i].Amount = flow.Amount + amountDecimal, err1 := decimal.NewFromString(flow.Amount) + if err1 != nil { + e.OutErr(c, e.ERR_UNMARSHAL, err1.Error()) + return + } + list[i].Amount = amountDecimal.StringFixed(0) list[i].Direction = utils.IntToStr(flow.Direction) list[i].CreateAt = flow.CreateAt } diff --git a/app/hdl/hdl_user.go b/app/hdl/hdl_user.go index 32bb210..c462af1 100644 --- a/app/hdl/hdl_user.go +++ b/app/hdl/hdl_user.go @@ -362,11 +362,13 @@ func Delete(c *gin.Context) { if err == nil { defer ch.Release() err = ch.PublishV2(md.EggUserExchange, md.CommUserId{ - Uid: utils.Int64ToStr(user.Id), + Uid: utils.Int64ToStr(user.Id), + ParentUid: utils.Int64ToStr(user.ParentUid), }, md.EggUserDelete) if err != nil { ch.PublishV2(md.EggUserExchange, md.CommUserId{ - Uid: utils.Int64ToStr(user.Id), + Uid: utils.Int64ToStr(user.Id), + ParentUid: utils.Int64ToStr(user.ParentUid), }, md.EggUserDelete) } } diff --git a/app/hdl/hdl_wallet.go b/app/hdl/hdl_wallet.go index d9c65ba..aa133ac 100644 --- a/app/hdl/hdl_wallet.go +++ b/app/hdl/hdl_wallet.go @@ -363,8 +363,7 @@ func GetWithdrawCondition(c *gin.Context) { //1. 判断是否为第一次提现 isFirst := false - has, err := db.Db.Where("uid = ?", user.Id). - Get(model.FinWithdrawApply{}) + has, err := db.Db.Where("uid = ?", user.Id).Get(model.FinWithdrawApply{}) if !has { //第一次提现 isFirst = true } diff --git a/app/md/md_add_friend.go b/app/md/md_add_friend.go index d28ceff..d6890ce 100644 --- a/app/md/md_add_friend.go +++ b/app/md/md_add_friend.go @@ -87,15 +87,15 @@ type NineDimensionalSpaceResp struct { } type BasalRateResp struct { - ConsumedTime string `json:"consumed_time"` // 消耗时间/小时 - ConsumedEggEnergy string `json:"consumed_egg_energy"` // 收益蛋蛋能量 - RemainingTime string `json:"remaining_time"` // 剩余时间/小时 - RemainingEggEnergy string `json:"remaining_egg_energy"` // 剩余蛋蛋能量 - BasalRate string `json:"basal_rate"` // 基础速率 - ConsumedEggPoint string `json:"consumed_egg_point"` // 消耗蛋蛋积分 - EstimatedRevenue string `json:"estimated_revenue"` // 预估收益蛋蛋能量 - SignCountdown string `json:"sign_countdown"` // 收益倒计时 - SignTimeSecs float64 `json:"sign_time_secs"` // 收益倒计时秒数 + ConsumedTime string `json:"consumed_time"` // 消耗时间/小时 + ConsumedEggEnergy string `json:"consumed_egg_energy"` // 收益蛋蛋能量 + RemainingTime string `json:"remaining_time"` // 剩余时间/小时 + RemainingEggEnergy string `json:"remaining_egg_energy"` // 剩余蛋蛋能量 + BasalRate string `json:"basal_rate"` // 基础速率 + ConsumedEggPoint string `json:"consumed_egg_point"` // 消耗蛋蛋积分 + EstimatedRevenue string `json:"estimated_revenue"` // 预估收益蛋蛋能量 + SignCountdown string `json:"sign_countdown"` // 收益倒计时 + SignTimeSecs int `json:"sign_time_secs"` // 收益倒计时秒数 } type TotalRateResp struct { diff --git a/app/md/md_mq.go b/app/md/md_mq.go index 8292fea..05d6ba5 100644 --- a/app/md/md_mq.go +++ b/app/md/md_mq.go @@ -22,7 +22,8 @@ type PlayletReward struct { Uid string `json:"uid"` } type CommUserId struct { - Uid string `json:"uid"` + Uid string `json:"uid"` + ParentUid string `json:"parent_uid"` } type JpushRecordFundData struct { Id string `json:"id"` diff --git a/app/svc/svc_points_center.go b/app/svc/svc_points_center.go index 5c8c603..9306a95 100644 --- a/app/svc/svc_points_center.go +++ b/app/svc/svc_points_center.go @@ -92,9 +92,11 @@ func GetEggPointRecordBase(now time.Time, uid int64, page int, limit int) ([]md. for i := 0; i < limit; i++ { var tempDays int if getLastWeek { - tempDays = 7 * ((page-1)*limit + i + 1) + // 未到周三下午两点,从上上周开始查询 + tempDays = 7 * ((page-1)*limit + i + 2) } else { - tempDays = 7 * ((page-1)*limit + i) + // 已过周三下午两点,从上周开始查询 + tempDays = 7 * ((page-1)*limit + i + 1) } tempTime := now.AddDate(0, 0, -tempDays) tempYear, tempWeek := tempTime.ISOWeek() diff --git a/app/svc/svc_withdraw_apply.go b/app/svc/svc_withdraw_apply.go index dbb16e1..b6f39d6 100644 --- a/app/svc/svc_withdraw_apply.go +++ b/app/svc/svc_withdraw_apply.go @@ -250,6 +250,8 @@ func GetWithdrawCondition(user *model.User, setting *model.FinWithdrawSetting, i utils.Unserialize([]byte(setting.FirstWithdrawSet), &firstWithdrawSet) if firstWithdrawSet.IsNeedRealName == 0 { resp.IsNeedRealName = false + resp.IsCanWithdraw = true + resp.NotWithdrawReason = "" } } diff --git a/app/task/svc/svc_no_login_send.go b/app/task/svc/svc_no_login_send.go index 7be91fa..8caf528 100644 --- a/app/task/svc/svc_no_login_send.go +++ b/app/task/svc/svc_no_login_send.go @@ -57,15 +57,19 @@ WHERE unt.login_time<'%d' and unt.login_notice_time<'%d' and unt.login_time>0 %s data.Content = strings.ReplaceAll(data.Content, "{手机号}", v["phone"]) data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour)) extra = "{\"hour\":\"" + utils.Int64ToStr(hour) + "\"}" - arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content} - err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) - if err != nil { - ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) + if data.JpushOpen == 1 { + arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content} + err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) + if err != nil { + ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) + } } - arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra} - err = ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) - if err != nil { - ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) + if data.SmsOpen == 1 { + arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra} + err := ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) + if err != nil { + ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) + } } eg.Where("id=?", v["unt_id"]).Cols("login_notice_time").Update(&model.UserNoticeTime{LoginNoticeTime: int(time.Now().Unix())}) } diff --git a/app/task/svc/svc_no_sign_send.go b/app/task/svc/svc_no_sign_send.go index e47aff3..cb1c8f9 100644 --- a/app/task/svc/svc_no_sign_send.go +++ b/app/task/svc/svc_no_sign_send.go @@ -56,15 +56,19 @@ WHERE unt.sign_time<'%d' and unt.sign_notice_time<'%d' and unt.sign_time>0 %s data.Content = strings.ReplaceAll(data.Content, "{手机号}", v["phone"]) data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour)) extra = "{\"hour\":\"" + utils.Int64ToStr(hour) + "\"}" - arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content} - err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) - if err != nil { - ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) + if data.JpushOpen == 1 { + arg := md.JpushRecordFundData{UserId: v["id"], Target: "1", Platform: "all", Title: data.Title, Content: data.Content} + err := ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) + if err != nil { + ch.PublishV2(md.EggJpushRecordQueueExchange, arg, md.EggJpushRecordQueue) + } } - arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra} - err = ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) - if err != nil { - ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) + if data.SmsOpen == 1 { + arg1 := md.AliyunSmsRecordFundData{Phone: v["phone"], Title: data.Title, Content: data.Content, Code: data.SmsCode, Extra: extra} + err := ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) + if err != nil { + ch.PublishV2(md.EggAliyunSmsRecordQueueExchange, arg1, md.EggAliyunSmsRecordQueue) + } } eg.Where("id=?", v["unt_id"]).Cols("sign_notice_time").Update(&model.UserNoticeTime{SignNoticeTime: int(time.Now().Unix())}) }