Browse Source

体积小

XMLWAN 3 years ago
parent
commit
feccbb8706
1 changed files with 16 additions and 11 deletions
  1. 16 11
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go

+ 16 - 11
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

@@ -71,7 +71,7 @@ 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("420983197011169574")
74
+	patient, errcodes := service.GetMobilePatient(id_card_no)
75 75
 	fmt.Println("errcodes2323232232", errcodes)
76 76
 	if errcodes == nil {
77 77
 		role := models.XcxAdminUserRole{
@@ -153,18 +153,23 @@ func (this *XcxApiController) GetLoginInfor() {
153 153
 
154 154
 	mobile := this.GetString("mobile")
155 155
 	fmt.Println(mobile)
156
-	info, _ := service.GetMobilePatientInfo(mobile)
157
-	user_admin, err := service.GetXcxMobileInformation(mobile)
158
-	if err == nil {
159
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
160
-		return
156
+	user_admin, errcodes := service.GetXcxMobileInformation(mobile)
157
+	if errcodes == gorm.ErrRecordNotFound {
158
+		info, _ := service.GetMobilePatientInfo(mobile)
159
+		this.ServeSuccessJSON(map[string]interface{}{
160
+			"patient": info,
161
+			"role":    user_admin,
162
+			"is_bind": false,
163
+		})
164
+	} else if errcodes == nil {
165
+		info, _ := service.GetMobilePatientInfo(mobile)
166
+		this.ServeSuccessJSON(map[string]interface{}{
167
+			"patient": info,
168
+			"role":    user_admin,
169
+			"is_bind": true,
170
+		})
161 171
 	}
162 172
 
163
-	this.ServeSuccessJSON(map[string]interface{}{
164
-		"patient": info,
165
-		"role":    user_admin,
166
-		"is_bind": true,
167
-	})
168 173
 }
169 174
 
170 175
 func (this *XcxApiController) GetPatientList() {