adjust otherorder
This commit is contained in:
parent
ccaea82665
commit
5623c3e4aa
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,7 +454,7 @@ func (iga *InGameApi) QueryPay(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (iga *InGameApi) checkSessionData(c *gin.Context, accountId string) (data map[string]interface{}, ret bool){
|
func (iga *InGameApi) checkSessionData(c *gin.Context, accountId string) (data map[string]interface{}, ret bool) {
|
||||||
strs := strings.Split(accountId, "_")
|
strs := strings.Split(accountId, "_")
|
||||||
if len(strs) < 3 {
|
if len(strs) < 3 {
|
||||||
f5.RspErr(c, 401, "params error1")
|
f5.RspErr(c, 401, "params error1")
|
||||||
|
@ -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
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user