下载任务

pull/5/head
mofangmin 1 year ago
parent 3981e1029a
commit 53c1c4017c
  1. 2
      call/task.go
  2. 1
      common/task.go
  3. 9
      modules/web/app/activity.go
  4. 8
      modules/web/handler/firstpage.go
  5. 1
      modules/web/handler/h5.go

@ -22,7 +22,7 @@ func CheckTask(task Task) {
uid := task.Uid uid := task.Uid
for _, v := range con { for _, v := range con {
for _, t := range task.Types { for _, t := range task.Types {
if (t == common.TaskTypeOnceRecharge || t == common.TaskTypeInvite) && v.Type == t { // 单次充值任务 || 首次充值任务 || v.Type == common.TaskTypeFirstRecharge) if (t == common.TaskTypeOnceRecharge || t == common.TaskTypeInvite || t == common.TaskTypeDownload) && v.Type == t { // 单次充值任务 || 首次充值任务 || v.Type == common.TaskTypeFirstRecharge)
data := GetUserTaskDataByTaskID(task.Uid, v.TaskID) data := GetUserTaskDataByTaskID(task.Uid, v.TaskID)
if data.ID == 0 { if data.ID == 0 {
db.Mysql().Create(&common.TaskData{UID: uid, TaskID: v.TaskID, Time: now, Progress: v.Target}) db.Mysql().Create(&common.TaskData{UID: uid, TaskID: v.TaskID, Time: now, Progress: v.Target})

@ -9,6 +9,7 @@ const (
TaskTypePlayGame // 参与一次牌局 TaskTypePlayGame // 参与一次牌局
TaskTypeBet1000 // 累计下注1000 TaskTypeBet1000 // 累计下注1000
TaskTypeBet10000 // 累计下注10000 TaskTypeBet10000 // 累计下注10000
TaskTypeDownload // 下载
TaskTypeAll TaskTypeAll
) )

@ -51,6 +51,7 @@ func (a *Gin) GetUserTaskStatus() (ret []*values.OneTask) {
if a.UID <= 0 { if a.UID <= 0 {
return return
} }
now := time.Now() now := time.Now()
task := call.GetUserTaskData(a.UID) task := call.GetUserTaskData(a.UID)
for _, v := range ret { for _, v := range ret {
@ -59,7 +60,7 @@ func (a *Gin) GetUserTaskStatus() (ret []*values.OneTask) {
v.Progess = k.Progress v.Progess = k.Progress
taskTime := time.Unix(k.Time, 0) taskTime := time.Unix(k.Time, 0)
// 跨天清空数据 // 跨天清空数据
if !util.IsSameDay(now, taskTime) { if !util.IsSameDay(now, taskTime) && v.Kind == 2 {
v.Status = 0 v.Status = 0
v.Progess = 0 v.Progess = 0
err := db.Mysql().Update(&k, map[string]interface{}{ err := db.Mysql().Update(&k, map[string]interface{}{
@ -70,9 +71,15 @@ func (a *Gin) GetUserTaskStatus() (ret []*values.OneTask) {
log.Error("GetUserTaskStatus err:%v", err) log.Error("GetUserTaskStatus err:%v", err)
} }
} }
break break
} }
} }
if v.Type == int(common.TaskTypeDownload) { // 已下载直接标记为完成
if a.DeviceType == common.DeviceTypeWebview || a.DeviceType == common.DeviceTypePWA {
call.CheckTask(call.Task{Uid: a.UID, Value: 0, Types: []common.TaskType{common.TaskTypeDownload}})
}
}
// 非次数任务,需转换目标数值 // 非次数任务,需转换目标数值
// if !common.IsNumTaskType(v.Type) && v.Progess > 0 { // if !common.IsNumTaskType(v.Type) && v.Progess > 0 {
// v.Progess /= common.DecimalDigits // v.Progess /= common.DecimalDigits

@ -97,10 +97,10 @@ func FirstPage(c *gin.Context) {
if len(list) > 0 { if len(list) > 0 {
resp.Esport = list[0] resp.Esport = list[0]
} }
// task := call.GetConfigTaskByTaskType(common.TaskTypeDownload) task := call.GetConfigTaskByTaskType(int(common.TaskTypeDownload))
// if len(task) > 0 { if len(task) > 0 {
// resp.DownloadAppReward = task[0].Reward resp.DownloadAppReward = task[0].Reward
// } }
resp.ShowData = GetFirstShowData() resp.ShowData = GetFirstShowData()
} }

@ -90,6 +90,7 @@ func H5DownloadDraw(c *gin.Context) {
a.Code = values.CodeRetry a.Code = values.CodeRetry
return return
} }
// call.UpdateCurrencyPro(&common.UpdateCurrencyNotify{ // call.UpdateCurrencyPro(&common.UpdateCurrencyNotify{
// Pairs: []*common.CurrencyPair{{Type: common.CurrencyTypeBindCash, Value: con.DownloadReward}}, // Pairs: []*common.CurrencyPair{{Type: common.CurrencyTypeBindCash, Value: con.DownloadReward}},
// CurrencyBalance: &common.CurrencyBalance{ // CurrencyBalance: &common.CurrencyBalance{

Loading…
Cancel
Save