|
@@ -38,7 +38,7 @@ func NmybRegistRouters() {
|
38
|
38
|
|
39
|
39
|
beego.Router("/nmyb/5203", &NmController{}, "get:Post5203")
|
40
|
40
|
|
41
|
|
- beego.Router("/nmyb/readcard", &NmController{}, "get:ReadCard")
|
|
41
|
+ //beego.Router("/nmyb/readcard", &NmController{}, "get:ReadCard")
|
42
|
42
|
|
43
|
43
|
beego.Router("/nmyb/3201", &NmController{}, "get:Get3201")
|
44
|
44
|
beego.Router("/nmyb/2202", &NmController{}, "get:Post2202")
|
|
@@ -540,139 +540,139 @@ func (c *NmController) Get2503() {
|
540
|
540
|
|
541
|
541
|
}
|
542
|
542
|
|
543
|
|
-func (c *NmController) ReadCard() {
|
544
|
|
- fixmedins_code := c.GetString("fixmedins_code")
|
545
|
|
- secret_key := c.GetString("secret_key")
|
546
|
|
- org_name := c.GetString("org_name")
|
547
|
|
- insuplc_admdvs := c.GetString("insuplc_admdvs")
|
548
|
|
- mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
|
549
|
|
- id_card_type := c.GetString("id_card_type")
|
550
|
|
- operator_id := c.GetString("operator_id")
|
551
|
|
- operator := c.GetString("operator")
|
552
|
|
-
|
553
|
|
- if initFlag == 0 {
|
554
|
|
- c.TestGetBasBaseInit()
|
555
|
|
- }
|
556
|
|
- switch id_card_type {
|
557
|
|
- case "1":
|
558
|
|
- pBusiCardInfo := c.GetBasBaseInfo(fixmedins_code, mdtrtarea_admvs, operator, operator_id, org_name)
|
559
|
|
- basStr := Remove0000(pBusiCardInfo)
|
560
|
|
-
|
561
|
|
- if len(basStr) == 0 {
|
562
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
563
|
|
- return
|
564
|
|
- }
|
565
|
|
-
|
566
|
|
- var dat2 map[string]interface{}
|
567
|
|
- if err := json.Unmarshal([]byte(basStr), &dat2); err == nil {
|
568
|
|
- fmt.Println(dat2)
|
569
|
|
- } else {
|
570
|
|
- fmt.Println(err)
|
571
|
|
- }
|
572
|
|
-
|
573
|
|
- userJSONBytes, _ := json.Marshal(dat2)
|
574
|
|
- var res ReadCardResult
|
575
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
576
|
|
- utils.ErrorLog("解析失败:%v", err)
|
577
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
578
|
|
- return
|
579
|
|
- }
|
580
|
|
-
|
581
|
|
- fmt.Println(basStr)
|
582
|
|
- bas := strings.Split(res.Output.CardInfo, "|")
|
583
|
|
- basNumber := bas[1]
|
584
|
|
- fmt.Println(basNumber)
|
585
|
|
- card_sn := bas[3]
|
586
|
|
- fmt.Println(card_sn)
|
587
|
|
- cardNumber := bas[2]
|
588
|
|
- name := bas[4]
|
589
|
|
-
|
590
|
|
- result := service.Gdyb1101G(basNumber, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, card_sn, 1, name, cardNumber)
|
591
|
|
- var dat map[string]interface{}
|
592
|
|
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
593
|
|
- fmt.Println(dat)
|
594
|
|
- } else {
|
595
|
|
- fmt.Println(err)
|
596
|
|
- }
|
597
|
|
-
|
598
|
|
- userJSONBytes2, _ := json.Marshal(dat)
|
599
|
|
- var res2 ResultTwo
|
600
|
|
- if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
|
601
|
|
- utils.ErrorLog("解析失败:%v", err)
|
602
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
603
|
|
- return
|
604
|
|
- }
|
605
|
|
- infocode, _ := strconv.ParseInt(res2.Infcode, 10, 64)
|
606
|
|
-
|
607
|
|
- if infocode == 0 {
|
608
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
609
|
|
- "status": "0",
|
610
|
|
- "card_info": res.Output.CardInfo,
|
611
|
|
- "busi_card_info": pBusiCardInfo,
|
612
|
|
- "result": res2,
|
613
|
|
- "type": "1",
|
614
|
|
- })
|
615
|
|
-
|
616
|
|
- } else {
|
617
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
618
|
|
- "status": "-1",
|
619
|
|
- })
|
620
|
|
- }
|
621
|
|
-
|
622
|
|
- break
|
623
|
|
- case "4": //电子凭证
|
624
|
|
- _, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
|
625
|
|
-
|
626
|
|
- var ele ELeData
|
627
|
|
- err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
|
628
|
|
- if err != nil {
|
629
|
|
- utils.ErrorLog("解析失败:%v", err)
|
630
|
|
- }
|
631
|
|
- token := ele.Data.EcToken
|
632
|
|
- fmt.Println(token)
|
633
|
|
- if len(token) > 0 {
|
634
|
|
- result := service.Gdyb1101ForEleCert("", org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, "")
|
635
|
|
- var dat map[string]interface{}
|
636
|
|
- if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
637
|
|
- fmt.Println(dat)
|
638
|
|
- } else {
|
639
|
|
- fmt.Println(err)
|
640
|
|
- }
|
641
|
|
- userJSONBytes, _ := json.Marshal(dat)
|
642
|
|
- var res ResultTwo
|
643
|
|
- if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
644
|
|
- utils.ErrorLog("解析失败:%v", err)
|
645
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
646
|
|
- return
|
647
|
|
- }
|
648
|
|
-
|
649
|
|
- infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
|
650
|
|
-
|
651
|
|
- if infocode == 0 {
|
652
|
|
-
|
653
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
654
|
|
- "status": "0",
|
655
|
|
- "card_info": pBusiCardInfo,
|
656
|
|
- "busi_card_info": pBusiCardInfo,
|
657
|
|
- "token": token,
|
658
|
|
- "result": dat,
|
659
|
|
- })
|
660
|
|
-
|
661
|
|
- } else {
|
662
|
|
- c.ServeSuccessJSON(map[string]interface{}{
|
663
|
|
- "status": "-1",
|
664
|
|
- })
|
665
|
|
-
|
666
|
|
- }
|
667
|
|
- } else {
|
668
|
|
- c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
669
|
|
- return
|
670
|
|
- }
|
671
|
|
- break
|
672
|
|
-
|
673
|
|
- }
|
674
|
|
-
|
675
|
|
-}
|
|
543
|
+//func (c *NmController) ReadCard() {
|
|
544
|
+// fixmedins_code := c.GetString("fixmedins_code")
|
|
545
|
+// secret_key := c.GetString("secret_key")
|
|
546
|
+// org_name := c.GetString("org_name")
|
|
547
|
+// insuplc_admdvs := c.GetString("insuplc_admdvs")
|
|
548
|
+// mdtrtarea_admvs := c.GetString("mdtrtarea_admvs")
|
|
549
|
+// id_card_type := c.GetString("id_card_type")
|
|
550
|
+// operator_id := c.GetString("operator_id")
|
|
551
|
+// operator := c.GetString("operator")
|
|
552
|
+//
|
|
553
|
+// if initFlag == 0 {
|
|
554
|
+// c.TestGetBasBaseInit()
|
|
555
|
+// }
|
|
556
|
+// switch id_card_type {
|
|
557
|
+// case "1":
|
|
558
|
+// pBusiCardInfo := c.GetBasBaseInfo(fixmedins_code, mdtrtarea_admvs, operator, operator_id, org_name)
|
|
559
|
+// basStr := Remove0000(pBusiCardInfo)
|
|
560
|
+//
|
|
561
|
+// if len(basStr) == 0 {
|
|
562
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeReadCardException)
|
|
563
|
+// return
|
|
564
|
+// }
|
|
565
|
+//
|
|
566
|
+// var dat2 map[string]interface{}
|
|
567
|
+// if err := json.Unmarshal([]byte(basStr), &dat2); err == nil {
|
|
568
|
+// fmt.Println(dat2)
|
|
569
|
+// } else {
|
|
570
|
+// fmt.Println(err)
|
|
571
|
+// }
|
|
572
|
+//
|
|
573
|
+// userJSONBytes, _ := json.Marshal(dat2)
|
|
574
|
+// var res ReadCardResult
|
|
575
|
+// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
576
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
577
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
578
|
+// return
|
|
579
|
+// }
|
|
580
|
+//
|
|
581
|
+// fmt.Println(basStr)
|
|
582
|
+// bas := strings.Split(res.Output.CardInfo, "|")
|
|
583
|
+// basNumber := bas[1]
|
|
584
|
+// fmt.Println(basNumber)
|
|
585
|
+// card_sn := bas[3]
|
|
586
|
+// fmt.Println(card_sn)
|
|
587
|
+// cardNumber := bas[2]
|
|
588
|
+// name := bas[4]
|
|
589
|
+//
|
|
590
|
+// result := service.Gdyb1101G(basNumber, org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, 1, card_sn, 1, name, cardNumber)
|
|
591
|
+// var dat map[string]interface{}
|
|
592
|
+// if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
593
|
+// fmt.Println(dat)
|
|
594
|
+// } else {
|
|
595
|
+// fmt.Println(err)
|
|
596
|
+// }
|
|
597
|
+//
|
|
598
|
+// userJSONBytes2, _ := json.Marshal(dat)
|
|
599
|
+// var res2 ResultTwo
|
|
600
|
+// if err := json.Unmarshal(userJSONBytes2, &res2); err != nil {
|
|
601
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
602
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
603
|
+// return
|
|
604
|
+// }
|
|
605
|
+// infocode, _ := strconv.ParseInt(res2.Infcode, 10, 64)
|
|
606
|
+//
|
|
607
|
+// if infocode == 0 {
|
|
608
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
609
|
+// "status": "0",
|
|
610
|
+// "card_info": res.Output.CardInfo,
|
|
611
|
+// "busi_card_info": pBusiCardInfo,
|
|
612
|
+// "result": res2,
|
|
613
|
+// "type": "1",
|
|
614
|
+// })
|
|
615
|
+//
|
|
616
|
+// } else {
|
|
617
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
618
|
+// "status": "-1",
|
|
619
|
+// })
|
|
620
|
+// }
|
|
621
|
+//
|
|
622
|
+// break
|
|
623
|
+// case "4": //电子凭证
|
|
624
|
+// _, pBusiCardInfo := c.GetELeInfo(fixmedins_code, operator_id, operator)
|
|
625
|
+//
|
|
626
|
+// var ele ELeData
|
|
627
|
+// err := json.Unmarshal([]byte(pBusiCardInfo), &ele)
|
|
628
|
+// if err != nil {
|
|
629
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
630
|
+// }
|
|
631
|
+// token := ele.Data.EcToken
|
|
632
|
+// fmt.Println(token)
|
|
633
|
+// if len(token) > 0 {
|
|
634
|
+// result := service.Gdyb1101ForEleCert("", org_name, operator, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, secret_key, token, "")
|
|
635
|
+// var dat map[string]interface{}
|
|
636
|
+// if err := json.Unmarshal([]byte(result), &dat); err == nil {
|
|
637
|
+// fmt.Println(dat)
|
|
638
|
+// } else {
|
|
639
|
+// fmt.Println(err)
|
|
640
|
+// }
|
|
641
|
+// userJSONBytes, _ := json.Marshal(dat)
|
|
642
|
+// var res ResultTwo
|
|
643
|
+// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
|
|
644
|
+// utils.ErrorLog("解析失败:%v", err)
|
|
645
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
|
|
646
|
+// return
|
|
647
|
+// }
|
|
648
|
+//
|
|
649
|
+// infocode, _ := strconv.ParseInt(res.Infcode, 10, 64)
|
|
650
|
+//
|
|
651
|
+// if infocode == 0 {
|
|
652
|
+//
|
|
653
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
654
|
+// "status": "0",
|
|
655
|
+// "card_info": pBusiCardInfo,
|
|
656
|
+// "busi_card_info": pBusiCardInfo,
|
|
657
|
+// "token": token,
|
|
658
|
+// "result": dat,
|
|
659
|
+// })
|
|
660
|
+//
|
|
661
|
+// } else {
|
|
662
|
+// c.ServeSuccessJSON(map[string]interface{}{
|
|
663
|
+// "status": "-1",
|
|
664
|
+// })
|
|
665
|
+//
|
|
666
|
+// }
|
|
667
|
+// } else {
|
|
668
|
+// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeHisFailedException)
|
|
669
|
+// return
|
|
670
|
+// }
|
|
671
|
+// break
|
|
672
|
+//
|
|
673
|
+// }
|
|
674
|
+//
|
|
675
|
+//}
|
676
|
676
|
|
677
|
677
|
var initFlag int64 = 0
|
678
|
678
|
|