XMLWAN před 3 roky
rodič
revize
f231511a40

+ 10 - 8
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Zobrazit soubor

@@ -71,8 +71,9 @@ func (this *XcxApiController) GetUserRegister() {
71 71
 	fmt.Println("id_card_no", id_card_no)
72 72
 	mobile := this.GetString("mobile")
73 73
 	code := this.GetString("code")
74
-	patient, errcodes := service.GetMobilePatient(id_card_no)
75
-	if errcodes == gorm.ErrRecordNotFound {
74
+	patient, errcodes := service.GetMobilePatient("420983197011169574")
75
+	fmt.Println("errcodes2323232232", errcodes)
76
+	if errcodes == nil {
76 77
 		role := models.XcxAdminUserRole{
77 78
 			PatientName: name,
78 79
 			IdCardNo:    id_card_no,
@@ -101,15 +102,16 @@ func (this *XcxApiController) GetUserRegister() {
101 102
 					"msg":     "绑定失败",
102 103
 				})
103 104
 			}
105
+			mobilePatient, _ := service.GetMobilePatient(id_card_no)
104 106
 			this.ServeSuccessJSON(map[string]interface{}{
105
-				"role": role,
107
+				"role":          role,
108
+				"mobilePatient": mobilePatient,
106 109
 			})
107 110
 
108
-		} else if errcode == nil {
109
-			mobilePatient, _ := service.GetMobilePatient(id_card_no)
111
+		} else if errcode == gorm.ErrRecordNotFound {
112
+
110 113
 			this.ServeSuccessJSON(map[string]interface{}{
111
-				"is_bind": true,
112
-				"patient": mobilePatient,
114
+				"is_bind": false,
113 115
 			})
114 116
 		}
115 117
 
@@ -163,7 +165,7 @@ func (this *XcxApiController) GetLoginInfor() {
163 165
 	this.ServeSuccessJSON(map[string]interface{}{
164 166
 		"patient": info,
165 167
 		"role":    user_admin,
166
-		"is_bind": "true",
168
+		"is_bind": true,
167 169
 	})
168 170
 }
169 171