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.

23 satır
436B

  1. package main
  2. import (
  3. "biukop.com/sfm/loan"
  4. "net/http"
  5. )
  6. func apiV1UserReward(w http.ResponseWriter, r *http.Request, ss *loan.Session) {
  7. if ss.User == "" {
  8. apiV1Client403Error(w, r, ss)
  9. return
  10. }
  11. userId := ss.User
  12. if ss.GetRole() == "admin" { //allow admin to query other user
  13. userId = r.URL.Path[len(apiV1Prefix+"user-reward/"):] //remove prefix
  14. }
  15. data := loan.GetUserReward(userId)
  16. apiV1SendJson(data, w, r, ss)
  17. }