XMLWAN 3 yıl önce
ebeveyn
işleme
6eb30f3bb8

+ 20 - 7
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Dosyayı Görüntüle

@@ -126,13 +126,26 @@ func (this *XcxApiController) GetLoginInfor() {
126 126
 	//fmt.Println(mobile)
127 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 Dosyayı Görüntüle

@@ -8,7 +8,7 @@ import (
8 8
 func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
9 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 12
 	if err == gorm.ErrRecordNotFound {
13 13
 		return nil, err
14 14
 	}
@@ -21,12 +21,12 @@ func GetXcxMobileInformation(mobile string) (*models.XcxAdminUserRole, error) {
21 21
 
22 22
 func CreateXcxAdminUser(role models.XcxAdminUserRole) error {
23 23
 
24
-	err := XTWriteDB().Create(&role).Error
24
+	err := UserReadDB().Create(&role).Error
25 25
 	return err
26 26
 }
27 27
 
28 28
 func GetLoginInfor(mobile string) (models.XcxAdminUserRole, error) {
29 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 31
 	return role, err
32 32
 }