jury.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package http
  2. import (
  3. "encoding/json"
  4. "strconv"
  5. "go-common/app/interface/main/credit/model"
  6. "go-common/library/ecode"
  7. "go-common/library/log"
  8. bm "go-common/library/net/http/blademaster"
  9. )
  10. func delOpinion(c *bm.Context) {
  11. var (
  12. err error
  13. cid int64
  14. opid int64
  15. params = c.Request.Form
  16. cidStr = params.Get("cid")
  17. opidStr = params.Get("opid")
  18. )
  19. if cid, err = strconv.ParseInt(cidStr, 10, 64); err != nil {
  20. log.Error("strconv.ParseInt err(err) %v", err)
  21. c.JSON(nil, ecode.RequestErr)
  22. return
  23. }
  24. if opid, err = strconv.ParseInt(opidStr, 10, 64); err != nil {
  25. log.Error("strconv.ParseInt err(err) %v", err)
  26. c.JSON(nil, ecode.RequestErr)
  27. return
  28. }
  29. if err = creditSvc.DelOpinion(c, cid, opid); err != nil {
  30. log.Error("creditSvc.DelOpinion(%d,%d) error(err) %v", cid, opid, err)
  31. c.JSON(nil, err)
  32. return
  33. }
  34. c.JSON(nil, nil)
  35. }
  36. func addBlockedCase(c *bm.Context) {
  37. var (
  38. err error
  39. params = c.Request.Form
  40. data = params.Get("data")
  41. bc = make([]*model.ArgJudgeCase, 0)
  42. )
  43. if err = json.Unmarshal([]byte(data), &bc); err != nil {
  44. log.Error("json.Unmarshal(%s),err:%v.", data, err)
  45. c.JSON(nil, ecode.RequestErr)
  46. return
  47. }
  48. if err = creditSvc.AddBlockedCases(c, bc); err != nil {
  49. log.Error("creditSvc.AddBlockedCases error(err) %v", err)
  50. c.JSON(nil, err)
  51. return
  52. }
  53. c.JSON(nil, nil)
  54. }
  55. func batchJuryInfos(c *bm.Context) {
  56. v := new(model.ArgMIDs)
  57. if err := c.Bind(v); err != nil {
  58. return
  59. }
  60. mbj, err := creditSvc.JuryInfos(c, v.MIDs)
  61. if err != nil {
  62. log.Error("creditSvc.JuryInfos(%+v) error(%v)", v, err)
  63. c.JSON(nil, err)
  64. return
  65. }
  66. c.JSON(mbj, nil)
  67. }