智慧食堂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

609 lines
18 KiB

  1. package hdl
  2. import (
  3. "applet/app/customer/lib/validate"
  4. "applet/app/customer/md"
  5. "applet/app/customer/svc"
  6. "applet/app/db"
  7. "applet/app/db/model"
  8. "applet/app/e"
  9. "applet/app/enum"
  10. "applet/app/utils"
  11. "github.com/gin-gonic/gin"
  12. "time"
  13. )
  14. func SaveCentralKitchenForSchoolUserIdentity(c *gin.Context) {
  15. var req md.SaveCentralKitchenForSchoolUserIdentityReq
  16. err := c.ShouldBindJSON(&req)
  17. if err != nil {
  18. err = validate.HandleValidateErr(err)
  19. err1 := err.(e.E)
  20. e.OutErr(c, err1.Code, err1.Error())
  21. return
  22. }
  23. user := svc.GetUser(c)
  24. var identity = enum.UserIdentityForCentralKitchenForStudent
  25. if req.IsTeacher {
  26. identity = enum.UserIdentityForCentralKitchenForTeacher
  27. }
  28. //1、判断当前身份是否已绑定
  29. userIdentityDb := db.UserIdentityDb{}
  30. userIdentityDb.Set(user.Id)
  31. isHasUserIdentity, err := userIdentityDb.UserIdentityExistV1(req.EnterpriseId, req.Name)
  32. if err != nil {
  33. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  34. return
  35. }
  36. if isHasUserIdentity == nil && identity == enum.UserIdentityForCentralKitchenForTeacher {
  37. isHasUserIdentity, err = userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, 1)
  38. if err != nil {
  39. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  40. return
  41. }
  42. if isHasUserIdentity == nil {
  43. centralKitchenForSchoolSetDb := db.CentralKitchenForSchoolSetDb{}
  44. centralKitchenForSchoolSetDb.Set(req.EnterpriseId)
  45. set, err := centralKitchenForSchoolSetDb.GetCentralKitchenForSchoolSet()
  46. if err != nil {
  47. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  48. return
  49. }
  50. if set.IsOpenLimitTeacherRegister == 1 {
  51. e.OutErr(c, e.ERR_NO_DATA, "当前身份信息不存在")
  52. return
  53. }
  54. }
  55. }
  56. now := time.Now()
  57. if isHasUserIdentity == nil {
  58. //2、新增身份信息
  59. userIdentity := &model.UserIdentity{
  60. Uid: user.Id,
  61. Name: req.Name,
  62. IdNo: req.IdNo,
  63. CertType: enum.UserIdentityCertTypeForIdCard,
  64. Kind: enum.UserIdentityKindForCommon,
  65. Identity: identity,
  66. EnterpriseId: req.EnterpriseId,
  67. State: enum.UserIdentityStateForNormal,
  68. Memo: "",
  69. CreateAt: now.Format("2006-01-02 15:04:05"),
  70. UpdateAt: now.Format("2006-01-02 15:04:05"),
  71. }
  72. insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity)
  73. if err != nil {
  74. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  75. return
  76. }
  77. if insertAffected <= 0 {
  78. e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败")
  79. return
  80. }
  81. //3、新增 class_with_user 记录
  82. if !req.IsTeacher {
  83. classWithUserDb := db.ClassWithUserDb{}
  84. classWithUserDb.Set()
  85. _, err = classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{
  86. UserIdentityId: insertAffected,
  87. ClassId: req.ClassId,
  88. CreateAt: now.Format("2006-01-02 15:04:05"),
  89. UpdateAt: now.Format("2006-01-02 15:04:05"),
  90. })
  91. if err != nil {
  92. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  93. return
  94. }
  95. }
  96. } else {
  97. //4、修改身份信息
  98. isHasUserIdentity.Uid = user.Id
  99. isHasUserIdentity.Name = req.Name
  100. isHasUserIdentity.State = enum.UserIdentityStateForNormal
  101. _, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name", "state")
  102. if err != nil {
  103. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  104. return
  105. }
  106. //5、修改 class_with_user 记录
  107. if !req.IsTeacher {
  108. classWithUserDb := db.ClassWithUserDb{}
  109. classWithUserDb.Set()
  110. classWithUser, err1 := classWithUserDb.GetClassWithUserByUserIdentityId(isHasUserIdentity.Id)
  111. if err1 != nil {
  112. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  113. return
  114. }
  115. if classWithUser == nil {
  116. _, err2 := classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{
  117. UserIdentityId: isHasUserIdentity.Id,
  118. ClassId: req.ClassId,
  119. CreateAt: now.Format("2006-01-02 15:04:05"),
  120. UpdateAt: now.Format("2006-01-02 15:04:05"),
  121. })
  122. if err2 != nil {
  123. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  124. return
  125. }
  126. } else {
  127. classWithUser.ClassId = req.ClassId
  128. _, err2 := classWithUserDb.ClassWithUserUpdateByUserIdentity(isHasUserIdentity.Id, classWithUser, "class_id")
  129. if err2 != nil {
  130. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  131. return
  132. }
  133. }
  134. }
  135. }
  136. e.OutSuc(c, "success", nil)
  137. return
  138. }
  139. func SaveSelfSupportForSchoolUserIdentity(c *gin.Context) {
  140. var req md.SaveSelfSupportForSchoolUserIdentityReq
  141. err := c.ShouldBindJSON(&req)
  142. if err != nil {
  143. err = validate.HandleValidateErr(err)
  144. err1 := err.(e.E)
  145. e.OutErr(c, err1.Code, err1.Error())
  146. return
  147. }
  148. user := svc.GetUser(c)
  149. now := time.Now()
  150. var identity = enum.UserIdentityForSelfSupportForStudent
  151. var kind = enum.UserIdentityKindForCommon
  152. if req.CertType == 0 {
  153. req.CertType = enum.UserIdentityCertTypeForIdCard
  154. }
  155. if req.Kind == enum.UserIdentityKindForWorker {
  156. kind = enum.UserIdentityKindForWorker
  157. identity = enum.UserIdentityForSelfSupportForWorker
  158. req.CertType = enum.UserIdentityCertTypeForIdCard
  159. } else {
  160. if req.IsTeacher {
  161. identity = enum.UserIdentityForCentralKitchenForTeacher
  162. }
  163. }
  164. //1、判断当前身份是否已绑定
  165. userIdentityDb := db.UserIdentityDb{}
  166. userIdentityDb.Set(user.Id)
  167. isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, req.CertType)
  168. if err != nil {
  169. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  170. return
  171. }
  172. if isHasUserIdentity == nil {
  173. if identity != enum.UserIdentityForSelfSupportForStudent {
  174. e.OutErr(c, e.ERR_NO_DATA, "当前身份信息不存在")
  175. return
  176. }
  177. //2、新增身份信息
  178. userIdentity := &model.UserIdentity{
  179. Uid: user.Id,
  180. Name: req.Name,
  181. IdNo: req.IdNo,
  182. CertType: req.CertType,
  183. Kind: kind,
  184. Identity: identity,
  185. EnterpriseId: req.EnterpriseId,
  186. State: enum.UserIdentityStateForNormal,
  187. Memo: "",
  188. CreateAt: now.Format("2006-01-02 15:04:05"),
  189. UpdateAt: now.Format("2006-01-02 15:04:05"),
  190. }
  191. insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity)
  192. if err != nil {
  193. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  194. return
  195. }
  196. if insertAffected <= 0 {
  197. e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败")
  198. return
  199. }
  200. //3、新增 class_with_user 记录
  201. if !req.IsTeacher {
  202. classWithUserDb := db.ClassWithUserDb{}
  203. classWithUserDb.Set()
  204. _, err1 := classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{
  205. UserIdentityId: insertAffected,
  206. ClassId: req.ClassId,
  207. CreateAt: now.Format("2006-01-02 15:04:05"),
  208. UpdateAt: now.Format("2006-01-02 15:04:05"),
  209. })
  210. if err1 != nil {
  211. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  212. return
  213. }
  214. }
  215. //4、新增 self_support_for_user_face_info 记录
  216. selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
  217. selfSupportForSchoolInfoDb.Set(req.EnterpriseId)
  218. selfSupportForSchoolInfo, err := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
  219. if err != nil {
  220. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  221. return
  222. }
  223. if selfSupportForSchoolInfo == nil {
  224. e.OutErr(c, e.ERR_NO_DATA, "当前学校暂未完成《一脸通行入驻》")
  225. return
  226. }
  227. selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
  228. selfSupportForUserFaceInfoDb.Set(insertAffected)
  229. _, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(&model.SelfSupportForUserFaceInfo{
  230. EnterpriseId: req.EnterpriseId,
  231. UserIdentityId: insertAffected,
  232. CollectFaceType: 1,
  233. SchoolCode: selfSupportForSchoolInfo.SchoolCode,
  234. SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
  235. ParentUserId: "",
  236. ParentLogonId: "",
  237. UserId: "",
  238. SchoolFacePassStatus: "CLOSE",
  239. SchoolFacePaymentStatus: "CLOSE",
  240. ConcentrateSchoolFacePassStatus: 1,
  241. CreateAt: now.Format("2006-01-02 15:04:05"),
  242. UpdateAt: now.Format("2006-01-02 15:04:05"),
  243. })
  244. if err2 != nil {
  245. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  246. return
  247. }
  248. } else {
  249. if isHasUserIdentity.Uid != 0 && isHasUserIdentity.Uid != user.Id {
  250. e.OutErr(c, e.ERR, "当前身份信息已被绑定使用")
  251. return
  252. }
  253. //4、修改身份信息
  254. isHasUserIdentity.Uid = user.Id
  255. isHasUserIdentity.Name = req.Name
  256. isHasUserIdentity.State = enum.UserIdentityStateForNormal
  257. _, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name", "state")
  258. if err != nil {
  259. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  260. return
  261. }
  262. if identity == enum.UserIdentityForSelfSupportForStudent {
  263. //5、修改 class_with_user 记录
  264. classWithUserDb := db.ClassWithUserDb{}
  265. classWithUserDb.Set()
  266. classWithUser, err1 := classWithUserDb.GetClassWithUserByUserIdentityId(isHasUserIdentity.Id)
  267. if err1 != nil {
  268. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  269. return
  270. }
  271. if classWithUser == nil {
  272. _, err2 := classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{
  273. UserIdentityId: isHasUserIdentity.Id,
  274. ClassId: req.ClassId,
  275. CreateAt: now.Format("2006-01-02 15:04:05"),
  276. UpdateAt: now.Format("2006-01-02 15:04:05"),
  277. })
  278. if err2 != nil {
  279. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  280. return
  281. }
  282. } else {
  283. classWithUser.ClassId = req.ClassId
  284. _, err2 := classWithUserDb.ClassWithUserUpdateByUserIdentity(isHasUserIdentity.Id, classWithUser, "class_id")
  285. if err2 != nil {
  286. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  287. return
  288. }
  289. }
  290. }
  291. }
  292. e.OutSuc(c, "success", nil)
  293. return
  294. }
  295. func SaveNursingHomeUserIdentity(c *gin.Context) {
  296. var req md.SaveNursingHomeUserIdentityReq
  297. err := c.ShouldBindJSON(&req)
  298. if err != nil {
  299. err = validate.HandleValidateErr(err)
  300. err1 := err.(e.E)
  301. e.OutErr(c, err1.Code, err1.Error())
  302. return
  303. }
  304. user := svc.GetUser(c)
  305. var identity = enum.UserIdentityForNursingHome
  306. //1、判断当前身份是否已绑定
  307. userIdentityDb := db.UserIdentityDb{}
  308. userIdentityDb.Set(user.Id)
  309. isHasUserIdentity, err := userIdentityDb.UserIdentityExist(req.EnterpriseId, req.IdNo, enum.UserIdentityCertTypeForIdCard)
  310. if err != nil {
  311. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  312. return
  313. }
  314. now := time.Now()
  315. if isHasUserIdentity == nil {
  316. //2、新增身份信息
  317. userIdentity := &model.UserIdentity{
  318. Uid: user.Id,
  319. Name: req.Name,
  320. IdNo: req.IdNo,
  321. Kind: enum.UserIdentityKindForCommon,
  322. Identity: identity,
  323. EnterpriseId: req.EnterpriseId,
  324. State: enum.UserIdentityStateForNormal,
  325. Memo: "",
  326. CreateAt: now.Format("2006-01-02 15:04:05"),
  327. UpdateAt: now.Format("2006-01-02 15:04:05"),
  328. }
  329. insertAffected, err := userIdentityDb.UserIdentityInsert(userIdentity)
  330. if err != nil {
  331. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  332. return
  333. }
  334. if insertAffected <= 0 {
  335. e.OutErr(c, e.ERR_DB_ORM, "新增身份数据失败")
  336. return
  337. }
  338. } else {
  339. //4、修改身份信息
  340. isHasUserIdentity.Uid = user.Id
  341. isHasUserIdentity.Name = req.Name
  342. isHasUserIdentity.State = enum.UserIdentityStateForNormal
  343. _, err = userIdentityDb.UserIdentityUpdate(isHasUserIdentity.Id, isHasUserIdentity, "uid", "name", "state")
  344. if err != nil {
  345. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  346. return
  347. }
  348. }
  349. e.OutSuc(c, "success", nil)
  350. return
  351. }
  352. func UpdateCentralKitchenForSchoolUserIdentity(c *gin.Context) {
  353. var req md.UpdateCentralKitchenForSchoolUserIdentityReq
  354. err := c.ShouldBindJSON(&req)
  355. if err != nil {
  356. err = validate.HandleValidateErr(err)
  357. err1 := err.(e.E)
  358. e.OutErr(c, err1.Code, err1.Error())
  359. return
  360. }
  361. user := svc.GetUser(c)
  362. now := time.Now()
  363. //1、查询当前身份是否存在
  364. userIdentityDb := db.UserIdentityDb{}
  365. userIdentityDb.Set(user.Id)
  366. userIdentity, err := userIdentityDb.GetUserIdentity(req.UserIdentityId)
  367. if err != nil {
  368. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  369. return
  370. }
  371. if userIdentity == nil {
  372. e.OutErr(c, e.ERR_NO_DATA, "当前身份信息不存在")
  373. return
  374. }
  375. //2、修改身份信息
  376. userIdentity.Name = req.Name
  377. userIdentity.IdNo = req.IdNo
  378. _, err = userIdentityDb.UserIdentityUpdate(userIdentity.Id, userIdentity, "id_no", "name")
  379. if err != nil {
  380. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  381. return
  382. }
  383. //3、修改 class_with_user 记录
  384. if userIdentity.Identity == enum.UserIdentityForCentralKitchenForStudent {
  385. classWithUserDb := db.ClassWithUserDb{}
  386. classWithUserDb.Set()
  387. classWithUser, err1 := classWithUserDb.GetClassWithUserByUserIdentityId(userIdentity.Id)
  388. if err1 != nil {
  389. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  390. return
  391. }
  392. if classWithUser == nil {
  393. _, err2 := classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{
  394. UserIdentityId: userIdentity.Id,
  395. ClassId: req.ClassId,
  396. CreateAt: now.Format("2006-01-02 15:04:05"),
  397. UpdateAt: now.Format("2006-01-02 15:04:05"),
  398. })
  399. if err2 != nil {
  400. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  401. return
  402. }
  403. } else {
  404. classWithUser.ClassId = req.ClassId
  405. _, err2 := classWithUserDb.ClassWithUserUpdateByUserIdentity(userIdentity.Id, classWithUser, "class_id")
  406. if err2 != nil {
  407. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  408. return
  409. }
  410. }
  411. }
  412. e.OutSuc(c, "success", nil)
  413. return
  414. }
  415. func UpdateSelfSupportForSchoolUserIdentity(c *gin.Context) {
  416. var req md.UpdateSelfSupportForSchoolUserIdentityReq
  417. err := c.ShouldBindJSON(&req)
  418. if err != nil {
  419. err = validate.HandleValidateErr(err)
  420. err1 := err.(e.E)
  421. e.OutErr(c, err1.Code, err1.Error())
  422. return
  423. }
  424. user := svc.GetUser(c)
  425. now := time.Now()
  426. //1、查询当前身份是否存在
  427. userIdentityDb := db.UserIdentityDb{}
  428. userIdentityDb.Set(user.Id)
  429. userIdentity, err := userIdentityDb.GetUserIdentity(req.UserIdentityId)
  430. if err != nil {
  431. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  432. return
  433. }
  434. if userIdentity == nil {
  435. e.OutErr(c, e.ERR_NO_DATA, "当前身份信息不存在")
  436. return
  437. }
  438. //2、修改身份信息
  439. userIdentity.Name = req.Name
  440. userIdentity.IdNo = req.IdNo
  441. _, err = userIdentityDb.UserIdentityUpdate(userIdentity.Id, userIdentity, "id_no", "name")
  442. if err != nil {
  443. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  444. return
  445. }
  446. //3、修改 class_with_user 记录
  447. if userIdentity.Identity == enum.UserIdentityForSelfSupportForStudent {
  448. classWithUserDb := db.ClassWithUserDb{}
  449. classWithUserDb.Set()
  450. classWithUser, err1 := classWithUserDb.GetClassWithUserByUserIdentityId(userIdentity.Id)
  451. if err1 != nil {
  452. e.OutErr(c, e.ERR_DB_ORM, err1.Error())
  453. return
  454. }
  455. if classWithUser == nil {
  456. _, err2 := classWithUserDb.ClassWithUserInsert(&model.ClassWithUser{
  457. UserIdentityId: userIdentity.Id,
  458. ClassId: req.ClassId,
  459. CreateAt: now.Format("2006-01-02 15:04:05"),
  460. UpdateAt: now.Format("2006-01-02 15:04:05"),
  461. })
  462. if err2 != nil {
  463. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  464. return
  465. }
  466. } else {
  467. classWithUser.ClassId = req.ClassId
  468. _, err2 := classWithUserDb.ClassWithUserUpdateByUserIdentity(userIdentity.Id, classWithUser, "class_id")
  469. if err2 != nil {
  470. e.OutErr(c, e.ERR_DB_ORM, err2.Error())
  471. return
  472. }
  473. }
  474. }
  475. e.OutSuc(c, "success", nil)
  476. return
  477. }
  478. func UpdateNursingHomeUserIdentity(c *gin.Context) {
  479. var req md.UpdateNursingHomeUserIdentityReq
  480. err := c.ShouldBindJSON(&req)
  481. if err != nil {
  482. err = validate.HandleValidateErr(err)
  483. err1 := err.(e.E)
  484. e.OutErr(c, err1.Code, err1.Error())
  485. return
  486. }
  487. user := svc.GetUser(c)
  488. //1、查询当前身份是否存在
  489. userIdentityDb := db.UserIdentityDb{}
  490. userIdentityDb.Set(user.Id)
  491. userIdentity, err := userIdentityDb.GetUserIdentity(req.UserIdentityId)
  492. if err != nil {
  493. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  494. return
  495. }
  496. if userIdentity == nil {
  497. e.OutErr(c, e.ERR_NO_DATA, "当前身份信息不存在")
  498. return
  499. }
  500. //2、修改身份信息
  501. userIdentity.Name = req.Name
  502. userIdentity.IdNo = req.IdNo
  503. _, err = userIdentityDb.UserIdentityUpdate(userIdentity.Id, userIdentity, "id_no", "name")
  504. if err != nil {
  505. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  506. return
  507. }
  508. e.OutSuc(c, "success", nil)
  509. return
  510. }
  511. func DeleteUserIdentity(c *gin.Context) {
  512. userIdentityId := utils.StrToInt(c.Param("id"))
  513. user := svc.GetUser(c)
  514. //1、查询当前身份是否存在
  515. userIdentityDb := db.UserIdentityDb{}
  516. userIdentityDb.Set(user.Id)
  517. userIdentity, err := userIdentityDb.GetUserIdentity(userIdentityId)
  518. if err != nil {
  519. e.OutErr(c, e.ERR_DB_ORM, err.Error())
  520. return
  521. }
  522. if userIdentity == nil {
  523. e.OutErr(c, e.ERR_NO_DATA, "当前身份信息不存在")
  524. return
  525. }
  526. switch userIdentity.Identity {
  527. case enum.UserIdentityForCentralKitchenForStudent:
  528. err1 := svc.DeleteUserIdentityForCentralKitchenForStudent(userIdentity.Id)
  529. if err1 != nil {
  530. e.OutErr(c, e.ERR, err1.Error())
  531. return
  532. }
  533. break
  534. case enum.UserIdentityForCentralKitchenForTeacher:
  535. err1 := svc.DeleteUserIdentityForCentralKitchenForTeacher(userIdentity.Id)
  536. if err1 != nil {
  537. e.OutErr(c, e.ERR, err1.Error())
  538. return
  539. }
  540. break
  541. case enum.UserIdentityForCentralKitchenForWorker:
  542. break
  543. case enum.UserIdentityForSelfSupportForStudent:
  544. err1 := svc.DeleteUserIdentityForSelfSupportForStudent(userIdentity.Id)
  545. if err1 != nil {
  546. e.OutErr(c, e.ERR, err1.Error())
  547. return
  548. }
  549. break
  550. case enum.UserIdentityForSelfSupportForTeacher:
  551. err1 := svc.DeleteUserIdentityForSelfSupportForTeacher(userIdentity.Id)
  552. if err1 != nil {
  553. e.OutErr(c, e.ERR, err1.Error())
  554. return
  555. }
  556. break
  557. case enum.UserIdentityForSelfSupportForWorker:
  558. err1 := svc.DeleteUserIdentityForSelfSupportForWorker(userIdentity.Id)
  559. if err1 != nil {
  560. e.OutErr(c, e.ERR, err1.Error())
  561. return
  562. }
  563. break
  564. case enum.UserIdentityForNursingHome:
  565. err1 := svc.DeleteUserIdentityForNursingHome(userIdentity.Id)
  566. if err1 != nil {
  567. e.OutErr(c, e.ERR, err1.Error())
  568. return
  569. }
  570. break
  571. }
  572. e.OutSuc(c, "success", nil)
  573. return
  574. }