123456789101112131415161718192021222324252627282930313233 |
- package models
- import "github.com/beego/beego/v2/client/orm"
- func BusinessTripApplyStatusOutTime(returnDate string) (err error) {
- o := orm.NewOrm()
- tx, err := o.Begin()
- if err != nil {
- return err
- }
- defer func() {
- if err != nil {
- tx.Rollback()
- } else {
- tx.Commit()
- }
- }()
- //客户产品状态变更
- sql := `UPDATE business_apply SET status='已过期',modify_time=NOW() WHERE status='待审批' AND arrive_date <= ? `
- _, err = tx.Raw(sql, returnDate).Exec()
- if err != nil {
- return
- }
- // 将历史的任务给标记删除掉
- sql = `UPDATE business_apply_peer SET status='已过期',modify_time=NOW() WHERE status='待审批' AND arrive_date <= ? `
- _, err = tx.Raw(sql, returnDate).Exec()
- if err != nil {
- return
- }
- return
- }
|