adjust otherorder

This commit is contained in:
yangduo 2025-02-18 13:42:17 +08:00
parent ccaea82665
commit 5623c3e4aa
2 changed files with 28 additions and 5 deletions

View File

@ -398,6 +398,10 @@ func (iga *InGameApi) OtherOrder(c *gin.Context) {
rspObj.ErrMsg = "invalid session 2" rspObj.ErrMsg = "invalid session 2"
} }
if errcode == constant.WX_ERRCODE_OK {
rspObj.Count += model.FindOtherCount(reqJson.AccountId)
}
c.JSON(200, rspObj) c.JSON(200, rspObj)
} }

View File

@ -72,3 +72,22 @@ func (this *InAppOrder) FindByOrderId(orderId string) (error, bool) {
return nil, result.RowsAffected > 0 return nil, result.RowsAffected > 0
} }
} }
func FindOtherCount(accountId string) (count int64) {
db := f5.GetApp().GetOrmDb(constant.PAY_DB).Table("t_order").Where("account_id = ? and status = 1", accountId).Select("sum(sp_amount)")
if db.Error == nil {
rowcount := int64(0)
if db.Count(&rowcount); rowcount > 0 {
db.Scan(&count)
}
}
if count > 0 {
db = f5.GetApp().GetOrmDb(constant.PAY_DB).Table("t_order").Where("account_id = ? and status = 1", accountId).Update("status", 2)
if db.Error != nil {
count = 0
}
}
return
}