|
|
@@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
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" |
|
|
|
) |
|
|
|
|
|
|
@@ -12,3 +14,31 @@ func NewAlipayUserInfoDb(engine *xorm.Engine) dao.AlipayUserInfoDao { |
|
|
|
type AlipayUserInfoDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (a AlipayUserInfoDb) GetAlipayUserInfo(uid int64) (m *model.AlipayUserInfo, err error) { |
|
|
|
m = new(model.AlipayUserInfo) |
|
|
|
has, err := a.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 (a AlipayUserInfoDb) UpdateAlipayUserInfo(m *model.AlipayUserInfo, columns ...string) (int64, error) { |
|
|
|
affected, err := a.Db.Where("id =?", m.Id).Cols(columns...).Update(m) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (a AlipayUserInfoDb) AlipayUserInfoInsert(m *model.AlipayUserInfo) (int, error) { |
|
|
|
_, err := a.Db.InsertOne(m) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return m.Id, nil |
|
|
|
} |