Browse Source

修复添加和更新时endTime的bug

pull/2/head
zhangxin 3 years ago
parent
commit
0f8b6e8b06
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      web/models/contracttab.go

+ 2
- 2
web/models/contracttab.go View File

@ -273,7 +273,7 @@ func (t *Contracttab) Update(me *ContractInfo, lengthdate float64) error {
addmonths := strings.Split(addlenght, ".")
adds := utils.ValueToFloat(addmonths[1], 0.0) * 0.3
adddays := utils.ValueToInt(adds, 0) - 1
endTime := time.Now().AddDate(0, utils.ValueToInt(addmonths[0], 0), adddays)
endTime := begtime.AddDate(0, utils.ValueToInt(addmonths[0], 0), adddays)
t.Enddate = utils.TimeFormat(endTime, "yyyy-MM-dd")
} else {
begtime, _ := utils.TimeParseyyyyMMdd(t.Begdate)
@ -288,7 +288,7 @@ func (t *Contracttab) Update(me *ContractInfo, lengthdate float64) error {
addmonths := strings.Split(addlenght, ".")
adds := utils.ValueToFloat(addmonths[1], 0.0) * 0.3
adddays := utils.ValueToInt(adds, 0) - 1
endTime := time.Now().AddDate(0, utils.ValueToInt(addmonths[0], 0), adddays)
endTime := begtime.AddDate(0, utils.ValueToInt(addmonths[0], 0), adddays)
t.Enddate = utils.TimeFormat(endTime, "yyyy-MM-dd")
}
_, err = session.Table("contracttab").Cols("linkman", "mobile", "begdate", "enddate", "createtime", "createby", "lengthdate", "chargableexpense", "chargedexpense", "remake", "chargetime", "chargeway", "serialnumber").Where("cid = ? and contractid = ?", t.Cid, t.Contractid).Update(t)


Loading…
Cancel
Save