XMLWAN 4 vuotta sitten
vanhempi
commit
f3ff6c7829

+ 1 - 2
controllers/new_mobile_api_controllers/new_role_api_controller.go Näytä tiedosto

@@ -172,7 +172,6 @@ func (this *NewRoleApiController) CreateAdminUser() {
172 172
 	userTitle := this.GetString("title")
173 173
 	user_type, _ := this.GetInt("user_type", 0)
174 174
 	user_title, _ := this.GetInt("user_title", 0)
175
-	sort, _ := this.GetInt64("sort")
176 175
 	if len(mobile) == 0 || len(name) == 0 || len(role_ids) <= 0 {
177 176
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
178 177
 		return
@@ -185,7 +184,7 @@ func (this *NewRoleApiController) CreateAdminUser() {
185 184
 		return
186 185
 	} else {
187 186
 		if adminUser == nil { //新增账号和用户
188
-			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.Org.Id, adminUserInfo.App.Id, mobile, name, userTitle, role_ids, user_type, user_title, sort)
187
+			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.Org.Id, adminUserInfo.App.Id, mobile, name, userTitle, role_ids, user_type, user_title)
189 188
 			if createErr != nil {
190 189
 				//beego.Error("创建管理员失败:", createErr)
191 190
 				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)

+ 1 - 5
controllers/role_controller.go Näytä tiedosto

@@ -1,7 +1,6 @@
1 1
 package controllers
2 2
 
3 3
 import (
4
-	"fmt"
5 4
 	"github.com/jinzhu/gorm"
6 5
 	"strconv"
7 6
 	"strings"
@@ -487,9 +486,6 @@ func (this *RoleAPIController) AddAdmin() {
487 486
 	userTitle, _ := this.GetInt("title")
488 487
 	roleIds := this.GetString("role")
489 488
 	user_title_name := this.GetString("user_title_name")
490
-	sort, _ := this.GetInt64("sort")
491
-	fmt.Println("sort--------------------------------", sort)
492
-	fmt.Println("sort", sort)
493 489
 	if len(mobile) == 0 || len(name) == 0 || (userType != 2 && userType != 3 && userType != 4) || len(roleIds) <= 0 {
494 490
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
495 491
 		return
@@ -502,7 +498,7 @@ func (this *RoleAPIController) AddAdmin() {
502 498
 		return
503 499
 	} else {
504 500
 		if adminUser == nil { //新增账号和用户
505
-			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle, sort)
501
+			_, password, createErr := service.CreateGeneralAdminUser(adminUserInfo.CurrentOrgId, adminUserInfo.CurrentAppId, mobile, name, user_title_name, roleIds, userType, userTitle)
506 502
 			if createErr != nil {
507 503
 				//beego.Error("创建管理员失败:", createErr)
508 504
 				this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDBCreate)

+ 2 - 3
service/role_service.go Näytä tiedosto

@@ -141,7 +141,7 @@ func GetAdminUsersAndLoginInfo(orgID int64, appID int64, page int, count int) ([
141 141
 		page = 1
142 142
 	}
143 143
 	var viewModels []*AdminUserManageViewModel = make([]*AdminUserManageViewModel, 0)
144
-	rows, err := readUserDb.Raw("SELECT u_a_r.admin_user_id, u_a_r.user_name, u_a_r.user_title, u_l.ip, u_l.ctime, u_a_r.status,u_a_r.avatar,u_a_r.role_ids,u_a_r.sort FROM sgj_user_admin_role AS u_a_r   LEFT JOIN (SELECT * FROM (SELECT admin_user_id, org_id, app_id, ip, ctime FROM sgj_user_admin_login_log WHERE org_id = ? AND app_id = ?  ORDER BY ctime DESC) AS t GROUP BY admin_user_id) AS u_l  ON u_a_r.org_id = u_l.org_id AND u_a_r.app_id = u_l.app_id AND u_a_r.admin_user_id = u_l.admin_user_id WHERE u_a_r.org_id = ? AND u_a_r.app_id = ? GROUP BY u_a_r.admin_user_id order by u_a_r.sort LIMIT ? OFFSET ?;", orgID, appID, orgID, appID, count, (page-1)*count).Rows()
144
+	rows, err := readUserDb.Raw("SELECT u_a_r.admin_user_id, u_a_r.user_name, u_a_r.user_title, u_l.ip, u_l.ctime, u_a_r.status,u_a_r.avatar,u_a_r.role_ids,u_a_r.sort FROM sgj_user_admin_role AS u_a_r   LEFT JOIN (SELECT * FROM (SELECT admin_user_id, org_id, app_id, ip, ctime FROM sgj_user_admin_login_log WHERE org_id = ? AND app_id = ?  ORDER BY ctime DESC) AS t GROUP BY admin_user_id) AS u_l  ON u_a_r.org_id = u_l.org_id AND u_a_r.app_id = u_l.app_id AND u_a_r.admin_user_id = u_l.admin_user_id WHERE u_a_r.org_id = ? AND u_a_r.app_id = ? GROUP BY u_a_r.admin_user_id  LIMIT ? OFFSET ?;", orgID, appID, orgID, appID, count, (page-1)*count).Rows()
145 145
 	defer rows.Close()
146 146
 	if err != nil {
147 147
 		if err == gorm.ErrRecordNotFound {
@@ -309,7 +309,7 @@ func IsUserSuperAdminWithMobile(mobile string) (bool, error) {
309 309
 	return user.IsSuperAdmin, nil
310 310
 }
311 311
 
312
-func CreateGeneralAdminUser(orgID int64, appID int64, mobile string, name string, userTitle string, roleIds string, user_type int, user_title int, sort int64) (*models.AdminUser, string, error) {
312
+func CreateGeneralAdminUser(orgID int64, appID int64, mobile string, name string, userTitle string, roleIds string, user_type int, user_title int) (*models.AdminUser, string, error) {
313 313
 	now := time.Now().Unix()
314 314
 	tx := writeUserDb.Begin()
315 315
 	var adminUser models.AdminUser
@@ -345,7 +345,6 @@ func CreateGeneralAdminUser(orgID int64, appID int64, mobile string, name string
345 345
 		CreateTime:    now,
346 346
 		ModifyTime:    now,
347 347
 		RoleIds:       roleIds,
348
-		Sort:          sort,
349 348
 	}
350 349
 	if createApp_RoleErr := tx.Create(&app_role).Error; createApp_RoleErr != nil {
351 350
 		tx.Rollback()