|
@@ -6,6 +6,7 @@ import (
|
6
|
6
|
"Xcx_New/models"
|
7
|
7
|
"Xcx_New/service"
|
8
|
8
|
"Xcx_New/utils"
|
|
9
|
+ "encoding/json"
|
9
|
10
|
"fmt"
|
10
|
11
|
"github.com/astaxie/beego"
|
11
|
12
|
"github.com/jinzhu/gorm"
|
|
@@ -26,7 +27,7 @@ func XcxApiControllersRegisterRouters() {
|
26
|
27
|
beego.Router("/xcx/api/mobile/patient", &XcxApiController{}, "Get:GetPatientList")
|
27
|
28
|
|
28
|
29
|
//获取登录后的信息
|
29
|
|
- beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Get:GetDataInfo")
|
|
30
|
+ beego.Router("/xcx/api/mobile/getdatainfo", &XcxApiController{}, "Post:GetDataInfo")
|
30
|
31
|
|
31
|
32
|
//获取排班数据
|
32
|
33
|
beego.Router("/xcx/api/mobile/schedule", &XcxApiController{}, "Get:GetScheduleInfo")
|
|
@@ -201,11 +202,18 @@ func (this *XcxApiController) GetPatientList() {
|
201
|
202
|
}
|
202
|
203
|
|
203
|
204
|
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)
|
204
|
216
|
|
205
|
|
- appid := this.GetString("appid")
|
206
|
|
- key := this.GetString("key")
|
207
|
|
- iv := this.GetString("iv")
|
208
|
|
- encryptedData := this.GetString("encryptedData")
|
209
|
217
|
list, err := service.DecryptData(appid, key, iv, encryptedData)
|
210
|
218
|
if err == nil {
|
211
|
219
|
this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
@@ -219,12 +227,22 @@ func (this *XcxApiController) GetDataInfo() {
|
219
|
227
|
|
220
|
228
|
func (this *XcxApiController) GetScheduleInfo() {
|
221
|
229
|
thisWeekMonday := service.GetFirstDateOfWeek()
|
222
|
|
-
|
|
230
|
+ weekDayWeek := service.GetWeekDayOfWeek()
|
223
|
231
|
TimeMonday, _ := time.Parse("2006-01-02", thisWeekMonday)
|
|
232
|
+ weekDays, _ := time.Parse("2006-01-02", weekDayWeek)
|
224
|
233
|
lastWeekMonday := TimeMonday.AddDate(0, 0, -7)
|
225
|
|
- nextWeekMonday := TimeMonday.AddDate(0, 0, +7)
|
|
234
|
+ nextWeekMonday := weekDays.AddDate(0, 0, +13)
|
226
|
235
|
var weekMonday = lastWeekMonday.Format("2006-01-02")
|
227
|
236
|
var weekDay = nextWeekMonday.Format("2006-01-02")
|
228
|
237
|
fmt.Println("weekmodonday", weekMonday)
|
229
|
238
|
fmt.Println("nextweeekday", weekDay)
|
|
239
|
+
|
|
240
|
+ timeLayout := "2006-01-02 15:04:05"
|
|
241
|
+ loc, _ := time.LoadLocation("Local")
|
|
242
|
+
|
|
243
|
+ startTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", weekMonday+" 00:00:00", loc)
|
|
244
|
+
|
|
245
|
+ endTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", weekDay+" 00:00:00", loc)
|
|
246
|
+
|
|
247
|
+ fmt.Println(startTime.Unix(), endTime.Unix())
|
230
|
248
|
}
|