广告平台(总站长使用)
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.
 
 
 
 
 
 

74 lines
2.0 KiB

  1. package svc
  2. import (
  3. "applet/app/e"
  4. "applet/app/enum"
  5. "applet/app/md"
  6. "applet/app/utils"
  7. db "code.fnuoos.com/zhimeng/model.git/src"
  8. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  9. "code.fnuoos.com/zhimeng/model.git/src/super/model"
  10. "github.com/gin-gonic/gin"
  11. )
  12. func MediumQualificationEnterprise(c *gin.Context, req md.MediumQualificationEnterpriseReq) map[string]interface{} {
  13. if req.Limit == 0 {
  14. req.Limit = 10
  15. }
  16. if req.Page == 0 {
  17. req.Page = 1
  18. }
  19. engine := db.Db
  20. MediumListDb := implement.NewMediumListDb(engine)
  21. MediumList, total, _ := MediumListDb.FindMediumList(req.Name, req.State, req.Page, req.Limit)
  22. if len(MediumList) == 0 {
  23. MediumList = make([]model.MediumList, 0)
  24. }
  25. res := map[string]interface{}{
  26. "list": MediumList,
  27. "total": total,
  28. "state": []map[string]interface{}{
  29. {
  30. "name": enum.QualificationState(enum.QualificationStateForWait).String(),
  31. "value": enum.QualificationStateForWait,
  32. },
  33. {
  34. "name": enum.QualificationState(enum.QualificationStateForNormal).String(),
  35. "value": enum.QualificationStateForNormal,
  36. },
  37. {
  38. "name": enum.QualificationState(enum.QualificationStateForFail).String(),
  39. "value": enum.QualificationStateForFail,
  40. },
  41. },
  42. "type": []map[string]interface{}{
  43. {
  44. "name": enum.QualificationType(enum.QualificationTypeCompany).String(),
  45. "value": enum.QualificationTypeCompany,
  46. },
  47. {
  48. "name": enum.QualificationType(enum.QualificationTypeOwn).String(),
  49. "value": enum.QualificationTypeOwn,
  50. },
  51. },
  52. }
  53. return res
  54. }
  55. func MediumQualificationEnterpriseAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
  56. engine := db.Db
  57. MediumListDb := implement.NewMediumListDb(engine)
  58. data, _ := MediumListDb.GetMediumList(req.MediumId)
  59. if data == nil {
  60. return e.NewErr(400, "记录不存在")
  61. }
  62. if data.State == 1 {
  63. return e.NewErr(400, "记录已审核过")
  64. }
  65. data.State = utils.StrToInt(req.State)
  66. data.Memo = req.Memo
  67. engine.Where("agent_id=?", data.MediumId).Cols("state,memo").Update(data)
  68. return nil
  69. }