Bladeren bron

体积小

XMLWAN 3 jaren geleden
bovenliggende
commit
877c5987f3
2 gewijzigde bestanden met toevoegingen van 6 en 23 verwijderingen
  1. 4 21
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go
  2. 2 2
      service/xcx_mobile_api_service.go

+ 4 - 21
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go Bestand weergeven

@@ -182,9 +182,9 @@ func (this *XcxApiController) GetLoginInfor() {
182 182
 
183 183
 func (this *XcxApiController) GetPatientList() {
184 184
 	var appid = "wx20b60369111b063a"
185
-	var key = "HobHcmPatZ0O5emMYcFo1Q=="
186
-	var iv = "wJjr8o47Jv8zBoZF5la+jw=="
187
-	var strs = "DKj+ZzSKd77D2X84UqySTfTOxcZ9W5yAArqt74g3Fek+/8N97XI3nKzLO4QadJxwl9f8BDqrpl2dauqNBC4HbkggFcEB9j1zsYDKAm5cM0NPOkjcHeGF8dxpuJGdXWFKZErD957XEPtyODbE3IUMIx/n8haGtCa3W9v5Gqosqxrb6eNY9ogf8V1dy2guuxVAxWojuZ2DLyYovksFLccD5Q=="
185
+	var key = "4BactRvIKCBXzvpyl2SQyQ=="
186
+	var iv = "aXiAcKIWKfseTyzelqcZ0w=="
187
+	var strs = "Gr5gmKz9OjWGipAxt3ujQtHBBXV/Uvhsm+qvvZy6gF+HBc8c6gZhZkqIqLbs8nHkId5zm/mGVNpghvM/egYTLOOI7LxhvjRsPE1691j+jltU9OIavGIWFp3I4m3OdP9CuPohhrpZPgwsGajJmtGNNjPvGA61ssErVZ7SBceq+leag532zCmgEXN3NpZP0TRgpIpwpegCAEW07oyI0LiRYA=="
188 188
 	data, err := service.DecryptData(appid, key, iv, strs)
189 189
 	patient_id, _ := this.GetInt64("patient_id")
190 190
 	patient, err := service.GetPatientListByPatientId(patient_id)
@@ -201,30 +201,13 @@ func (this *XcxApiController) GetPatientList() {
201 201
 }
202 202
 
203 203
 func (this *XcxApiController) GetDataInfo() {
204
-	// dataBody := make(map[string]interface{}, 0)
205
-	// fmt.Println("dataBody",dataBody)
206
-	// err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
207
-	// if err != nil {
208
-	// 	utils.ErrorLog(err.Error())
209
-	// 	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
210
-	// 	return
211
-	// }
212
-	// fmt.Println(err)
213
-	// appid, _ := dataBody["appid"].(string)
214
-	// key, _ := dataBody["key"].(string)
215
-	// iv, _ := dataBody["iv"].(string)
216
-	// encryptedData, _ := dataBody["encryptedData"].(string)
204
+
217 205
 	appid := this.GetString("appid")
218 206
 	key := this.GetString("key")
219 207
 	iv := this.GetString("iv")
220 208
 	encryptedData := this.GetString("encryptedData")
221 209
 	list, _ := service.DecryptData(appid, key, iv, encryptedData)
222 210
 	fmt.Println(list)
223
-	// if err == nil {
224
-	// 	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
225
-	// 	return
226
-	// }
227
-
228 211
 	this.ServeSuccessJSON(map[string]interface{}{
229 212
 		"list": list,
230 213
 	})

+ 2 - 2
service/xcx_mobile_api_service.go Bestand weergeven

@@ -53,7 +53,7 @@ func GetPatientListByPatientId(id int64) (models.XcxPatients, error) {
53 53
 }
54 54
 
55 55
 func DecryptData(app_id, session_key, iv, encrypted_data string) (map[string]interface{}, error) {
56
-	if len := strings.Count(session_key, "") - 1; len != 24 {
56
+	if len := strings.Count(session_key, "") - 1; len != 30 {
57 57
 		return nil, errors.New("Invalid value session_key!")
58 58
 	}
59 59
 	aesKey, err := base64.StdEncoding.DecodeString(session_key)
@@ -61,7 +61,7 @@ func DecryptData(app_id, session_key, iv, encrypted_data string) (map[string]int
61 61
 		return nil, err
62 62
 	}
63 63
 
64
-	if len := strings.Count(iv, "") - 1; len != 24 {
64
+	if len := strings.Count(iv, "") - 1; len != 30 {
65 65
 		return nil, errors.New("Invalid value iv!")
66 66
 	}
67 67
 	ivKey, err := base64.StdEncoding.DecodeString(iv)