vip.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package http
  2. import (
  3. "go-common/app/service/main/vip/model"
  4. "go-common/library/log"
  5. bm "go-common/library/net/http/blademaster"
  6. )
  7. func batchInfo(c *bm.Context) {
  8. var (
  9. err error
  10. vib *model.VipResourceBatch
  11. )
  12. arg := new(struct {
  13. BatchID int64 `form:"batchId" validate:"required,min=1,gte=1"`
  14. Appkey string `form:"appkey"`
  15. })
  16. if err = c.Bind(arg); err != nil {
  17. log.Error("batchInfo Bind error(%v)", err)
  18. return
  19. }
  20. if vib, _, err = vipSvc.BatchInfo(c, arg.BatchID, arg.Appkey); err != nil {
  21. log.Error("vipSvc.BatchInfo(%d) error(%v)", arg.BatchID, err)
  22. c.JSON(nil, err)
  23. return
  24. }
  25. c.JSON(vib, nil)
  26. }
  27. func useBatchInfo(c *bm.Context) {
  28. var (
  29. err error
  30. )
  31. arg := new(struct {
  32. BatchID int64 `form:"batchId" validate:"required,min=1,gte=1"`
  33. Appkey string `form:"appkey"`
  34. Mid int64 `form:"mid" validate:"required,min=1,gte=1"`
  35. OrderNo string `form:"orderNo" validate:"required"`
  36. Remark string `form:"remark" validate:"required"`
  37. })
  38. if err = c.Bind(arg); err != nil {
  39. log.Error("useBatchInfo Bind error(%v)", err)
  40. return
  41. }
  42. c.JSON(nil, vipSvc.ResourceBatchOpenVip(c, &model.ArgUseBatch{
  43. Mid: arg.Mid,
  44. OrderNo: arg.OrderNo,
  45. Remark: arg.Remark,
  46. Appkey: arg.Appkey,
  47. BatchID: arg.BatchID,
  48. }))
  49. }