oper.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/admin/main/videoup-task/model"
  5. )
  6. func (s *Service) diffVideoOper(vp *model.VideoParam) (conts []string) {
  7. if vp.TagID > 0 {
  8. var operType int8
  9. if vp.Status >= model.VideoStatusOpen {
  10. operType = model.OperTypeOpenTag
  11. } else {
  12. operType = model.OperTypeRecicleTag
  13. }
  14. conts = append(conts, model.Operformat(operType, "tagid", vp.TagID, model.OperStyleTwo))
  15. }
  16. if vp.Reason != "" {
  17. conts = append(conts, model.Operformat(model.OperTypeAduitReason, "reason", vp.Reason, model.OperStyleTwo))
  18. }
  19. if vp.TaskID > 0 {
  20. conts = append(conts, model.Operformat(model.OperTypeTaskID, "task", vp.TaskID, model.OperStyleTwo))
  21. }
  22. return
  23. }
  24. func (s *Service) addVideoOper(c context.Context, oper *model.VideoOper) (err error) {
  25. /*
  26. if oldOper, _ := s.dao.VideoOper(c, oper.Vid); oldOper != nil && oldOper.LastID == 1 {
  27. oper.LastID = oldOper.ID
  28. s.dao.AddVideoOper(c, oper.Aid, oper.UID, oper.Vid, oper.Attribute, oper.Status, oper.LastID, oper.Content, oper.Remark)
  29. return
  30. }
  31. */
  32. if lastID, _ := s.dao.AddVideoOper(c, oper.Aid, oper.UID, oper.Vid, oper.Attribute, oper.Status, oper.LastID, oper.Content, oper.Remark); lastID > 0 {
  33. s.dao.UpVideoOper(c, lastID, lastID)
  34. return
  35. }
  36. return
  37. }