@@ -61,8 +61,10 @@ func EggEnergyDetails(c *gin.Context) { | |||||
isAsc := false | isAsc := false | ||||
if req.Kind == "1" { // 待结 | if req.Kind == "1" { // 待结 | ||||
coinID = eggEnergyBasicSetting.PersonEggEnergyCoinId | coinID = eggEnergyBasicSetting.PersonEggEnergyCoinId | ||||
} else { // 可用 | |||||
} else if req.Kind == "2" { // 可用 | |||||
coinID = eggEnergyBasicSetting.TeamEggEnergyCoinId | coinID = eggEnergyBasicSetting.TeamEggEnergyCoinId | ||||
} else { | |||||
coinID = 0 | |||||
} | } | ||||
if req.Asc == "1" { | if req.Asc == "1" { | ||||
isAsc = true | isAsc = true | ||||
@@ -245,8 +247,10 @@ func EggPointDetails(c *gin.Context) { | |||||
isAsc := false | isAsc := false | ||||
if req.Kind == "1" { // 待结 | if req.Kind == "1" { // 待结 | ||||
coinID = eggEnergyBasicSetting.PersonEggPointsCoinId | coinID = eggEnergyBasicSetting.PersonEggPointsCoinId | ||||
} else { // 可用 | |||||
} else if req.Kind == "2" { // 可用 | |||||
coinID = eggEnergyBasicSetting.TeamEggPointsCoinId | coinID = eggEnergyBasicSetting.TeamEggPointsCoinId | ||||
} else { | |||||
coinID = 0 | |||||
} | } | ||||
if req.Asc == "1" { | if req.Asc == "1" { | ||||
isAsc = true | isAsc = true | ||||
@@ -288,12 +292,12 @@ func EggPointDetails(c *gin.Context) { | |||||
} | } | ||||
virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | virtualAmountDb := implement.NewUserVirtualAmountDb(db.Db) | ||||
var totalEggPoints float64 | var totalEggPoints float64 | ||||
personEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggEnergyCoinId) | |||||
personEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.PersonEggPointsCoinId) | |||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
return | return | ||||
} | } | ||||
teamEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggEnergyCoinId) | |||||
teamEggPoints, err := virtualAmountDb.GetUserVirtualWalletBySession(user.Id, eggEnergyBasicSetting.TeamEggPointsCoinId) | |||||
if err != nil { | if err != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err.Error()) | e.OutErr(c, e.ERR_DB_ORM, err.Error()) | ||||
return | return | ||||
@@ -406,6 +410,7 @@ func BasalRate(c *gin.Context) { | |||||
ConsumedEggPoint: "0", | ConsumedEggPoint: "0", | ||||
EstimatedRevenue: "0", | EstimatedRevenue: "0", | ||||
SignCountdown: "00:00:00", | SignCountdown: "00:00:00", | ||||
SignTimeSecs: 0, | |||||
} | } | ||||
e.OutSuc(c, resp, nil) | e.OutSuc(c, resp, nil) | ||||
return | return | ||||
@@ -444,22 +449,23 @@ func BasalRate(c *gin.Context) { | |||||
basalRate := basalRateDecimal.Mul(decimal.NewFromInt(60 * 60)) | basalRate := basalRateDecimal.Mul(decimal.NewFromInt(60 * 60)) | ||||
// 收益倒计时 | // 收益倒计时 | ||||
var signCountdown string | var signCountdown string | ||||
var signTimeSecs float64 | |||||
var signTimeSecs int | |||||
duration := utils.TimeParseStd(eggSignIn.EndTime).Sub(now) // 计算时间差值 | duration := utils.TimeParseStd(eggSignIn.EndTime).Sub(now) // 计算时间差值 | ||||
if duration > 0 { | if duration > 0 { | ||||
hours := duration / time.Hour // 获取小时部分 | hours := duration / time.Hour // 获取小时部分 | ||||
minutes := duration % time.Hour / time.Minute // 获取分钟部分(先除去小时后再乘以60) | minutes := duration % time.Hour / time.Minute // 获取分钟部分(先除去小时后再乘以60) | ||||
seconds := int64(duration/time.Second) % 60 | seconds := int64(duration/time.Second) % 60 | ||||
signCountdown = fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时 | signCountdown = fmt.Sprintf("%d:%d:%d", hours, minutes, seconds) //收益倒计时 | ||||
signTimeSecs = duration.Seconds() | |||||
signTimeSecs = int(duration.Seconds()) | |||||
} else { | } else { | ||||
signCountdown = fmt.Sprintf("00:00:00") | signCountdown = fmt.Sprintf("00:00:00") | ||||
} | } | ||||
resp := md.BasalRateResp{ | resp := md.BasalRateResp{ | ||||
ConsumedTime: consumedTime.String(), | |||||
ConsumedTime: consumedTime.StringFixed(2), | |||||
ConsumedEggEnergy: consumedEggEnergy.String(), | ConsumedEggEnergy: consumedEggEnergy.String(), | ||||
RemainingTime: remainingTime.String(), | |||||
RemainingTime: remainingTime.StringFixed(2), | |||||
RemainingEggEnergy: remainingEggEnergy.String(), | RemainingEggEnergy: remainingEggEnergy.String(), | ||||
BasalRate: basalRate.String(), | BasalRate: basalRate.String(), | ||||
ConsumedEggPoint: eggSignIn.TotalPersonEggPoints, | ConsumedEggPoint: eggSignIn.TotalPersonEggPoints, | ||||
@@ -41,7 +41,7 @@ func Config(c *gin.Context) { | |||||
privacyArticle, _ := NewArticleDb.GetArticle("114") | privacyArticle, _ := NewArticleDb.GetArticle("114") | ||||
if privacyArticle != nil { | if privacyArticle != nil { | ||||
res.PrivacyTitle = privacyArticle.Title | 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() | res.OssUrl = svc.GetOssDomain() | ||||
appCloudBundleData := svc.GetSysCfgStr("app_cloud_bundle_data") | appCloudBundleData := svc.GetSysCfgStr("app_cloud_bundle_data") | ||||
@@ -581,7 +581,12 @@ func GetContributionValue(c *gin.Context) { | |||||
} | } | ||||
var contributionValue string | var contributionValue string | ||||
if virtualAmount != nil { | 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) | coinDb := implement.NewVirtualCoinDb(db.Db) | ||||
@@ -650,7 +655,12 @@ func GetContributionValueFlow(c *gin.Context) { | |||||
list := make([]md.ContributionValueFlowNode, len(flows)) | list := make([]md.ContributionValueFlowNode, len(flows)) | ||||
for i, flow := range flows { | for i, flow := range flows { | ||||
list[i].Title = flow.Title | 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].Direction = utils.IntToStr(flow.Direction) | ||||
list[i].CreateAt = flow.CreateAt | list[i].CreateAt = flow.CreateAt | ||||
} | } | ||||
@@ -362,11 +362,13 @@ func Delete(c *gin.Context) { | |||||
if err == nil { | if err == nil { | ||||
defer ch.Release() | defer ch.Release() | ||||
err = ch.PublishV2(md.EggUserExchange, md.CommUserId{ | err = ch.PublishV2(md.EggUserExchange, md.CommUserId{ | ||||
Uid: utils.Int64ToStr(user.Id), | |||||
Uid: utils.Int64ToStr(user.Id), | |||||
ParentUid: utils.Int64ToStr(user.ParentUid), | |||||
}, md.EggUserDelete) | }, md.EggUserDelete) | ||||
if err != nil { | if err != nil { | ||||
ch.PublishV2(md.EggUserExchange, md.CommUserId{ | ch.PublishV2(md.EggUserExchange, md.CommUserId{ | ||||
Uid: utils.Int64ToStr(user.Id), | |||||
Uid: utils.Int64ToStr(user.Id), | |||||
ParentUid: utils.Int64ToStr(user.ParentUid), | |||||
}, md.EggUserDelete) | }, md.EggUserDelete) | ||||
} | } | ||||
} | } | ||||
@@ -363,8 +363,7 @@ func GetWithdrawCondition(c *gin.Context) { | |||||
//1. 判断是否为第一次提现 | //1. 判断是否为第一次提现 | ||||
isFirst := false | 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 { //第一次提现 | if !has { //第一次提现 | ||||
isFirst = true | isFirst = true | ||||
} | } | ||||
@@ -87,15 +87,15 @@ type NineDimensionalSpaceResp struct { | |||||
} | } | ||||
type BasalRateResp 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 { | type TotalRateResp struct { | ||||
@@ -22,7 +22,8 @@ type PlayletReward struct { | |||||
Uid string `json:"uid"` | Uid string `json:"uid"` | ||||
} | } | ||||
type CommUserId struct { | type CommUserId struct { | ||||
Uid string `json:"uid"` | |||||
Uid string `json:"uid"` | |||||
ParentUid string `json:"parent_uid"` | |||||
} | } | ||||
type JpushRecordFundData struct { | type JpushRecordFundData struct { | ||||
Id string `json:"id"` | 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++ { | for i := 0; i < limit; i++ { | ||||
var tempDays int | var tempDays int | ||||
if getLastWeek { | if getLastWeek { | ||||
tempDays = 7 * ((page-1)*limit + i + 1) | |||||
// 未到周三下午两点,从上上周开始查询 | |||||
tempDays = 7 * ((page-1)*limit + i + 2) | |||||
} else { | } else { | ||||
tempDays = 7 * ((page-1)*limit + i) | |||||
// 已过周三下午两点,从上周开始查询 | |||||
tempDays = 7 * ((page-1)*limit + i + 1) | |||||
} | } | ||||
tempTime := now.AddDate(0, 0, -tempDays) | tempTime := now.AddDate(0, 0, -tempDays) | ||||
tempYear, tempWeek := tempTime.ISOWeek() | tempYear, tempWeek := tempTime.ISOWeek() | ||||
@@ -250,6 +250,8 @@ func GetWithdrawCondition(user *model.User, setting *model.FinWithdrawSetting, i | |||||
utils.Unserialize([]byte(setting.FirstWithdrawSet), &firstWithdrawSet) | utils.Unserialize([]byte(setting.FirstWithdrawSet), &firstWithdrawSet) | ||||
if firstWithdrawSet.IsNeedRealName == 0 { | if firstWithdrawSet.IsNeedRealName == 0 { | ||||
resp.IsNeedRealName = false | 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, "{手机号}", v["phone"]) | ||||
data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour)) | data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour)) | ||||
extra = "{\"hour\":\"" + 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())}) | 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, "{手机号}", v["phone"]) | ||||
data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour)) | data.Content = strings.ReplaceAll(data.Content, "{小时}", utils.Int64ToStr(hour)) | ||||
extra = "{\"hour\":\"" + 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())}) | eg.Where("id=?", v["unt_id"]).Cols("sign_notice_time").Update(&model.UserNoticeTime{SignNoticeTime: int(time.Now().Unix())}) | ||||
} | } | ||||