@@ -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, | |||
@@ -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") | |||
@@ -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 | |||
} | |||
@@ -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) | |||
} | |||
} | |||
@@ -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 | |||
} | |||
@@ -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 { | |||
@@ -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"` | |||
@@ -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() | |||
@@ -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 = "" | |||
} | |||
} | |||
@@ -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())}) | |||
} | |||
@@ -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())}) | |||
} | |||