Browse Source

Merge pull request '修改了删除接口' (#8) from fix_save into develop

Reviewed-on: http://101.201.121.115:3000/leo/LAPP_MY_BACKEND/pulls/8
pull/9/head
weichenglei 3 years ago
parent
commit
7e138bf5d3
1 changed files with 12 additions and 12 deletions
  1. +12
    -12
      web/models/chargetab.go

+ 12
- 12
web/models/chargetab.go View File

@ -1106,7 +1106,7 @@ func (t *Chargetab) Update() error {
glog.InfoExt("更新合同", "结束日期", t2)
lengthdate := utils.TimeSub(t2, t1)
glog.InfoExt("更新合同", "缴费时长", lengthdate)
m.Lengthdate = utils.ValueToString(lengthdate,"") + "天"
m.Lengthdate = utils.ValueToString(lengthdate, "") + "天"
_, err = session.Table("contracttab").ID(core.PK{t.Cid, pro.Contractid}).Update(m)
if err != nil {
session.Rollback()
@ -1139,7 +1139,7 @@ func (t *Chargetab) Update() error {
t2, err := utils.TimeParseyyyyMMdd(strings.Trim(t.Chargeenddate, ""))
lengthdate := utils.TimeSub(t2, t1)
glog.InfoExt("更新合同", "缴费时长", lengthdate)
m.Lengthdate = utils.ValueToString(lengthdate,"") + "天"
m.Lengthdate = utils.ValueToString(lengthdate, "") + "天"
_, err = session.Table("contracttab").ID(core.PK{t.Cid, pro.Contractid}).Update(m)
if err != nil {
session.Rollback()
@ -1172,7 +1172,7 @@ func (t *Chargetab) Update() error {
t2, err := utils.TimeParseyyyyMMdd(strings.Trim(t.Chargeenddate, ""))
lengthdate := utils.TimeSub(t2, t1)
glog.InfoExt("更新合同", "缴费时长", lengthdate)
m.Lengthdate = utils.ValueToString(lengthdate,"") + "天"
m.Lengthdate = utils.ValueToString(lengthdate, "") + "天"
_, err = session.Table("contracttab").ID(core.PK{t.Cid, pro.Contractid}).Update(m)
if err != nil {
session.Rollback()
@ -1220,7 +1220,7 @@ func (t *Chargetab) Del() error {
//1.删除(判断数据是否是最后一条)
one := new(Chargetab)
ok, err := session.Table("").Table("chargetab").Where("cid =? and propertyid =? and chargeenddate > ?", t.Cid, info.Propertyid, info.Chargeenddate).Get(one)
ok, err := session.Table("chargetab").Where("cid =? and propertyid =? and chargeenddate > ? and chargetype = ?", t.Cid, info.Propertyid, info.Chargeenddate, 1).Get(one)
if err != nil {
session.Rollback()
return err
@ -1247,7 +1247,7 @@ func (t *Chargetab) Del() error {
//2.记录回溯
//查询上条记录信息
cinfo := new(Chargetab)
result, err := session.Table("chargetab").Where("cid =? and propertyid =? and chargeenddate < ?", t.Cid, info.Propertyid, info.Chargeenddate).Desc("chargeenddate").Get(cinfo)
result, err := session.Table("chargetab").Where("cid =? and propertyid =? and chargeenddate < ? and chargetype = ?", t.Cid, info.Propertyid, info.Chargeenddate, 1).Desc("chargeenddate").Get(cinfo)
if err != nil {
session.Rollback()
return err
@ -1273,7 +1273,7 @@ func (t *Chargetab) Del() error {
t2 = t2.AddDate(0, 0, 1)
lengthdate := utils.TimeSub(t2, t1)
glog.InfoExt("更新合同", "缴费时长", lengthdate)
m.Lengthdate = utils.ValueToString(lengthdate,"") + "天"
m.Lengthdate = utils.ValueToString(lengthdate, "") + "天"
_, err = session.Table("contracttab").ID(core.PK{t.Cid, pro.Contractid}).Update(m)
if err != nil {
session.Rollback()
@ -1329,7 +1329,7 @@ func (t *Chargetab) Del() error {
case 2:
//1.删除(判断数据是否是最后一条)
one := new(Chargetab)
ok, err := session.Table("").Table("chargetab").Where("chargetype = 2 and cid =? and accesscardid =? and chargeenddate > ?", t.Cid, info.Accesscardid, info.Chargeenddate).Get(one)
ok, err := session.Table("chargetab").Where("chargetype = 2 and cid =? and accesscardid =? and chargeenddate > ?", t.Cid, info.Accesscardid, info.Chargeenddate).Get(one)
if err != nil {
session.Rollback()
return err
@ -1381,7 +1381,7 @@ func (t *Chargetab) Del() error {
t2, err := utils.TimeParseyyyyMMdd(strings.Trim(cinfo.Chargeenddate, ""))
lengthdate := utils.TimeSub(t2, t1)
glog.InfoExt("更新合同", "缴费时长", lengthdate)
m.Lengthdate = utils.ValueToString(lengthdate,"") + "天"
m.Lengthdate = utils.ValueToString(lengthdate, "") + "天"
_, err = session.Table("contracttab").ID(core.PK{t.Cid, pro.Contractid}).Update(m)
if err != nil {
session.Rollback()
@ -1438,7 +1438,7 @@ func (t *Chargetab) Del() error {
//1.删除(判断数据是否是最后一条)
one := new(Chargetab)
ok, err := session.Table("").Table("chargetab").Where("cid =? and carportid =? and chargeenddate > ?", t.Cid, info.Carportid, info.Chargeenddate).Get(one)
ok, err := session.Table("chargetab").Where("cid =? and carportid =? and chargeenddate > ? and chargetype = ?", t.Cid, info.Carportid, info.Chargeenddate,3).Get(one)
if err != nil {
session.Rollback()
return err
@ -1465,7 +1465,7 @@ func (t *Chargetab) Del() error {
//2.记录回溯
//查询上条记录信息
cinfo := new(Chargetab)
result, err := session.Table("chargetab").Where("cid =? and carportid =? and chargeenddate < ?", t.Cid, info.Carportid, info.Chargeenddate).Desc("chargeenddate").Get(cinfo)
result, err := session.Table("chargetab").Where("cid =? and carportid =? and chargeenddate < ? and chargetype = ?", t.Cid, info.Carportid, info.Chargeenddate,3).Desc("chargeenddate").Get(cinfo)
if err != nil {
session.Rollback()
return err
@ -1490,7 +1490,7 @@ func (t *Chargetab) Del() error {
t2, err := utils.TimeParseyyyyMMdd(strings.Trim(cinfo.Chargeenddate, ""))
lengthdate := utils.TimeSub(t2, t1)
glog.InfoExt("更新合同", "缴费时长", lengthdate)
m.Lengthdate = utils.ValueToString(lengthdate,"") + "天"
m.Lengthdate = utils.ValueToString(lengthdate, "") + "天"
_, err = session.Table("contracttab").ID(core.PK{t.Cid, pro.Contractid}).Update(m)
if err != nil {
session.Rollback()
@ -1556,7 +1556,7 @@ func (t *Chargetab) Del() error {
t2, err := utils.TimeParseyyyyMMdd(strings.Trim(cinfo.Chargeenddate, ""))
lengthdate := utils.TimeSub(t2, t1)
glog.InfoExt("更新合同", "缴费时长", lengthdate)
m.Lengthdate = utils.ValueToString(lengthdate,"") + "天"
m.Lengthdate = utils.ValueToString(lengthdate, "") + "天"
_, err = session.Table("contracttab").ID(core.PK{t.Cid, pro.Contractid}).Update(m)
if err != nil {
session.Rollback()


Loading…
Cancel
Save