互动
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

5 years ago
  1. package balance_service
  2. import (
  3. "github.com/ouxuanserver/osmanthuswine/src/core"
  4. "time"
  5. )
  6. func IncrUserBalance(id int64, balance float64) (int64, error) {
  7. res, err := core.GetXormAuto().Exec("update ox_user set balance=balance+?, updated_at=? "+
  8. "where id=? and ox_user.is_delete=0", balance, time.Now(), id)
  9. if err != nil {
  10. return 0, err
  11. }
  12. return res.RowsAffected()
  13. }
  14. func IncrRewardBalance(cid int64, balance float64) (int64, error) {
  15. res, err := core.GetXormAuto().Exec("update ox_reward_wallet set balance=balance+?, updated_at=? "+
  16. "where customer_id=? and is_delete=0", balance, time.Now(), cid)
  17. if err != nil {
  18. return 0, err
  19. }
  20. return res.RowsAffected()
  21. }
  22. func IncrBullyScreenBalance(cid int64, balance float64) (int64, error) {
  23. res, err := core.GetXormAuto().Exec("update ox_bully_screen_wallet set balance=balance+?, update_at=? "+
  24. "Where customer_id=? and is_delete=0", balance, time.Now(), cid)
  25. if err != nil {
  26. return 0, err
  27. }
  28. return res.RowsAffected()
  29. }