Browse Source

update

master
dengbiao 1 week ago
parent
commit
9bc25531ec
11 changed files with 73 additions and 43 deletions
  1. +14
    -8
      app/hdl/hdl_add_friend.go
  2. +1
    -1
      app/hdl/hdl_config.go
  3. +12
    -2
      app/hdl/hdl_points_center.go
  4. +4
    -2
      app/hdl/hdl_user.go
  5. +1
    -2
      app/hdl/hdl_wallet.go
  6. +9
    -9
      app/md/md_add_friend.go
  7. +2
    -1
      app/md/md_mq.go
  8. +4
    -2
      app/svc/svc_points_center.go
  9. +2
    -0
      app/svc/svc_withdraw_apply.go
  10. +12
    -8
      app/task/svc/svc_no_login_send.go
  11. +12
    -8
      app/task/svc/svc_no_sign_send.go

+ 14
- 8
app/hdl/hdl_add_friend.go View File

@@ -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,


+ 1
- 1
app/hdl/hdl_config.go View File

@@ -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")


+ 12
- 2
app/hdl/hdl_points_center.go View File

@@ -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
}


+ 4
- 2
app/hdl/hdl_user.go View File

@@ -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)
}
}


+ 1
- 2
app/hdl/hdl_wallet.go View File

@@ -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
}


+ 9
- 9
app/md/md_add_friend.go View File

@@ -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 {


+ 2
- 1
app/md/md_mq.go View File

@@ -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"`


+ 4
- 2
app/svc/svc_points_center.go View File

@@ -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()


+ 2
- 0
app/svc/svc_withdraw_apply.go View File

@@ -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 = ""
}
}



+ 12
- 8
app/task/svc/svc_no_login_send.go View File

@@ -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())})
}


+ 12
- 8
app/task/svc/svc_no_sign_send.go View File

@@ -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())})
}


Loading…
Cancel
Save