Browse Source

押金管理bug修改

mainqaq 2 years ago
parent
commit
c08d8a4c80
3 changed files with 19 additions and 1 deletions
  1. 1 1
      controllers/his_deposit_controller.go
  2. 3 0
      controllers/role_controller.go
  3. 15 0
      service/role_service.go

+ 1 - 1
controllers/his_deposit_controller.go View File

@@ -504,7 +504,7 @@ func (this *HisDepositApiController) GetUserList() {
504 504
 //扣费明细查询
505 505
 func (this *HisDepositApiController) DeductionDetails() {
506 506
 	orgid := this.GetAdminUserInfo().CurrentOrgId
507
-	orgid = 9675
507
+	//orgid = 9675
508 508
 	timeLayout := "2006-01-02"
509 509
 	loc, _ := time.LoadLocation("Local")
510 510
 	keyword := this.GetString("keyword")

+ 3 - 0
controllers/role_controller.go View File

@@ -1211,6 +1211,7 @@ func (this *RoleAPIController) EditAdmin() {
1211 1211
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdminUserNotExist)
1212 1212
 		return
1213 1213
 	}
1214
+	appRole.OrgId = this.GetAdminUserInfo().CurrentOrgId
1214 1215
 	appRole.Department = department
1215 1216
 	appRole.DepartmentId = department_id
1216 1217
 	appRole.UserName = name
@@ -1255,6 +1256,8 @@ func (this *RoleAPIController) EditAdmin() {
1255 1256
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBUpdate)
1256 1257
 
1257 1258
 	} else {
1259
+		//判断当前角色是否为机构管理员
1260
+
1258 1261
 		this.ServeSuccessJSON(map[string]interface{}{
1259 1262
 			"approle": appRole,
1260 1263
 		})

+ 15 - 0
service/role_service.go View File

@@ -279,6 +279,21 @@ func SaveAppRole(appRole *models.App_Role) error {
279 279
 		tx.Rollback()
280 280
 		return err
281 281
 	}
282
+	var tmp models.Org
283
+	//根据机构id查询管理员id
284
+	tx.Model(&models.Org{}).Where("status = 1 and id = ?", appRole.OrgId).Find(&tmp)
285
+	//如果相等则修改管理员的姓名
286
+	if tmp.Creator == appRole.AdminUserId {
287
+		err = tx.Model(&models.AdminUser{}).Where("id = ?", appRole.AdminUserId).Updates(map[string]interface{}{
288
+			"mtime": time.Now().Unix(),
289
+			"name":  appRole.UserName,
290
+		}).Error
291
+		if err != nil {
292
+			tx.Rollback()
293
+			return err
294
+		}
295
+	}
296
+
282 297
 	return tx.Commit().Error
283 298
 }
284 299