Browse Source

体积小

XMLWAN 3 years ago
parent
commit
6eb30f3bb8

+ 20 - 7
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

126
 	//fmt.Println(mobile)
126
 	//fmt.Println(mobile)
127
 	role, err := service.GetLoginInfor("18923081560")
127
 	role, err := service.GetLoginInfor("18923081560")
128
 
128
 
129
-	fmt.Println("err2332323232", err)
130
-	if err == nil {
131
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
132
-		return
129
+	if role.ID == 0 {
130
+		if err == nil {
131
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
132
+			return
133
+		}
134
+
135
+		this.ServeSuccessJSON(map[string]interface{}{
136
+			"role":    role,
137
+			"is_bind": false,
138
+		})
139
+	} else {
140
+		if err == nil {
141
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
142
+			return
143
+		}
144
+
145
+		this.ServeSuccessJSON(map[string]interface{}{
146
+			"role":    role,
147
+			"is_bind": true,
148
+		})
133
 	}
149
 	}
134
 
150
 
135
-	this.ServeSuccessJSON(map[string]interface{}{
136
-		"role": role,
137
-	})
138
 }
151
 }

+ 3 - 3
service/xcx_mobile_api_service.go View File

8
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
8
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
9
 	role := models.XcxAdminUserRole{}
9
 	role := models.XcxAdminUserRole{}
10
 
10
 
11
-	err := XTReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
11
+	err := UserReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
12
 	if err == gorm.ErrRecordNotFound {
12
 	if err == gorm.ErrRecordNotFound {
13
 		return nil, err
13
 		return nil, err
14
 	}
14
 	}
21
 
21
 
22
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
22
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
23
 
23
 
24
-	err := XTWriteDB().Create(&role).Error
24
+	err := UserReadDB().Create(&role).Error
25
 	return err
25
 	return err
26
 }
26
 }
27
 
27
 
28
 func GetLoginInfor(mobile string) (models.XcxAdminUserRole, error) {
28
 func GetLoginInfor(mobile string) (models.XcxAdminUserRole, error) {
29
 	role := models.XcxAdminUserRole{}
29
 	role := models.XcxAdminUserRole{}
30
-	err := XTReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
30
+	err := UserReadDB().Model(&role).Where("mobile = ? and status = 1", mobile).Find(&role).Error
31
 	return role, err
31
 	return role, err
32
 }
32
 }