You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
997 B
34 lines
997 B
package balance_service
|
|
|
|
import (
|
|
"github.com/ouxuanserver/osmanthuswine/src/core"
|
|
"time"
|
|
)
|
|
|
|
func IncrUserBalance(id int64, balance float64) (int64, error) {
|
|
res, err := core.GetXormAuto().Exec("update ox_user set balance=balance+?, updated_at=? "+
|
|
"where id=? and ox_user.is_delete=0", balance, time.Now(), id)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
return res.RowsAffected()
|
|
}
|
|
|
|
func IncrRewardBalance(cid int64, balance float64) (int64, error) {
|
|
res, err := core.GetXormAuto().Exec("update ox_reward_wallet set balance=balance+?, updated_at=? "+
|
|
"where customer_id=? and is_delete=0", balance, time.Now(), cid)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
|
|
return res.RowsAffected()
|
|
}
|
|
|
|
func IncrBullyScreenBalance(cid int64, balance float64) (int64, error) {
|
|
res, err := core.GetXormAuto().Exec("update ox_bully_screen_wallet set balance=balance+?, update_at=? "+
|
|
"Where customer_id=? and is_delete=0", balance, time.Now(), cid)
|
|
if err != nil {
|
|
return 0, err
|
|
}
|
|
return res.RowsAffected()
|
|
}
|