|
@@ -253,6 +253,22 @@ func (a Apply) AddApply(apply Apply) e.Rescode {
|
|
|
apply.BackgroundImageObscure = new(float32)
|
|
|
*apply.BackgroundImageObscure = 0.5
|
|
|
}
|
|
|
+ if apply.BackgroundImagePc == nil {
|
|
|
+ apply.BackgroundImagePc = new(string)
|
|
|
+ *apply.BackgroundImagePc = global.IconSetting.BackgroundImagePc
|
|
|
+ }
|
|
|
+ if apply.BackgroundImageMobile == nil {
|
|
|
+ apply.BackgroundImageMobile = new(string)
|
|
|
+ *apply.BackgroundImageMobile = global.IconSetting.BackgroundImageMobile
|
|
|
+ }
|
|
|
+ if apply.StartupDiagramPc == nil {
|
|
|
+ apply.StartupDiagramPc = new(string)
|
|
|
+ *apply.StartupDiagramPc = global.IconSetting.StartupDiagramPc
|
|
|
+ }
|
|
|
+ if apply.StartupDiagramMobile == nil {
|
|
|
+ apply.StartupDiagramMobile = new(string)
|
|
|
+ *apply.StartupDiagramMobile = global.IconSetting.StartupDiagramMobile
|
|
|
+ }
|
|
|
if apply.TopicPC == nil {
|
|
|
apply.TopicPC = new(int)
|
|
|
*apply.TopicPC = 1
|
|
@@ -261,6 +277,7 @@ func (a Apply) AddApply(apply Apply) e.Rescode {
|
|
|
apply.TopicMobile = new(int)
|
|
|
*apply.TopicMobile = 1
|
|
|
}
|
|
|
+
|
|
|
tx := global.DBLink.Create(&apply)
|
|
|
if tx.Error != nil {
|
|
|
errMsg := tx.Error.Error()
|
|
@@ -365,3 +382,25 @@ func (a Apply) CollectionList(params unity.QueryPageParams, apply Apply, phone s
|
|
|
}
|
|
|
return result, total, nil
|
|
|
}
|
|
|
+
|
|
|
+// Check 检查是否过期
|
|
|
+func (a Apply) Check() bool {
|
|
|
+ //TODO implement me
|
|
|
+ //检查过期时间大于当前时间的应用并且更新状态为3--过期
|
|
|
+ var applys []Apply
|
|
|
+ now := utils.Time(time.Now())
|
|
|
+ tx := global.DBLink.Table(a.TableName()).Where("certification_time < ?", now).Where("state != ?", 3).Find(&applys)
|
|
|
+ if tx.Error != nil {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ for i, _ := range applys {
|
|
|
+ update := tx.Where("certification_time = ?", applys[i].CertificationTime).Update("state", 3)
|
|
|
+ if update.Error != nil {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if update.RowsAffected > 0 {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false
|
|
|
+}
|