fix: 优化工作人员重复信息提示

This commit is contained in:
czl231
2026-08-11 13:37:44 +08:00
parent 5738a43f3e
commit 4d79a4917e
12 changed files with 440 additions and 9 deletions

View File

@@ -71,7 +71,7 @@ func CreateStaff(ctx *gin.Context) {
Name: request.Name, Phone: request.Phone, Avatar: request.Avatar, RoleCode: "delivery",
GasBasicID: point.GasBasicID, DeliveryBasicID: point.ID, WorkStatus: request.WorkStatus,
}
if err := db().Create(&staff).Error; err != nil {
if err := common.CreateStaffRecord(&staff); err != nil {
infra.Response.Error(ctx, err)
return
}
@@ -92,9 +92,9 @@ func UpdateStaff(ctx *gin.Context) {
infra.Response.Error(ctx, errcode.ErrInvalidArgument)
return
}
common.UpdateAllowedByIdentity(ctx, &models.StaffAccount{}, gin.H{
common.UpdateAllowedByIdentityWithError(ctx, &models.StaffAccount{}, gin.H{
"name": request.Name, "phone": request.Phone, "avatar": request.Avatar, "work_status": request.WorkStatus,
}, []string{"name", "phone", "avatar", "work_status"})
}, []string{"name", "phone", "avatar", "work_status"}, common.StaffWriteError)
}
func ResetStaffPassword(ctx *gin.Context) {