瀏覽代碼

update

add_mode
DengBiao 1 年之前
父節點
當前提交
2a663b7e9e
共有 5 個檔案被更改,包括 84 行新增26 行删除
  1. +1
    -0
      app/admin/md/md_enterprise_manage.go
  2. +2
    -0
      app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go
  3. +4
    -2
      app/customer/hdl/hdl_user_identity.go
  4. +76
    -24
      app/customer/svc/svc_user_identity.go
  5. +1
    -0
      app/db/db_central_kitchen_for_school_package_ord.go

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

@@ -175,6 +175,7 @@ type CentralKitchenForSchoolOrdRefundReq struct {

type CentralKitchenForSchoolOrdListResp struct {
EnterpriseId int `json:"enterprise_id" `
EnterpriseName string `json:"enterprise_name" `
Uid int `json:"uid" `
UserIdentityId int `json:"user_identity_id" `
UserIdentityName string `json:"user_identity_name" `


+ 2
- 0
app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go 查看文件

@@ -440,6 +440,7 @@ func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (r
var m []*db.CentralKitchenForSchoolPackageOrdWithUserIdentity
count, err = sess.
Join("LEFT", "user_identity", "central_kitchen_for_school_package_ord.user_identity_id = user_identity.id").
Join("LEFT", "enterprise", "enterprise.id = user_identity.enterprise_id").
Join("LEFT", "class_with_user", "class_with_user.user_identity_id = user_identity.id").
Join("LEFT", "class", "class_with_user.class_id = class.id").
Join("LEFT", "grade", "class.grade_id = grade.id").
@@ -451,6 +452,7 @@ func CentralKitchenForSchoolOrdList(req md.CentralKitchenForSchoolOrdListReq) (r
for _, v := range m {
resp = append(resp, md.CentralKitchenForSchoolOrdListResp{
EnterpriseId: v.UserIdentity.EnterpriseId,
EnterpriseName: v.Enterprise.Name,
Uid: v.UserIdentity.Uid,
UserIdentityId: v.UserIdentity.Id,
UserIdentityName: v.CentralKitchenForSchoolPackageOrd.UserIdentityName,


+ 4
- 2
app/customer/hdl/hdl_user_identity.go 查看文件

@@ -85,7 +85,8 @@ func SaveCentralKitchenForSchoolUserIdentity(c *gin.Context) {
//4、修改身份信息
isHasUserIdentity.Uid = user.Id
isHasUserIdentity.Name = req.Name
_, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name")
isHasUserIdentity.State = enum.UserIdentityStateForNormal
_, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name", "state")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
@@ -207,7 +208,8 @@ func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
//4、修改身份信息
isHasUserIdentity.Uid = user.Id
isHasUserIdentity.Name = req.Name
_, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name")
isHasUserIdentity.State = enum.UserIdentityStateForNormal
_, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name", "state")
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return


+ 76
- 24
app/customer/svc/svc_user_identity.go 查看文件

@@ -3,61 +3,113 @@ package svc
import (
"applet/app/db"
"applet/app/db/model"
"applet/app/enum"
"errors"
)

func DeleteUserIdentityForCentralKitchenForStudent(userIdentityId int) (err error) {
//1、删除 class_with_user
_, err = db.Db.In("user_identity_id", userIdentityId).Delete(model.ClassWithUser{})
//1、删除 user_identity(将`state`变成"冻结"状态)
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
if err != nil {
return
return err
}
identity.State = enum.UserIdentityStateForFreeze
updateAffected, err := userIdentityDb.UserIdentityUpdate(userIdentityId, identity, "state")
if err != nil {
return err
}
if updateAffected <= 0 {
return errors.New("删除用户信息数据失败")
}

//2、删除 user_identity
_, err = db.Db.Where("id =?", userIdentityId).Delete(model.UserIdentity{})
//2、删除 class_with_user
_, err = db.Db.In("user_identity_id", userIdentityId).Delete(model.ClassWithUser{})
if err != nil {
return
}
return nil
return
}

func DeleteUserIdentityForCentralKitchenForTeacher(userIdentityId int) (err error) {
//删除 user_identity
_, err = db.Db.Where("id =?", userIdentityId).Delete(model.UserIdentity{})
//1、删除 user_identity(将`state`变成"冻结"状态)
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
if err != nil {
return
return err
}
identity.State = enum.UserIdentityStateForFreeze
updateAffected, err := userIdentityDb.UserIdentityUpdate(userIdentityId, identity, "state")
if err != nil {
return err
}
return nil
if updateAffected <= 0 {
return errors.New("删除用户信息数据失败")
}
return
}

func DeleteUserIdentityForSelfSupportForStudent(userIdentityId int) (err error) {
//1、删除 class_with_user
_, err = db.Db.In("user_identity_id", userIdentityId).Delete(model.ClassWithUser{})
//1、删除 user_identity(将`state`变成"冻结"状态)
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
if err != nil {
return
return err
}
identity.State = enum.UserIdentityStateForFreeze
updateAffected, err := userIdentityDb.UserIdentityUpdate(userIdentityId, identity, "state")
if err != nil {
return err
}
if updateAffected <= 0 {
return errors.New("删除用户信息数据失败")
}

//2、删除 user_identity
_, err = db.Db.Where("id =?", userIdentityId).Delete(model.UserIdentity{})
//2、删除 class_with_user
_, err = db.Db.In("user_identity_id", userIdentityId).Delete(model.ClassWithUser{})
if err != nil {
return
}
return nil
return
}

func DeleteUserIdentityForSelfSupportForTeacher(userIdentityId int) (err error) {
//删除 user_identity
_, err = db.Db.Where("id =?", userIdentityId).Delete(model.UserIdentity{})
//1、删除 user_identity(将`state`变成"冻结"状态)
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
if err != nil {
return
return err
}
identity.State = enum.UserIdentityStateForFreeze
updateAffected, err := userIdentityDb.UserIdentityUpdate(userIdentityId, identity, "state")
if err != nil {
return err
}
if updateAffected <= 0 {
return errors.New("删除用户信息数据失败")
}
return nil
return
}

func DeleteUserIdentityForSelfSupportForWorker(userIdentityId int) (err error) {
//删除 user_identity
_, err = db.Db.Where("id =?", userIdentityId).Delete(model.UserIdentity{})
//1、删除 user_identity(将`state`变成"冻结"状态)
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
if err != nil {
return
return err
}
identity.State = enum.UserIdentityStateForFreeze
updateAffected, err := userIdentityDb.UserIdentityUpdate(userIdentityId, identity, "state")
if err != nil {
return err
}
if updateAffected <= 0 {
return errors.New("删除用户信息数据失败")
}
return nil
return
}

+ 1
- 0
app/db/db_central_kitchen_for_school_package_ord.go 查看文件

@@ -96,6 +96,7 @@ func (centralKitchenForSchoolPackageOrdDb *CentralKitchenForSchoolPackageOrd) Ce
type CentralKitchenForSchoolPackageOrdWithUserIdentity struct {
model.CentralKitchenForSchoolPackageOrd `xorm:"extends"`
model.UserIdentity `xorm:"extends"`
model.Enterprise `xorm:"extends"`
model.ClassWithUser `xorm:"extends"`
model.Class `xorm:"extends"`
model.Grade `xorm:"extends"`


Loading…
取消
儲存