|
@@ -3,6 +3,7 @@ package models
|
|
|
import (
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"hongze/hongze_task/utils"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
type ETATrialListRespItem struct {
|
|
@@ -35,7 +36,16 @@ func GetETATrialDisableList(endDate string) (items []*ETATrialListRespItem, err
|
|
|
|
|
|
func UpdateETATrialDisable(disableIds []int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
- sql := `UPDATE eta_trial SET enabled = 0 WHERE eta_trial_id IN (` + utils.GetOrmInReplace(len(disableIds)) + `) `
|
|
|
- _, err = o.Raw(sql, disableIds).Exec()
|
|
|
+ expTime := time.Now().AddDate(0,0,-14)
|
|
|
+ sql := `UPDATE eta_trial SET enabled = 0, modify_time = ? WHERE eta_trial_id IN (` + utils.GetOrmInReplace(len(disableIds)) + `) `
|
|
|
+ _, err = o.Raw(sql, expTime, disableIds, ).Exec()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func UpdateETATrialAdminDisable(disableMobiles []string) (err error) {
|
|
|
+ o := orm.NewOrmUsingDB("weekly_trial")
|
|
|
+ expTime := time.Now().AddDate(0,0,-14)
|
|
|
+ sql := `UPDATE admin SET enabled = 0, modify_time = ? WHERE mobile IN (` + utils.GetOrmInReplace(len(disableMobiles)) + `) `
|
|
|
+ _, err = o.Raw(sql, expTime, disableMobiles).Exec()
|
|
|
return
|
|
|
}
|