|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- package svc
-
- import (
- "applet/app/db"
- "applet/app/db/model"
- "applet/app/enum"
- "errors"
- )
-
- func DeleteUserIdentityForCentralKitchenForStudent(userIdentityId int) (err error) {
- //1、删除 user_identity(将`state`变成"冻结"状态)
- userIdentityDb := db.UserIdentityDb{}
- userIdentityDb.Set(0)
- identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
- if err != nil {
- 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、删除 class_with_user
- _, err = db.Db.In("user_identity_id", userIdentityId).Delete(model.ClassWithUser{})
- if err != nil {
- return
- }
- return
- }
-
- func DeleteUserIdentityForCentralKitchenForTeacher(userIdentityId int) (err error) {
- //1、删除 user_identity(将`state`变成"冻结"状态)
- userIdentityDb := db.UserIdentityDb{}
- userIdentityDb.Set(0)
- identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
- if err != nil {
- 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
- }
-
- func DeleteUserIdentityForSelfSupportForStudent(userIdentityId int) (err error) {
- //1、删除 user_identity(将`state`变成"冻结"状态)
- userIdentityDb := db.UserIdentityDb{}
- userIdentityDb.Set(0)
- identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
- if err != nil {
- 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、删除 class_with_user
- _, err = db.Db.In("user_identity_id", userIdentityId).Delete(model.ClassWithUser{})
- if err != nil {
- return
- }
- return
- }
-
- func DeleteUserIdentityForSelfSupportForTeacher(userIdentityId int) (err error) {
- //1、删除 user_identity(将`state`变成"冻结"状态)
- userIdentityDb := db.UserIdentityDb{}
- userIdentityDb.Set(0)
- identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
- if err != nil {
- 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
- }
-
- func DeleteUserIdentityForSelfSupportForWorker(userIdentityId int) (err error) {
- //1、删除 user_identity(将`state`变成"冻结"状态)
- userIdentityDb := db.UserIdentityDb{}
- userIdentityDb.Set(0)
- identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
- if err != nil {
- 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
- }
-
- func DeleteUserIdentityForNursingHome(userIdentityId int) (err error) {
- //1、删除 user_identity(将`state`变成"冻结"状态)
- userIdentityDb := db.UserIdentityDb{}
- userIdentityDb.Set(0)
- identity, err := userIdentityDb.GetUserIdentity(userIdentityId)
- if err != nil {
- 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
- }
|