This commit is contained in:
AstarF 2024-07-15 14:42:48 +08:00
parent f258956df7
commit 1a4131c938
5 changed files with 6 additions and 7 deletions

View File

@ -42,7 +42,6 @@ func GetOrder(c *gin.Context) {
})
return
}
common.Success(c, response)
}

View File

@ -56,7 +56,7 @@ func GetInstance() *merchantModel {
func (m *merchantModel) GetById(id int64) (merchant *Merchant, has bool, err error) {
merchant = &Merchant{}
has, err = m.GetDb().ID(id).Get(merchant)
if err == nil || !has {
if err != nil || !has {
merchant = nil
}
return

View File

@ -72,7 +72,7 @@ func GetInstance() *ordersModel {
func (m *ordersModel) GetById(id int64) (orders *Orders, has bool, err error) {
orders = &Orders{}
has, err = m.GetDb().ID(id).Get(orders)
if err == nil || !has {
if err != nil || !has {
orders = nil
}
return
@ -81,7 +81,7 @@ func (m *ordersModel) GetById(id int64) (orders *Orders, has bool, err error) {
func (m *ordersModel) GetByOutTradeNo(out_trade_no string, merchant_id int64) (orders *Orders, has bool, err error) {
orders = &Orders{}
has, err = m.GetDb().Where("out_trade_no = ? and merchant_id = ?", out_trade_no, merchant_id).Get(orders)
if err == nil || !has {
if err != nil || !has {
orders = nil
}
return

View File

@ -56,7 +56,7 @@ func GetInstance() *productModel {
func (m *productModel) GetById(id int64) (product *Product, has bool, err error) {
product = &Product{}
has, err = m.GetDb().ID(id).Get(product)
if err == nil || !has {
if err != nil || !has {
product = nil
}
return

View File

@ -56,7 +56,7 @@ func GetInstance() *whitelistModel {
func (m *whitelistModel) GetById(id int64) (whitelist *Whitelist, has bool, err error) {
whitelist = &Whitelist{}
has, err = m.GetDb().ID(id).Get(whitelist)
if err == nil || !has {
if err != nil || !has {
whitelist = nil
}
return
@ -65,7 +65,7 @@ func (m *whitelistModel) GetById(id int64) (whitelist *Whitelist, has bool, err
func (m *whitelistModel) GetByIp(ip string) (whitelist *Whitelist, has bool, err error) {
whitelist = &Whitelist{}
has, err = m.GetDb().Where("ip = ?", ip).Get(whitelist)
if err == nil || !has {
if err != nil || !has {
whitelist = nil
}
return