Merge branch 'feat-IRONFANS-70' into test

This commit is contained in:
lwl0608 2024-04-18 20:31:50 +08:00
commit 90be5cb8cb
1 changed files with 4 additions and 4 deletions

View File

@ -267,12 +267,12 @@ func (m *Mysql) DecZoneConsume(ctx *gin.Context, tx *sqlx.Tx, mid, zid, inc int6
func (m *Mysql) AddZoneMember(ctx *gin.Context, tx *sqlx.Tx, mid, zid int64, memType int32) error { func (m *Mysql) AddZoneMember(ctx *gin.Context, tx *sqlx.Tx, mid, zid int64, memType int32) error {
var err error var err error
// 先获取,没有再添加 // 先获取,没有再添加
var tmpZm *dbstruct.ZoneMember var tmpZm dbstruct.ZoneMember
if tx != nil { if tx != nil {
err = tx.GetContext(ctx, tmpZm, fmt.Sprintf("select * from %s where mid=? and zid=? and member_type=?", TableVasZoneMember), mid, zid, memType) err = tx.GetContext(ctx, &tmpZm, fmt.Sprintf("select * from %s where mid=? and zid=? and member_type=?", TableVasZoneMember), mid, zid, memType)
} else { } else {
db := m.getDBVas() db := m.getDBVas()
err = db.GetContext(ctx, tmpZm, fmt.Sprintf("select * from %s where mid=? and zid=? and member_type=?", TableVasZoneMember), mid, zid, memType) err = db.GetContext(ctx, &tmpZm, fmt.Sprintf("select * from %s where mid=? and zid=? and member_type=?", TableVasZoneMember), mid, zid, memType)
} }
if err == sql.ErrNoRows { if err == sql.ErrNoRows {
err = nil err = nil
@ -280,7 +280,7 @@ func (m *Mysql) AddZoneMember(ctx *gin.Context, tx *sqlx.Tx, mid, zid int64, mem
if err != nil { if err != nil {
return err return err
} }
if tmpZm != nil { if tmpZm.GetMid() == mid && tmpZm.GetZid() == zid && tmpZm.GetMemberType() == memType {
return nil return nil
} }