Browse Source

update

master
黄梓健 5 years ago
parent
commit
23c6cf68df
  1. 2
      controllers/client/sign.go
  2. 12
      controllers/pc/sign.go
  3. 1
      log/hdzj.log
  4. 6
      models/real_sign_history.go

2
controllers/client/sign.go

@ -144,7 +144,7 @@ func (t *SignCtl) RealSign() {
history.CreatedAt = time.Now()
history.UpdatedAt = time.Now()
if isSign {
err = history.UpdateById(history.Id)
err = history.UpdateById([]interface{}{history.Id})
} else {
err = history.Insert()
}

12
controllers/pc/sign.go

@ -6,6 +6,7 @@ import (
"hudongzhuanjia/utils"
"hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define"
"strings"
"github.com/ouxuanserver/osmanthuswine/src/core"
)
@ -93,7 +94,7 @@ func (t *SignCtl) RealSignInfo() {
rid := t.MustGetInt64("rehearsal_id")
results := make([]*models.RealSignHistory, 0)
err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=? and status=0",
aid, rid).Asc("updated_at").Find(results)
aid, rid).Asc("updated_at").Find(&results)
t.CheckErr(err)
t.JSON(map[string]interface{}{
"result": results,
@ -102,11 +103,14 @@ func (t *SignCtl) RealSignInfo() {
}
func (t *SignCtl) RealSignVerify() {
id := t.MustGetInt64("real_sign_history_id") // 获取历史信息
ids := strings.Split(t.MustGet("real_sign_history_ids"), ",")
idList := make([]interface{}, len(ids))
for _, id := range ids {
idList = append(idList, id)
}
history := new(models.RealSignHistory)
history.Status = 1
err := history.UpdateById(id, "status")
err := history.UpdateById(idList, "status")
t.CheckErr(err)
t.SUCCESS("审核成功")
}

1
log/hdzj.log

@ -5,3 +5,4 @@
2020-03-09 12:40:14.756 ERROR logger/logger.go:92 check err {"error": "Error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%张三% and json_list like %张三% )' at line 1"}
2020-03-12 10:06:16.154 ERROR logger/logger.go:92 check err {"error": "token invalid"}
2020-03-12 10:07:26.864 ERROR logger/logger.go:92 check err {"error": "Error 1146: Table 'hudongzhuanjia.ox_real_sign_history' doesn't exist"}
2020-03-12 15:08:47.495 INFO controllers/base.go:57 get int64 from request error%!(EXTRA *strconv.NumError=strconv.ParseInt: parsing "": invalid syntax)

6
models/real_sign_history.go

@ -34,12 +34,12 @@ func (t *RealSignHistory) Check(uid, aid, rid int64) (bool, error) {
uid, aid, rid).Get(t)
}
func (t *RealSignHistory) UpdateById(id int64, fields ...string) (err error) {
func (t *RealSignHistory) UpdateById(ids []interface{}, fields ...string) (err error) {
if len(fields) > 0 {
_, err = core.GetXormAuto().ID(id).Cols(fields...).Update(t)
_, err = core.GetXormAuto().In("id", ids...).Cols(fields...).Update(t)
} else {
_, err = core.GetXormAuto().ID(id).AllCols().Update(t)
_, err = core.GetXormAuto().In("id", ids...).AllCols().Update(t)
}
return err
}

Loading…
Cancel
Save