XMLWAN 3 年 前
コミット
1130594db3
共有1 個のファイルを変更した9 個の追加46 個の削除を含む
  1. 9 46
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go

+ 9 - 46
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go ファイルの表示

@@ -154,54 +154,17 @@ func (this *XcxApiController) GetLoginInfor() {
154 154
 	mobile := this.GetString("mobile")
155 155
 	fmt.Println(mobile)
156 156
 	info, _ := service.GetMobilePatientInfo(mobile)
157
-	if info.ID == 0 {
158
-		this.ServeSuccessJSON(map[string]interface{}{
159
-			"is_bind": false,
160
-			"info":    info,
161
-		})
162
-	} else {
163
-		_, errcode := service.GetLoginInfor(mobile)
164
-		if errcode == gorm.ErrRecordNotFound {
165
-			role := models.XcxAdminUserRole{
166
-				PatientName: info.Name,
167
-				IdCardNo:    info.IdCardNo,
168
-				Mobile:      mobile,
169
-				Code:        "",
170
-				PatientId:   info.ID,
171
-				UserOrgId:   info.UserOrgId,
172
-				Status:      1,
173
-				Ctime:       time.Now().Unix(),
174
-				Mtime:       0,
175
-				Appid:       "",
176
-				Appsecret:   "",
177
-				SessionKey:  "",
178
-			}
179
-			err := service.CreateXcxAdminUser(role)
180
-			fmt.Println(err)
181
-			if err == nil {
182
-				this.ServeSuccessJSON(map[string]interface{}{
183
-					"is_bind": true,
184
-					"info":    info,
185
-				})
186
-			} else if err != nil {
187
-				this.ServeSuccessJSON(map[string]interface{}{
188
-					"is_bind": false,
189
-					"info":    info,
190
-				})
191
-			}
192
-
193
-		} else {
194
-			this.ServeSuccessJSON(map[string]interface{}{
195
-				"is_bind": true,
196
-				"info":    info,
197
-			})
198
-		}
199
-		this.ServeSuccessJSON(map[string]interface{}{
200
-			"is_bind": true,
201
-			"info":    info,
202
-		})
157
+	user_admin, err := service.GetXcxMobileInformation(mobile)
158
+	if err == nil {
159
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
160
+		return
203 161
 	}
204 162
 
163
+	this.ServeSuccessJSON(map[string]interface{}{
164
+		"patient": info,
165
+		"role":    user_admin,
166
+		"is_bind": "true",
167
+	})
205 168
 }
206 169
 
207 170
 func (this *XcxApiController) GetPatientList() {