|
@@ -129,8 +129,9 @@ func (e *EquityActive) processEquityInfo(activeName string, activeId, mold int)
|
|
|
log.Println("equityActive db Begin:", err)
|
|
|
return
|
|
|
}
|
|
|
- countQuery := fmt.Sprintf("SELECT count(*) FROM %s where state= 0 and mold=? and active_id=? ;", TableEquityInfo)
|
|
|
- rows, err := tx.Query(countQuery, mold, activeId)
|
|
|
+ now := date.NowFormat(date.Date_Full_Layout)
|
|
|
+ countQuery := fmt.Sprintf("SELECT count(*) FROM %s where state= 0 and mold=? and active_id=? and ex_end_time>?;", TableEquityInfo)
|
|
|
+ rows, err := tx.Query(countQuery, mold, activeId, now)
|
|
|
if err != nil || rows == nil {
|
|
|
log.Println("获取剩余库存数量失败:", err, rows, e.OrderCode)
|
|
|
return
|
|
@@ -144,11 +145,11 @@ func (e *EquityActive) processEquityInfo(activeName string, activeId, mold int)
|
|
|
}
|
|
|
}
|
|
|
if count <= 0 {
|
|
|
- log.Println("库存剩余为0:", countQuery, mold, activeId)
|
|
|
+ log.Println("库存剩余为0:", countQuery, mold, activeId, now)
|
|
|
return
|
|
|
}
|
|
|
- query := fmt.Sprintf("SELECT id,name,code,date_format(ex_end_time,'%%Y-%%m-%%d') as ex_end_time FROM %s where state= 0 and mold=? and active_id=? limit 1 for update;", TableEquityInfo)
|
|
|
- data, err := tx.Query(query, mold, activeId)
|
|
|
+ query := fmt.Sprintf("SELECT id,name,code,date_format(ex_end_time,'%%Y-%%m-%%d') as ex_end_time FROM %s where state= 0 and mold=? and active_id=? and ex_end_time>? limit 1 for update;", TableEquityInfo)
|
|
|
+ data, err := tx.Query(query, mold, activeId, now)
|
|
|
if err != nil || data == nil {
|
|
|
tx.Rollback()
|
|
|
log.Println("获取视频权益码信息失败:", err, data, e.OrderCode)
|