From 5f45d6f00f39fb459645b9af25d9c8ca96af15cf Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 9 Nov 2023 17:45:56 +0800 Subject: [PATCH 1/8] up[date --- app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go index ef7a8ab..eabb2ba 100644 --- a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go @@ -1464,7 +1464,7 @@ func SelfSupportForSchoolArrearsOrdListExport(c *gin.Context) { for _, v := range resp { totalAmount += utils.StrToFloat64(v.TotalPrice) mealZh := svc3.JudgeSelfSupportForMealTime(v.FaceTime) - xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.OutTradeNo, v.Phone, v.Name, v.EnterpriseName, v.Class, v.Grade, utils.StrToFloat64(v.TotalPrice), + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.OutTradeNo, v.Phone, v.Name, v.EnterpriseName, v.Grade, v.Class, utils.StrToFloat64(v.TotalPrice), v.ShopName, v.DeviceSn, v.FaceTime, v.DebtBusinessMsg, mealZh}) j++ } From 25b61dcca9b73e51318e2694964cdbbbf98a0f19 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 10 Nov 2023 15:42:23 +0800 Subject: [PATCH 2/8] update --- .../svc/enterprise_manage/svc_central_kitchen_for_school.go | 4 +++- .../svc/enterprise_manage/svc_self_support_for_school.go | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go index fb9bce4..6961729 100644 --- a/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_central_kitchen_for_school.go @@ -371,7 +371,9 @@ func CentralKitchenForSchoolStudentList(req md.CentralKitchenForSchoolStudentLis classWithUserIdentityIdsTwo = append(classWithUserIdentityIdsTwo, v.UserIdentityId) } } - sess := db.Db.Where("user_identity.enterprise_id =?", req.EnterpriseId).And("identity =?", enum2.UserIdentityForCentralKitchenForStudent) + sess := db.Db.Where("user_identity.enterprise_id =?", req.EnterpriseId). + And("identity =?", enum2.UserIdentityForCentralKitchenForStudent). + And("state =?", enum2.UserIdentityStateForNormal) if req.Name != "" { sess.And("user_identity.name like ?", "%"+req.Name+"%") } diff --git a/app/admin/svc/enterprise_manage/svc_self_support_for_school.go b/app/admin/svc/enterprise_manage/svc_self_support_for_school.go index 627cd1e..48c0a46 100644 --- a/app/admin/svc/enterprise_manage/svc_self_support_for_school.go +++ b/app/admin/svc/enterprise_manage/svc_self_support_for_school.go @@ -272,7 +272,9 @@ func SelfSupportForSchoolStudentList(req md.SelfSupportForSchoolStudentListReq) classWithUserIdentityIdsTwo = append(classWithUserIdentityIdsTwo, v.UserIdentityId) } } - sess := db.Db.Where("user_identity.enterprise_id =?", req.EnterpriseId).And("identity =?", enum2.UserIdentityForSelfSupportForStudent) + sess := db.Db.Where("user_identity.enterprise_id =?", req.EnterpriseId). + And("identity =?", enum2.UserIdentityForSelfSupportForStudent). + And("state =?", enum2.UserIdentityStateForNormal) if req.Name != "" { sess.And("user_identity.name like ?", "%"+req.Name+"%") } From 963b0d3febb4ab8d2030e43e8949c7527b1b5c84 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 13 Nov 2023 16:23:18 +0800 Subject: [PATCH 3/8] update --- .../hdl_self_support_for_school.go | 14 ++++++++++---- ...营学校(教师信息导入模板).xlsx | Bin 8862 -> 8809 bytes 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go index eabb2ba..520fc22 100644 --- a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go @@ -927,13 +927,19 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { xlsx, err := excelize.OpenFile(dst) rows := xlsx.GetRows("Sheet" + "1") for key, row := range rows { - if key > 0 && (row[0] != "" && row[1] != "") { + if key > 0 && ((row[0] != "" || row[1] != "") && row[2] != "") { idNo := row[0] - name := row[1] + certType := enum.UserIdentityCertTypeForIdCard + if idNo == "" { + idNo = row[1] + certType = enum.UserIdentityCertTypeForStudentId + } + name := row[2] + //1、查找当前身份是否已存在 userIdentityDb := db.UserIdentityDb{} userIdentityDb.Set(0) - isHasUserIdentity, err := userIdentityDb.UserIdentityExist(enterpriseId, idNo, enum.UserIdentityCertTypeForIdCard) + isHasUserIdentity, err := userIdentityDb.UserIdentityExist(enterpriseId, idNo, certType) if err != nil { e.OutErr(c, e.ERR_DB_ORM, err.Error()) return @@ -948,7 +954,7 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { Uid: 0, Name: name, IdNo: idNo, - CertType: enum.UserIdentityCertTypeForIdCard, + CertType: certType, Kind: enum.UserIdentityKindForCommon, Identity: enum.UserIdentityForSelfSupportForTeacher, EnterpriseId: enterpriseId, diff --git a/static/template/自营学校(教师信息导入模板).xlsx b/static/template/自营学校(教师信息导入模板).xlsx index a2ed8ad5aaeae2b4c05074c2bf07258e845af3ed..a7e740f6c59bb18ff57634de0d21c8a05d6177e4 100644 GIT binary patch delta 4571 zcmZ8l2T&7AweF*z1pU=kV6BH0a8Ju%)q+Gk9rE_o0=0%>W%{7Y80s#mY3hLSHHeJ?rEce?S}mp zqX>O1f3c#n0cmIypyhV2W9X%Wq|y*g)FqRS1}+{o4h{|xPL%eV>|E~pJenLAf*N)Tm!($z{h~E|2)?BfpPonH zORY{v3LX9&{VHZ3@cCiKgXWwez@80i5LSib?JMexyD{?^8pmJ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YiWR~ zSeN>zy2}$8;|es^M&E~M5F;ZR$7`gC%e}9vOp2EavkOV1qTTJfZlrKB zcqO>1YS(S}z4Pm7F&k)Jp+{L;UDIchT zj$ppSU-wore{a*jHTYKiR*a5$cY64C6 zw7zQCEQwx3lDG4Ml!f9up5nFTwR-T{z+k}c`o~Mh21Ur|=W#MT0=Q;GO6i6#sf{J_ z-5>M&-Kk3d_~x!K<3SQ|8oxXG&im?YYatcX8AF6&{?7ZO&~-dc+)Kpb-M23gkk+3Y z)K!{LwMgb9w<1WAJaRhHm|C zrTD$y<~Js}didXR4H5D2SjW!vP-ZDLQ1h3*ZOyWmJvj0ktm02?Tol^rmdfYZPJdlZ zFqDucS)Y{W|CSP@;^WLUhZ$os#~msqE|EVwO`QuJ;%~D5lErG^sTMgtC&s{bp@9nO z#+&oLY&aE;zQVnHP~7*nAMZ58kpixh1}hU2ZLy-qSsBnt?01NbzyJW+h?5aL!43xc zpm*5O|FcDj;&=f0$LtFM0RYgoYo)uE=br!qIIr_1dX7Vx%$)dN4g@^`Wkt(#QUP<( zI-Jr(JrHyygcY67NyGYYU9VgI*&+NB|4l&3j2`CXgZzI#^M3$!G$r%_kQ}WEl?IBT zL!sB$f8@TNX7Tz^|BLE>$q48Us5~$beF23+{_V1_XJh^kR2lj{mk?<<`#;710t7m_ A`~Uy| From 71075ee8df687b6b9eaf684fefd6fca9029acf53 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 16 Nov 2023 10:55:44 +0800 Subject: [PATCH 4/8] update --- .../hdl_self_support_for_school.go | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go index 520fc22..e4d7feb 100644 --- a/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go +++ b/app/admin/hdl/enterprise_manage/hdl_self_support_for_school.go @@ -916,6 +916,19 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { e.OutErr(c, e.ERR_NO_DATA, "未查询到对应记录") return } + + selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{} + selfSupportForSchoolInfoDb.Set(enterpriseId) + selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo() + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err.Error()) + return + } + if selfSupportForSchoolInfo == nil { + e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》") + return + } + files, _ := c.FormFile("file") dst := "./static/upload/" + files.Filename err = c.SaveUploadedFile(files, dst) @@ -982,17 +995,6 @@ func SelfSupportForSchoolImportTeacher(c *gin.Context) { return } if info == nil { - selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{} - selfSupportForSchoolInfoDb.Set(enterpriseId) - selfSupportForSchoolInfo, err1 := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo() - if err1 != nil { - e.OutErr(c, e.ERR_DB_ORM, err.Error()) - return - } - if selfSupportForSchoolInfo == nil { - e.OutErr(c, e.ERR, "当前学校暂未完成《一脸通行入驻》") - return - } info = &model.SelfSupportForUserFaceInfo{ EnterpriseId: enterpriseId, UserIdentityId: insertAffected, @@ -1058,7 +1060,7 @@ func ImportV2(c *gin.Context) { } func SelfSupportForSchoolDownloadTemplateExcel(c *gin.Context) { - e.OutSuc(c, "/template/自营学校(教师信息导入模板).xls", nil) + e.OutSuc(c, "/template/自营学校(教师信息导入模板).xlsx", nil) return } From 83d49bf873819aee99776fca94a64392e4a57f6c Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 16 Nov 2023 12:08:20 +0800 Subject: [PATCH 5/8] update --- app/admin/svc/svc_data_statisstics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 0380c81..9fc58f0 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -539,7 +539,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta //查询出所有的设备 var deviceList []*model.Device - if req.EnterpriseId != 0 { + if req.EnterpriseId == 0 { err := db.Db.Where("enterprise_id != 0").Find(&deviceList) if err != nil { logx.Error(err) @@ -576,7 +576,7 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta for _, v := range deviceList { deviceListMapping[v.DeviceSn] = *v var m []*db.SelfSupportForSchoolOrdWithUserIdentityV2 - sess := db.Db.Where("device_sn = ?", v.DeviceSn).Desc("self_support_for_school_ord.id") + sess := db.Db.Where("device_sn = ?", v.DeviceSn).And("enterprise_id =?", req.EnterpriseId).Desc("self_support_for_school_ord.id") if req.EnterpriseId != 0 { sess.And("self_support_for_school_ord.enterprise_id =?", req.EnterpriseId) } From f7474775484ba8030444ac020b5d7bee7a4e4b13 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 16 Nov 2023 15:29:04 +0800 Subject: [PATCH 6/8] update --- app/customer/svc/svc_curl_smart_pay.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/customer/svc/svc_curl_smart_pay.go b/app/customer/svc/svc_curl_smart_pay.go index 4a3ed60..81ee3fd 100644 --- a/app/customer/svc/svc_curl_smart_pay.go +++ b/app/customer/svc/svc_curl_smart_pay.go @@ -433,11 +433,11 @@ func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err Msg string `json:"msg"` Data interface{} `json:"data"` } - utils.FilePutContents("CurlEducateSceneTokenCreateForApplet", utils.SerializeStr(result)) err = json.Unmarshal(bytes, &result) if err != nil { return } + utils.FilePutContents("CurlEducateSceneTokenCreateForApplet", utils.SerializeStr(result)) if result.Code != 0 { if result.Msg != "" { err = errors.New(result.Msg) From 758dee9b173d2f09a7a6119ff65b532ab03ad754 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Thu, 16 Nov 2023 15:39:39 +0800 Subject: [PATCH 7/8] update --- app/customer/svc/svc_curl_smart_pay.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/customer/svc/svc_curl_smart_pay.go b/app/customer/svc/svc_curl_smart_pay.go index 81ee3fd..a7e885d 100644 --- a/app/customer/svc/svc_curl_smart_pay.go +++ b/app/customer/svc/svc_curl_smart_pay.go @@ -194,8 +194,8 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity * Msg string `json:"msg"` Data interface{} `json:"data"` } - utils.FilePutContents("CurlEducateSceneTokenCreate", utils.SerializeStr(result)) err1 = json.Unmarshal(bytes, &result) + utils.FilePutContents("CurlEducateSceneTokenCreate", utils.SerializeStr(result)) if err1 != nil { return } @@ -232,8 +232,8 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity * Msg string `json:"msg"` Data interface{} `json:"data"` } - utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(result1)) err = json.Unmarshal(bytes, &result1) + utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(result1)) if err != nil { return } From 03d2b71c773a6e47cbd84788b0a6c01c58c4a7dd Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Fri, 17 Nov 2023 20:52:30 +0800 Subject: [PATCH 8/8] update --- app/admin/hdl/hdl_device.go | 21 ++++ app/customer/hdl/hdl_demo.go | 26 +++++ app/customer/svc/svc_curl_smart_pay.go | 153 +++++++++++++++++++++++++ 3 files changed, 200 insertions(+) diff --git a/app/admin/hdl/hdl_device.go b/app/admin/hdl/hdl_device.go index 3ce122b..31eeeb8 100644 --- a/app/admin/hdl/hdl_device.go +++ b/app/admin/hdl/hdl_device.go @@ -1,8 +1,10 @@ package hdl import ( + enum2 "applet/app/admin/enum" "applet/app/admin/lib/validate" "applet/app/admin/md" + svc3 "applet/app/admin/svc" "applet/app/db" model2 "applet/app/db/model" "applet/app/e" @@ -27,6 +29,25 @@ func DeviceList(c *gin.Context) { } sess := db.Db.Desc("device.id") + admin := svc3.GetUser(c) + if admin.IsSuperAdministrator != enum2.IsSuperAdministratorTure { + adminWithEnterpriseDb := db.AdminWithEnterpriseDb{} + adminWithEnterpriseDb.Set() + adminWithEnterprise, err1 := adminWithEnterpriseDb.FindAdminWithEnterprise(admin.AdmId) + if err1 != nil { + e.OutErr(c, e.ERR_DB_ORM, err1.Error()) + return + } + var enterPriseIds []int + for _, v1 := range *adminWithEnterprise { + enterPriseIds = append(enterPriseIds, v1.EnterpriseId) + } + if len(enterPriseIds) == 0 { + return + } + sess.In("device.enterprise_id", enterPriseIds) + } + if req.Name != "" { sess.And("device.name like ?", "%"+req.Name+"%") } diff --git a/app/customer/hdl/hdl_demo.go b/app/customer/hdl/hdl_demo.go index 178e582..8521cec 100644 --- a/app/customer/hdl/hdl_demo.go +++ b/app/customer/hdl/hdl_demo.go @@ -6,6 +6,7 @@ import ( "applet/app/customer/md" "applet/app/customer/svc" "applet/app/db" + "applet/app/db/model" "applet/app/e" "applet/app/enum" svc3 "applet/app/svc" @@ -104,6 +105,31 @@ func WxPay(c *gin.Context) { } func Demo(c *gin.Context) { + sysCfgDb := db.SysCfgDb{} + sysCfgDb.Set() + sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey) + err, info := svc.CurlEducateSceneTokenQueryV2(md.CurlEducateSceneTokenReq{ + Config: struct { + AliAppId string `json:"ali_app_id" label:"支付宝开放平台-小程序-appid"` + AliPrivateKey string `json:"ali_private_key" label:"支付宝开放平台-小程序-应用私钥"` + AliPublicKey string `json:"ali_public_key" label:"支付宝开放平台-小程序-支付宝公钥"` + }{ + AliAppId: sysCfg[enum.OpenAppletAppid], + AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey], + AliPublicKey: sysCfg[enum.OpenAppletPublicKey], + }, + CertType: "A", + CertNo: "440881201010205523", + StudentName: "龙佩滢", + OutUserId: "1001", + SchoolStdCode: "12440403MB2D752515", + }, &model.UserIdentity{}, "", "") + if err != nil { + e.OutErr(c, e.ERR, err.Error()) + return + } + e.OutSuc(c, info, nil) + return ordNo := c.DefaultQuery("ord_no", "") svc2.JudgePackageOrdOrdState(ordNo) e.OutSuc(c, nil, nil) diff --git a/app/customer/svc/svc_curl_smart_pay.go b/app/customer/svc/svc_curl_smart_pay.go index a7e885d..56aa0f0 100644 --- a/app/customer/svc/svc_curl_smart_pay.go +++ b/app/customer/svc/svc_curl_smart_pay.go @@ -315,6 +315,159 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentity * } +func CurlEducateSceneTokenQueryV2(args md.CurlEducateSceneTokenReq, userIdentity *model.UserIdentity, userToken, schoolName string) (err error, resp interface{}) { + utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(map[string]interface{}{ + "args": args, + })) + + if userToken == "" { + //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token) + url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate" + bytes, err1 := utils.CurlPost(url, utils.Serialize(map[string]interface{}{ + "config": map[string]string{ + "ali_app_id": args.Config.AliAppId, + "ali_private_key": args.Config.AliPrivateKey, + "ali_public_key": args.Config.AliPublicKey, + }, + "cert_no": args.CertNo, + "school_std_code": args.SchoolStdCode, + "student_name": args.StudentName, + "out_user_id": args.OutUserId, + "cert_type": args.CertType, + "sub_code": "SCHOOL_FACE_PASS_QUERY", + }), nil) + if err1 != nil { + return + } + var result struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data"` + } + err1 = json.Unmarshal(bytes, &result) + utils.FilePutContents("CurlEducateSceneTokenCreate", utils.SerializeStr(result)) + if err1 != nil { + return + } + if result.Code != 0 { + if result.Msg != "" { + err1 = errors.New(result.Msg) + return + } + err1 = errors.New("请求智慧餐厅支付 异常/失败") + return + } + resultMap, ok := result.Data.(map[string]interface{}) + if !ok { + err1 = errors.New("获取 user_token 失败") + return + } + if resultMap["code"].(string) != "10000" { + return nil, resultMap + } + userToken = resultMap["token"].(string) + } + + //2、TODO::查询用户一脸通行开通状态:根据获取到的用户信息token,使用 alipay.commerce.educate.scene.token.query 接口查询用户人脸采集状态 + url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenQuery" + bytes, err := utils.CurlPost(url, utils.Serialize(map[string]string{ + "user_token": userToken, + }), nil) + if err != nil { + return + } + + var result1 struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data"` + } + err = json.Unmarshal(bytes, &result1) + utils.FilePutContents("CurlEducateSceneTokenQuery", utils.SerializeStr(result1)) + if err != nil { + return + } + if result1.Code != 0 { + if result1.Msg != "" { + err = errors.New(result1.Msg) + return + } + err = errors.New("请求智慧餐厅支付 异常/失败") + return + } + + return nil, result1.Data + + // 更新/新增 `self_support_for_user_facel_info` + selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} + selfSupportForUserFaceInfoDb.Set(userIdentity.Id) + info, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo() + if err != nil { + return + } + + now := time.Now().Format("2006-01-02 15:04:05") + var res map[string]string + utils.Unserialize([]byte(utils.SerializeStr(result1.Data)), &res) + + if info == nil { + var concentrateSchoolFacePassStatus = 1 + if res["school_face_pass_status"] == "OPEN" { + concentrateSchoolFacePassStatus = 3 + } + info = &model.SelfSupportForUserFaceInfo{ + EnterpriseId: userIdentity.EnterpriseId, + UserIdentityId: userIdentity.Id, + CollectFaceType: 1, + SchoolCode: res["school_code"], + SchoolStdCode: res["school_std_code"], + ParentUserId: res["parent_user_id"], + ParentLogonId: res["parent_logon_id"], + UserId: res["user_id"], + SchoolFacePassStatus: res["school_face_pass_status"], + SchoolFacePaymentStatus: res["school_face_payment_status"], + ConcentrateSchoolFacePassStatus: concentrateSchoolFacePassStatus, + CreateAt: now, + UpdateAt: now, + } + _, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoInsert(info) + if err2 != nil { + return err2, nil + } + } else { + var concentrateSchoolFacePassStatus = info.ConcentrateSchoolFacePassStatus + if res["school_face_pass_status"] == "OPEN" { + concentrateSchoolFacePassStatus = 3 + } + info.ParentUserId = res["parent_user_id"] + info.ParentLogonId = res["parent_logon_id"] + info.UserId = res["user_id"] + info.SchoolFacePassStatus = res["school_face_pass_status"] + info.SchoolFacePaymentStatus = res["school_face_payment_status"] + info.ConcentrateSchoolFacePassStatus = concentrateSchoolFacePassStatus + info.UpdateAt = now + _, err2 := selfSupportForUserFaceInfoDb.SelfSupportForUserFaceInfoUpdate(info, "parent_user_id", "parent_logon_id", "user_id", "school_face_pass_status", "school_face_payment_status", "concentrate_school_face_pass_status", "update_at") + if err2 != nil { + return err2, nil + } + } + + //TODO:: school_face_pass_status && school_face_payment_status 都为 open 状态,则 签约信息同步“alipay.planet.ecocampus.api.roster.signUpInfo” 至 行业云 + CurlAlipayPlanetEcocampusApiRosterSignUpInfo(md.CurlAlipayPlanetEcocampusApiRosterSignUpInfoReq{ + FaceUid: info.UserId, + ParentUid: info.ParentUserId, + ParentLogonId: info.ParentLogonId, + RosterName: args.StudentName, + OutRosterCode: args.OutUserId, + SchoolCode: info.SchoolCode, + SchoolName: schoolName, + ScanFacePayStatus: "ON", + FaceOpenStatus: "ON", + }) + return nil, result1.Data + +} + func CurlEducateSceneKidsClose(args md.CurlEducateSceneKidsCloseReq) (err error, resp interface{}) { utils.FilePutContents("CurlEducateSceneKidsClose", utils.SerializeStr(map[string]interface{}{ "args": args,