瀏覽代碼

update

add_mode
DengBiao 1 年之前
父節點
當前提交
54b9f6465e
共有 6 個文件被更改,包括 130 次插入1 次删除
  1. +104
    -0
      app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go
  2. +12
    -0
      app/admin/md/md_enterprise_manage.go
  3. +1
    -0
      app/admin/svc/svc_login.go
  4. +10
    -1
      app/customer/hdl/self_support_for_school/hdl_faceCollection.go
  5. +1
    -0
      app/customer/svc/svc_login.go
  6. +2
    -0
      app/router/admin_router.go

+ 104
- 0
app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go 查看文件

@@ -7,8 +7,10 @@ import (
"applet/app/db"
"applet/app/db/model"
"applet/app/e"
"applet/app/enum"
"applet/app/utils"
"github.com/gin-gonic/gin"
"time"
)

func SelfSupportForSchoolUserUpdate(c *gin.Context) {
@@ -541,3 +543,105 @@ func SelfSupportForSchoolClassDelete(c *gin.Context) {
e.OutSuc(c, "success", nil)
return
}

func SelfSupportForSchoolAddWorker(c *gin.Context) {
var req md.SelfSupportForSchoolAddWorkerReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if isHasUserIdentity != nil {
e.OutErr(c, e.ERR, "当前身份已存在,直接修改身份即可!")
return
}

now := time.Time{}
//2、新增身份信息
userIdentity := &model.UserIdentity{
Uid: 0,
Name: req.Name,
IdNo: req.IdNo,
Kind: enum.UserIdentityKindForWorker,
Identity: enum.UserIdentityForSelfSupportForWorker,
EnterpriseId: req.EnterpriseId,
State: enum.UserIdentityStateForNormal,
Memo: "",
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if insertAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败")
return
}

e.OutSuc(c, "success", nil)
return
}

func SelfSupportForSchoolAddTeacher(c *gin.Context) {
var req md.SelfSupportForSchoolAddTeacherReq
err := c.ShouldBindJSON(&req)
if err != nil {
err = validate.HandleValidateErr(err)
err1 := err.(e.E)
e.OutErr(c, err1.Code, err1.Error())
return
}

//1、查找当前身份是否已存在
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if isHasUserIdentity != nil {
e.OutErr(c, e.ERR, "当前身份已存在,直接修改身份即可!")
return
}

now := time.Time{}
//2、新增身份信息
userIdentity := &model.UserIdentity{
Uid: 0,
Name: req.Name,
IdNo: req.IdNo,
Kind: enum.UserIdentityKindForCommon,
Identity: enum.UserIdentityForSelfSupportForTeacher,
EnterpriseId: req.EnterpriseId,
State: enum.UserIdentityStateForNormal,
Memo: "",
CreateAt: now.Format("2006-01-02 15:04:05"),
UpdateAt: now.Format("2006-01-02 15:04:05"),
}
insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity)
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if insertAffected <= 0 {
e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败")
return
}

e.OutSuc(c, "success", nil)
return
}

+ 12
- 0
app/admin/md/md_enterprise_manage.go 查看文件

@@ -356,3 +356,15 @@ type SelfSupportForSchoolClassListReq struct {
Page int `json:"page" binding:"required"`
Name string `json:"name" label:"名称"`
}

type SelfSupportForSchoolAddWorkerReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Name string `json:"name" label:"名称"`
IdNo string `json:"id_no" label:"身份证号"`
}

type SelfSupportForSchoolAddTeacherReq struct {
EnterpriseId int `json:"enterprise_id" binding:"required" label:"企业id"`
Name string `json:"name" label:"名称"`
IdNo string `json:"id_no" label:"身份证号"`
}

+ 1
- 0
app/admin/svc/svc_login.go 查看文件

@@ -13,6 +13,7 @@ func HandleLoginToken(cacheKey string, admin *model.Admin) (string, error) {
token, err := cache.GetString(cacheKey)
if err != nil {
_ = logx.Error(err)
return "", err
}
// 没有获取到
if err != nil || token == "" {


+ 10
- 1
app/customer/hdl/self_support_for_school/hdl_faceCollection.go 查看文件

@@ -220,6 +220,15 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) {
}

func ConcentrateFacePassStudentList(c *gin.Context) {
userIdentityId := c.DefaultQuery("user_identity_id", "")
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
identity, err := userIdentityDb.GetUserIdentity(utils.StrToInt(userIdentityId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

page := utils.StrToInt(c.DefaultQuery("page", "1"))
if page == 0 {
page = 1
@@ -231,7 +240,7 @@ func ConcentrateFacePassStudentList(c *gin.Context) {
concentrateSchoolFacePassStatus := c.DefaultQuery("concentrate_school_face_pass_status", "")

var m []*db.SelfSupportForUserFaceInfoWithUserIdentity
sess := db.Db.Where("self_support_for_user_face_info.collect_face_type =?", 2) //集采
sess := db.Db.Where("self_support_for_user_face_info.enterprise_id =?", identity.EnterpriseId).And("self_support_for_user_face_info.collect_face_type =?", 2) //集采
if concentrateSchoolFacePassStatus != "" {
sess.And("self_support_for_user_face_info.concentrate_school_face_pass_status =?", concentrateSchoolFacePassStatus)
}


+ 1
- 0
app/customer/svc/svc_login.go 查看文件

@@ -13,6 +13,7 @@ func HandleLoginToken(cacheKey string, user *model.User) (string, error) {
token, err := cache.GetString(cacheKey)
if err != nil {
_ = logx.Error(err)
return "", err
}
// 没有获取到
if err != nil || token == "" {


+ 2
- 0
app/router/admin_router.go 查看文件

@@ -154,6 +154,8 @@ func rEnterpriseManage(r *gin.RouterGroup) {
r.DELETE("/selfSupportForSchool/gradeDelete/:id", hdl.SelfSupportForSchoolGradeDelete) //"自营-学校"年级删除
r.POST("/selfSupportForSchool/classList", hdl.SelfSupportForSchoolClassList) //"自营-学校"班级列表
r.DELETE("/selfSupportForSchool/classDelete/:id", hdl.SelfSupportForSchoolClassDelete) //"自营-学校"班级删除
r.POST("/selfSupportForSchool/addWorker", hdl.SelfSupportForSchoolAddWorker) //"自营-学校"添加工作人员
r.POST("/selfSupportForSchool/addTeacher", hdl.SelfSupportForSchoolAddTeacher) //"自营-学校"添加老师

}



Loading…
取消
儲存