labour.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package http
  2. import (
  3. "go-common/app/admin/main/credit/model/blocked"
  4. bm "go-common/library/net/http/blademaster"
  5. )
  6. func operQuestion(c *bm.Context) {
  7. v := new(struct {
  8. IDS []int64 `form:"ids,split" validate:"min=1,max=20"`
  9. Status int8 `form:"status" validate:"min=0,max=1" default:"1"`
  10. OID int `form:"oper_id" validate:"required"`
  11. })
  12. if err := c.Bind(v); err != nil {
  13. return
  14. }
  15. if err := creSvc.DB.Model(&blocked.LabourQuestion{}).Where(v.IDS).Updates(map[string]interface{}{"status": v.Status, "oper_id": v.OID}).Error; err != nil {
  16. httpCode(c, err)
  17. return
  18. }
  19. httpCode(c, nil)
  20. }
  21. func delQuestion(c *bm.Context) {
  22. v := new(struct {
  23. IDS []int64 `form:"ids,split" validate:"min=1,max=20"`
  24. Status int8 `form:"status" validate:"min=0,max=1" default:"1"`
  25. OID int `form:"oper_id" validate:"required"`
  26. })
  27. if err := c.Bind(v); err != nil {
  28. return
  29. }
  30. if err := creSvc.DB.Model(&blocked.LabourQuestion{}).Where(v.IDS).Updates(map[string]interface{}{"isdel": v.Status, "oper_id": v.OID}).Error; err != nil {
  31. httpCode(c, err)
  32. return
  33. }
  34. httpCode(c, nil)
  35. }