see999 3 years ago
parent
commit
3071d4e6de
1 changed files with 24 additions and 19 deletions
  1. 24 19
      controllers/xcx_mobile_api_controller.go/xcx_api_controller.go

+ 24 - 19
controllers/xcx_mobile_api_controller.go/xcx_api_controller.go View File

6
 	"Xcx_New/models"
6
 	"Xcx_New/models"
7
 	"Xcx_New/service"
7
 	"Xcx_New/service"
8
 	"Xcx_New/utils"
8
 	"Xcx_New/utils"
9
-	"encoding/json"
10
 	"fmt"
9
 	"fmt"
11
 	"github.com/astaxie/beego"
10
 	"github.com/astaxie/beego"
12
 	"github.com/jinzhu/gorm"
11
 	"github.com/jinzhu/gorm"
27
 	beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
26
 	beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
28
 
27
 
29
 	//获取登录后的信息
28
 	//获取登录后的信息
30
-	beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Post:GetDataInfo")
29
+	beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Get:GetDataInfo")
31
 
30
 
32
 	//获取排班数据
31
 	//获取排班数据
33
 	beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
32
 	beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
202
 }
201
 }
203
 
202
 
204
 func (this *XcxApiController) GetDataInfo() {
203
 func (this *XcxApiController) GetDataInfo() {
205
-	dataBody := make(map[string]interface{}, 0)
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
-	appid, _ := dataBody["appid"].(string)
213
-	key, _ := dataBody["key"].(string)
214
-	iv, _ := dataBody["iv"].(string)
215
-	encryptedData, _ := dataBody["encryptedData"].(string)
216
-
217
-	list, err := service.DecryptData(appid, key, iv, encryptedData)
218
-	if err == nil {
219
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
220
-		return
221
-	}
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)
217
+	appid := this.GetString("appid")
218
+	key := this.GetString("key")
219
+	iv := this.GetString("iv")
220
+	encryptedData := this.GetString("encryptedData")
221
+	list, _ := service.DecryptData(appid, key, iv, encryptedData)
222
+	fmt.Println(list)
223
+	// if err == nil {
224
+	// 	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
225
+	// 	return
226
+	// }
222
 
227
 
223
 	this.ServeSuccessJSON(map[string]interface{}{
228
 	this.ServeSuccessJSON(map[string]interface{}{
224
 		"list": list,
229
 		"list": list,