|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package hdl
-
- import (
- "applet/app/admin/lib/validate"
- "applet/app/admin/md"
- "applet/app/admin/svc"
- svc2 "applet/app/admin/svc/enterprise_manage"
- "applet/app/db"
- "applet/app/e"
- "applet/app/enum"
- "applet/app/utils"
- "github.com/gin-gonic/gin"
- )
-
- func EnterpriseManageInfo(c *gin.Context) {
- enterpriseId := c.DefaultQuery("enterprise_id", "")
- enterpriseDb := db.EnterpriseDb{}
- enterpriseDb.Set()
- enterprise, err := enterpriseDb.GetEnterprise(utils.StrToInt(enterpriseId))
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err.Error())
- return
- }
- if enterprise == nil {
- e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
- return
- }
- var resp interface{}
- switch enterprise.Kind {
- case enum.EnterprisePvdByCentralKitchenForSchool:
- err, resp = svc.CentralKitchenForSchoolInfo(utils.StrToInt(enterpriseId))
- if err != nil {
- e.OutErr(c, e.ERR, err.Error())
- return
- }
- break
- case enum.EnterprisePvdByCentralKitchenForFactory:
- break
- case enum.EnterprisePvdBySelfSupportForSchool:
- err, resp = svc.SelfSupportForSchoolInfo(utils.StrToInt(enterpriseId))
- if err != nil {
- e.OutErr(c, e.ERR, err.Error())
- return
- }
- break
- case enum.EnterprisePvdBySelfSupportForFactory:
- break
- }
- e.OutSuc(c, map[string]interface{}{
- "info": resp,
- "kind": []map[string]interface{}{
- {
- "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForSchool).String(),
- "value": enum.EnterprisePvdByCentralKitchenForSchool,
- },
- {
- "name": enum.EnterprisePvd(enum.EnterprisePvdByCentralKitchenForFactory).String(),
- "value": enum.EnterprisePvdByCentralKitchenForFactory,
- },
- {
- "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForSchool).String(),
- "value": enum.EnterprisePvdBySelfSupportForSchool,
- },
- {
- "name": enum.EnterprisePvd(enum.EnterprisePvdBySelfSupportForFactory).String(),
- "value": enum.EnterprisePvdBySelfSupportForFactory,
- },
- },
- }, nil)
- return
- }
-
- func UserIdentityList(c *gin.Context) {
- var req md.EnterpriseUserListReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- enterpriseDb := db.EnterpriseDb{}
- enterpriseDb.Set()
- enterprise, err := enterpriseDb.GetEnterprise(req.EnterpriseId)
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err.Error())
- return
- }
- if enterprise == nil {
- e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录")
- return
- }
-
- var resp interface{}
- switch enterprise.Kind {
- case enum.EnterprisePvdByCentralKitchenForSchool:
- resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req)
- if err != nil {
- e.OutErr(c, e.ERR, err.Error())
- return
- }
- break
- case enum.EnterprisePvdByCentralKitchenForFactory:
- break
- case enum.EnterprisePvdBySelfSupportForSchool:
- resp, err = svc2.EnterpriseUserListByCentralKitchenForSchool(req)
- if err != nil {
- e.OutErr(c, e.ERR, err.Error())
- return
- }
- break
- case enum.EnterprisePvdBySelfSupportForFactory:
- break
- }
- e.OutSuc(c, resp, nil)
- return
- }
|