|
- package svc
-
- import (
- "applet/app/e"
- "applet/app/enum"
- "applet/app/md"
- "applet/app/utils"
- db "code.fnuoos.com/zhimeng/model.git/src"
- "code.fnuoos.com/zhimeng/model.git/src/super/implement"
- "code.fnuoos.com/zhimeng/model.git/src/super/model"
- "github.com/gin-gonic/gin"
- )
-
- func MediumQualificationEnterprise(c *gin.Context, req md.MediumQualificationEnterpriseReq) map[string]interface{} {
-
- if req.Limit == 0 {
- req.Limit = 10
- }
- if req.Page == 0 {
- req.Page = 1
- }
- engine := db.Db
- MediumListDb := implement.NewMediumListDb(engine)
- MediumList, total, _ := MediumListDb.FindMediumList(req.Name, req.State, req.Page, req.Limit)
- if len(MediumList) == 0 {
- MediumList = make([]model.MediumList, 0)
- }
- res := map[string]interface{}{
- "list": MediumList,
- "total": total,
- "state": []map[string]interface{}{
- {
- "name": enum.QualificationState(enum.QualificationStateForWait).String(),
- "value": enum.QualificationStateForWait,
- },
- {
- "name": enum.QualificationState(enum.QualificationStateForNormal).String(),
- "value": enum.QualificationStateForNormal,
- },
- {
- "name": enum.QualificationState(enum.QualificationStateForFail).String(),
- "value": enum.QualificationStateForFail,
- },
- },
- "type": []map[string]interface{}{
- {
- "name": enum.QualificationType(enum.QualificationTypeCompany).String(),
- "value": enum.QualificationTypeCompany,
- },
- {
- "name": enum.QualificationType(enum.QualificationTypeOwn).String(),
- "value": enum.QualificationTypeOwn,
- },
- },
- }
- return res
- }
-
- func MediumQualificationEnterpriseAudit(c *gin.Context, req md.MediumQualificationEnterpriseAuditReq) error {
- engine := db.Db
- MediumListDb := implement.NewMediumListDb(engine)
- data, _ := MediumListDb.GetMediumList(req.MediumId)
- if data == nil {
- return e.NewErr(400, "记录不存在")
- }
- if data.State == 1 {
- return e.NewErr(400, "记录已审核过")
- }
- data.State = utils.StrToInt(req.State)
- data.Memo = req.Memo
- engine.Where("agent_id=?", data.MediumId).Cols("state,memo").Update(data)
- return nil
- }
|