package service import ( "bytes" "encoding/json" "gdyb/models" "gdyb/utils" "github.com/astaxie/beego" "github.com/robfig/cron" "io/ioutil" "math/rand" "net/http" "strconv" "time" ) type ResultSix struct { Cainfo interface{} `json:"cainfo"` ErrMsg string `json:"err_msg"` InfRefmsgid string `json:"inf_refmsgid"` Infcode int64 `json:"infcode"` Output struct { } `json:"output"` RefmsgTime string `json:"refmsg_time"` RespondTime string `json:"respond_time"` Signtype interface{} `json:"signtype"` WarnMsg interface{} `json:"warn_msg"` } type ResultSix10265 struct { Cainfo interface{} `json:"cainfo"` ErrMsg string `json:"err_msg"` InfRefmsgid string `json:"inf_refmsgid"` Infcode string `json:"infcode"` Output struct { } `json:"output"` RefmsgTime string `json:"refmsg_time"` RespondTime string `json:"respond_time"` Signtype interface{} `json:"signtype"` WarnMsg interface{} `json:"warn_msg"` } // cron表达式 https://www.cnblogs.com/zuxingyu/p/6023919.html var createWeekSchedulesCronJob *cron.Cron func init() { utils.InfoLog("开启自动排班定时任务") createWeekSchedulesCronJob = cron.New() spec := "0 0 18 * * ?" // 每天6点上传当天数据 //spec := "0 */1 * * * ?" createWeekSchedulesCronJob.AddFunc(spec, func() { AutoCreateStock() }) } func BeginAutoCreateWeekSchedulesJob() { createWeekSchedulesCronJob.Start() } func AutoCreateStock() { org_id, _ := beego.AppConfig.Int64("org_id") var NewWarehousing []*models.NewWarehousingInfo var NewWarehouseOut []*models.NewWarehouseOutInfo var NewCancelStock []*models.NewCancelStockInfo var NewDrugWarehouse []*models.NewDrugWarehouseInfo var NewDrugWarehouseOut []*models.NewDrugWarehouseOutInfo var NewDrugCancelStock []*models.NewDrugCancelStockInfo readDb.Model(&models.NewWarehousingInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehousing) readDb.Model(&models.NewWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewWarehouseOut) readDb.Model(&models.NewCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("GoodInfo", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewCancelStock) readDb.Model(&models.NewDrugWarehouseInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouse) readDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugWarehouseOut) readDb.Model(&models.NewDrugCancelStockInfo{}).Where("user_org_id = ? and status = 1 and is_upload <> 1", org_id).Preload("BaseDrugLib", "status = 1").Preload("Manufacturers", "status = 1 AND org_id = ?", org_id).Preload("Dealers", "status = 1 AND org_id = ?", org_id).Find(&NewDrugCancelStock) for _, item := range NewWarehousing { res := Post3503ForGoodInfo(org_id, item) if res.Infcode == 0 { writeDb.Model(&models.NewWarehousingInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{ "is_upload": 1, }) } else { continue } } for _, item := range NewWarehouseOut { res := Post3505ForGoodInfo(org_id, item) if res.Infcode == 0 { writeDb.Model(&models.NewWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{ "is_upload": 1, }) } else { continue } } for _, item := range NewCancelStock { res := Post3506ForGoodInfo(org_id, item) if res.Infcode == 0 { writeDb.Model(&models.NewCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{ "is_upload": 1, }) } else { continue } } for _, item := range NewDrugWarehouse { res := Post3503ForDrug(org_id, item) if res.Infcode == 0 { writeDb.Model(&models.NewDrugWarehouseInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{ "is_upload": 1, }) } else { continue } } for _, item := range NewDrugWarehouseOut { res := Post3505ForDrug(org_id, item) if res.Infcode == 0 { writeDb.Model(&models.NewDrugWarehouseOutInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{ "is_upload": 1, }) } } for _, item := range NewDrugCancelStock { res := Post3506ForDrug(org_id, item) if res.Infcode == 0 { writeDb.Model(&models.NewDrugCancelStockInfo{}).Where("id = ?", item.ID).Updates(map[string]interface{}{ "is_upload": 1, }) } else { continue } } } //采购 func Post3503ForGoodInfo(org_id int64, infos *models.NewWarehousingInfo) ResultSix { var res ResultSix miConfig, _ := FindMedicalInsuranceInfo(org_id) data := make(map[string]interface{}) var struct3503s []models.Struct3503 var struct3503 models.Struct3503 struct3503.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber struct3503.FixmedinsHilistId = miConfig.Code struct3503.FixmedinsHilistName = miConfig.OrgName struct3503.FixmedinsBchno = infos.Number struct3503.SplerName = infos.Dealers.DealerName struct3503.ManuLotnum = infos.Number struct3503.ProdentpName = infos.Manufacturers.ManufacturerName struct3503.Aprvno = infos.LicenseNumber struct3503.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05") struct3503.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05") struct3503.PurcRetnCnt = strconv.FormatInt(infos.TotalCount, 10) struct3503.RxFlag = "0" struct3503.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05") struct3503.PurcRetnOpterName = "仓管员" struct3503.OrgName = miConfig.OrgName struct3503.AccessKey = miConfig.AccessKey struct3503.RequestUrl = miConfig.Url struct3503.SecretKey = miConfig.SecretKey struct3503.Memo = "" struct3503s = append(struct3503s, struct3503) data["struct_3501s"] = struct3503s client := &http.Client{} bytesData, _ := json.Marshal(data) var req *http.Request if miConfig.MdtrtareaAdmvs == "320921" { req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3503", bytes.NewReader(bytesData)) } else { req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3503", bytes.NewReader(bytesData)) } resp, _ := client.Do(req) defer resp.Body.Close() body, ioErr := ioutil.ReadAll(resp.Body) if ioErr != nil { utils.ErrorLog("接口返回数据读取失败: %v", ioErr) res.Infcode = -1 return res } var respJSON map[string]interface{} if err := json.Unmarshal([]byte(body), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) res.Infcode = -1 return res } var resSix10265 ResultSix10265 //1101结果 respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{}) result, _ := json.Marshal(respJSON) if err := json.Unmarshal([]byte(result), &resSix10265); err != nil { utils.ErrorLog("解析失败:%v", err) res.Infcode = -1 return res } res.InfRefmsgid = resSix10265.InfRefmsgid res.Output = resSix10265.Output res.ErrMsg = resSix10265.ErrMsg res.Cainfo = resSix10265.Cainfo res.WarnMsg = resSix10265.WarnMsg infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64) res.Infcode = infocode return res } func Post3503ForDrug(org_id int64, infos *models.NewDrugWarehouseInfo) ResultSix { var res ResultSix miConfig, _ := FindMedicalInsuranceInfo(org_id) data := make(map[string]interface{}) var struct3501s []models.Struct3503 var struct3501 models.Struct3503 struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber struct3501.FixmedinsHilistId = miConfig.Code struct3501.FixmedinsHilistName = miConfig.OrgName struct3501.FixmedinsBchno = infos.BatchNumber struct3501.SplerName = infos.Dealers.DealerName struct3501.ManuLotnum = infos.BatchNumber struct3501.ProdentpName = infos.Manufacturers.ManufacturerName struct3501.Aprvno = infos.BaseDrugLib.Number struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05") struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05") struct3501.PurcRetnCnt = strconv.FormatInt(infos.WarehousingCount, 10) struct3501.RxFlag = "0" struct3501.PurcRetnStoinTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05") struct3501.PurcRetnOpterName = "仓管员" struct3501.OrgName = miConfig.OrgName struct3501.AccessKey = miConfig.AccessKey struct3501.RequestUrl = miConfig.Url struct3501.SecretKey = miConfig.SecretKey struct3501.Memo = "" struct3501s = append(struct3501s, struct3501) data["struct_3501s"] = struct3501s client := &http.Client{} bytesData, _ := json.Marshal(data) var req *http.Request if miConfig.MdtrtareaAdmvs == "320921" { req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3503", bytes.NewReader(bytesData)) } else { req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3503", bytes.NewReader(bytesData)) } resp, _ := client.Do(req) defer resp.Body.Close() body, ioErr := ioutil.ReadAll(resp.Body) if ioErr != nil { utils.ErrorLog("接口返回数据读取失败: %v", ioErr) res.Infcode = -1 return res } var respJSON map[string]interface{} if err := json.Unmarshal([]byte(body), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) res.Infcode = -1 return res } var resSix10265 ResultSix10265 //1101结果 respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{}) result, _ := json.Marshal(respJSON) if err := json.Unmarshal([]byte(result), &resSix10265); err != nil { utils.ErrorLog("解析失败:%v", err) res.Infcode = -1 return res } res.InfRefmsgid = resSix10265.InfRefmsgid res.Output = resSix10265.Output res.ErrMsg = resSix10265.ErrMsg res.Cainfo = resSix10265.Cainfo res.WarnMsg = resSix10265.WarnMsg infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64) res.Infcode = infocode return res } //销售 func Post3505ForGoodInfo(org_id int64, infos *models.NewWarehouseOutInfo) ResultSix { var res ResultSix miConfig, _ := FindMedicalInsuranceInfo(org_id) data := make(map[string]interface{}) var struct3501s []models.Struct3505 var struct3501 models.Struct3505 struct3501.OrgName = miConfig.OrgName struct3501.AccessKey = miConfig.AccessKey struct3501.RequestUrl = miConfig.Url struct3501.SecretKey = miConfig.SecretKey struct3501.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber struct3501.FixmedinsHilistId = miConfig.Code struct3501.FixmedinsHilistName = miConfig.OrgName struct3501.FixmedinsBchno = infos.Number if org_id == 10188 { struct3501.PrscDrName = "王曙光" struct3501.PharName = "王曙光" struct3501.PharPracCertNo = "" } else if org_id == 10217 { struct3501.PrscDrName = "王云刚" struct3501.PharName = "王云刚" struct3501.PharPracCertNo = "" } timestamp := time.Now().Unix() tempTime := time.Unix(timestamp, 0) timeFormat := tempTime.Format("20060102150405") chrgBchno := rand.Intn(100000) + 10000 ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) struct3501.MdtrtSn = ipt_otp_no struct3501.ManuLotnum = infos.Number struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05") struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05") struct3501.RxFlag = "0" struct3501.TrdnFlag = "1" struct3501.RtalDocno = strconv.FormatInt(int64(infos.ID), 10) struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10) struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05") struct3501.SelRetnOpterName = "仓管员" struct3501s = append(struct3501s, struct3501) data["struct_3501s"] = struct3501s client := &http.Client{} bytesData, _ := json.Marshal(data) var req *http.Request if miConfig.MdtrtareaAdmvs == "320921" { req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData)) } else { req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData)) } resp, _ := client.Do(req) defer resp.Body.Close() body, ioErr := ioutil.ReadAll(resp.Body) if ioErr != nil { utils.ErrorLog("接口返回数据读取失败: %v", ioErr) res.Infcode = -1 return res } var respJSON map[string]interface{} if err := json.Unmarshal([]byte(body), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) res.Infcode = -1 return res } var resSix10265 ResultSix10265 //1101结果 respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{}) result, _ := json.Marshal(respJSON) if err := json.Unmarshal([]byte(result), &resSix10265); err != nil { utils.ErrorLog("解析失败:%v", err) res.Infcode = -1 return res } res.InfRefmsgid = resSix10265.InfRefmsgid res.Output = resSix10265.Output res.ErrMsg = resSix10265.ErrMsg res.Cainfo = resSix10265.Cainfo res.WarnMsg = resSix10265.WarnMsg infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64) res.Infcode = infocode return res } func Post3505ForDrug(org_id int64, infos *models.NewDrugWarehouseOutInfo) ResultSix { var res ResultSix miConfig, _ := FindMedicalInsuranceInfo(org_id) data := make(map[string]interface{}) var struct3501s []models.Struct3505 var struct3501 models.Struct3505 struct3501.OrgName = miConfig.OrgName struct3501.AccessKey = miConfig.AccessKey struct3501.RequestUrl = miConfig.Url struct3501.SecretKey = miConfig.SecretKey struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber struct3501.FixmedinsHilistId = miConfig.Code struct3501.FixmedinsHilistName = miConfig.OrgName struct3501.FixmedinsBchno = infos.BatchNumber if org_id == 10188 { struct3501.PrscDrName = "王曙光" struct3501.PharName = "王曙光" struct3501.PharPracCertNo = "" } else if org_id == 10217 { struct3501.PrscDrName = "王云刚" struct3501.PharName = "王云刚" struct3501.PharPracCertNo = "" } timestamp := time.Now().Unix() tempTime := time.Unix(timestamp, 0) timeFormat := tempTime.Format("20060102150405") chrgBchno := rand.Intn(100000) + 10000 ipt_otp_no := timeFormat + strconv.FormatInt(int64(chrgBchno), 10) struct3501.MdtrtSn = ipt_otp_no struct3501.ManuLotnum = infos.BatchNumber struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05") struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05") struct3501.RxFlag = "0" struct3501.TrdnFlag = "1" struct3501.RtalDocno = strconv.FormatInt(int64(infos.ID), 10) struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10) struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05") struct3501.SelRetnOpterName = "仓管员" struct3501s = append(struct3501s, struct3501) data["struct_3501s"] = struct3501s client := &http.Client{} bytesData, _ := json.Marshal(data) var req *http.Request if miConfig.MdtrtareaAdmvs == "320921" { req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3505", bytes.NewReader(bytesData)) } else { req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3505", bytes.NewReader(bytesData)) } resp, _ := client.Do(req) defer resp.Body.Close() body, ioErr := ioutil.ReadAll(resp.Body) if ioErr != nil { utils.ErrorLog("接口返回数据读取失败: %v", ioErr) res.Infcode = -1 return res } var respJSON map[string]interface{} if err := json.Unmarshal([]byte(body), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) res.Infcode = -1 return res } var resSix10265 ResultSix10265 //1101结果 respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{}) result, _ := json.Marshal(respJSON) if err := json.Unmarshal([]byte(result), &resSix10265); err != nil { utils.ErrorLog("解析失败:%v", err) res.Infcode = -1 return res } res.InfRefmsgid = resSix10265.InfRefmsgid res.Output = resSix10265.Output res.ErrMsg = resSix10265.ErrMsg res.Cainfo = resSix10265.Cainfo res.WarnMsg = resSix10265.WarnMsg infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64) res.Infcode = infocode return res } //销售退货 func Post3506ForGoodInfo(org_id int64, infos *models.NewCancelStockInfo) ResultSix { var res ResultSix miConfig, _ := FindMedicalInsuranceInfo(org_id) data := make(map[string]interface{}) var struct3501s []models.Struct3506 var struct3501 models.Struct3506 struct3501.OrgName = miConfig.OrgName struct3501.AccessKey = miConfig.AccessKey struct3501.RequestUrl = miConfig.Url struct3501.SecretKey = miConfig.SecretKey struct3501.MedListCodg = infos.GoodInfo.MedicalInsuranceNumber struct3501.FixmedinsHilistId = miConfig.Code struct3501.FixmedinsHilistName = miConfig.OrgName struct3501.FixmedinsBchno = infos.Number struct3501.ManuLotnum = infos.Number struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05") //struct3501.ExpyEnd = time.Unix(infos.ExpiryDate, 0).Format("2006-01-02 15:04:05") struct3501.RxFlag = "0" struct3501.TrdnFlag = "1" struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10) struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05") struct3501.SelRetnOpterName = "仓管员" struct3501.Memo = "" struct3501s = append(struct3501s, struct3501) data["struct_3501s"] = struct3501s client := &http.Client{} bytesData, _ := json.Marshal(data) var req *http.Request if miConfig.MdtrtareaAdmvs == "320921" { req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData)) } else { req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData)) } resp, _ := client.Do(req) defer resp.Body.Close() body, ioErr := ioutil.ReadAll(resp.Body) if ioErr != nil { utils.ErrorLog("接口返回数据读取失败: %v", ioErr) res.Infcode = -1 return res } var respJSON map[string]interface{} if err := json.Unmarshal([]byte(body), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) res.Infcode = -1 return res } var resSix10265 ResultSix10265 //1101结果 respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{}) result, _ := json.Marshal(respJSON) if err := json.Unmarshal([]byte(result), &resSix10265); err != nil { utils.ErrorLog("解析失败:%v", err) res.Infcode = -1 return res } res.InfRefmsgid = resSix10265.InfRefmsgid res.Output = resSix10265.Output res.ErrMsg = resSix10265.ErrMsg res.Cainfo = resSix10265.Cainfo res.WarnMsg = resSix10265.WarnMsg infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64) res.Infcode = infocode return res } func Post3506ForDrug(org_id int64, infos *models.NewDrugCancelStockInfo) ResultSix { var res ResultSix miConfig, _ := FindMedicalInsuranceInfo(org_id) data := make(map[string]interface{}) var struct3501s []models.Struct3506 var struct3501 models.Struct3506 struct3501.OrgName = miConfig.OrgName struct3501.AccessKey = miConfig.AccessKey struct3501.RequestUrl = miConfig.Url struct3501.SecretKey = miConfig.SecretKey struct3501.MedListCodg = infos.BaseDrugLib.MedicalInsuranceNumber struct3501.FixmedinsHilistId = miConfig.Code struct3501.FixmedinsHilistName = miConfig.OrgName struct3501.FixmedinsBchno = infos.BatchNumber struct3501.ManuLotnum = infos.BatchNumber struct3501.ManuDate = time.Unix(infos.ProductDate, 0).Format("2006-01-02 15:04:05") struct3501.RxFlag = "0" struct3501.TrdnFlag = "1" struct3501.SelRetnCnt = strconv.FormatInt(int64(infos.Count), 10) struct3501.SelRetnTime = time.Unix(infos.Ctime, 0).Format("2006-01-02 15:04:05") struct3501.SelRetnOpterName = "仓管员" struct3501.Memo = "" struct3501s = append(struct3501s, struct3501) data["struct_3501s"] = struct3501s client := &http.Client{} bytesData, _ := json.Marshal(data) var req *http.Request if miConfig.MdtrtareaAdmvs == "320921" { req, _ = http.NewRequest("POST", "http://192.168.2.110:9532/"+"jsyb/3501", bytes.NewReader(bytesData)) } else { req, _ = http.NewRequest("POST", "http://192.168.5.251:9532/"+"jsyb/3501", bytes.NewReader(bytesData)) } resp, _ := client.Do(req) defer resp.Body.Close() body, ioErr := ioutil.ReadAll(resp.Body) if ioErr != nil { utils.ErrorLog("接口返回数据读取失败: %v", ioErr) res.Infcode = -1 return res } var respJSON map[string]interface{} if err := json.Unmarshal([]byte(body), &respJSON); err != nil { utils.ErrorLog("接口返回数据解析JSON失败: %v", err) res.Infcode = -1 return res } var resSix10265 ResultSix10265 //1101结果 respJSON = respJSON["data"].(map[string]interface{})["request_log"].(map[string]interface{}) result, _ := json.Marshal(respJSON) if err := json.Unmarshal([]byte(result), &resSix10265); err != nil { utils.ErrorLog("解析失败:%v", err) res.Infcode = -1 return res } res.InfRefmsgid = resSix10265.InfRefmsgid res.Output = resSix10265.Output res.ErrMsg = resSix10265.ErrMsg res.Cainfo = resSix10265.Cainfo res.WarnMsg = resSix10265.WarnMsg infocode, _ := strconv.ParseInt(resSix10265.Infcode, 10, 64) res.Infcode = infocode return res }