|
|
@@ -0,0 +1,62 @@ |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewUserRealNameAuthDb(engine *xorm.Engine) dao.UserRealNameAuthDao { |
|
|
|
return &UserRealNameAuthDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type UserRealNameAuthDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserRealNameAuthDb) GetRealNameAuthByUid(uid string) (m *model.UserRealNameAuth, err error) { |
|
|
|
m = new(model.UserRealNameAuth) |
|
|
|
has, err := u.Db.Where("uid=?", uid).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (u UserRealNameAuthDb) GetRealNameAuthByUidWithState(uid, state string) (m *model.UserRealNameAuth, err error) { |
|
|
|
m = new(model.UserRealNameAuth) |
|
|
|
has, err := u.Db.Where("uid = ? and state=?", uid, state).Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
func (u UserRealNameAuthDb) GetRealNameAuthCount(uid int, cardNo string) (int64, error) { |
|
|
|
var m model.UserRealNameAuth |
|
|
|
has, err := u.Db.Where("uid <> ? AND state = ? and card_no = ?", uid, 1, cardNo).Count(&m) |
|
|
|
if has == 0 || err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return has, nil |
|
|
|
} |
|
|
|
func (u UserRealNameAuthDb) GetRealNameAuthByOid(oid string) (*model.UserRealNameAuth, error) { |
|
|
|
var m model.UserRealNameAuth |
|
|
|
if has, err := u.Db.Where("oid = ? ", oid).Get(&m); err != nil || !has { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserRealNameAuthDb) GetRealNameAuth(uid int) (*model.UserRealNameAuth, error) { |
|
|
|
var m model.UserRealNameAuth |
|
|
|
if has, err := u.Db.Where("uid = ? ", uid).In("is_pay", []string{"1", "5"}).Get(&m); err != nil || !has { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |