dengbiao 7 месяцев назад
Родитель
Сommit
b7e9e5da67
3 измененных файлов: 108 добавлений и 0 удалений
  1. +61
    -0
      app/customer/hdl/self_support_for_school/hdl_faceCollection.go
  2. +46
    -0
      app/customer/svc/svc_curl_smart_pay.go
  3. +1
    -0
      app/router/customer_router.go

+ 61
- 0
app/customer/hdl/self_support_for_school/hdl_faceCollection.go Просмотреть файл

@@ -127,6 +127,67 @@ func EducateSceneTokenCreateForApplet(c *gin.Context) {
return
}

func EducateSceneTokenCreateForSchoolFacePassQuery(c *gin.Context) {
user := svc.GetUser(c)
userIdentityId := c.DefaultQuery("user_identity_id", "")
userIdentityDb := db.UserIdentityDb{}
userIdentityDb.Set(0)
identity, err := userIdentityDb.GetUserIdentity(utils.StrToInt(userIdentityId))
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}

selfSupportForSchoolInfoDb := db.SelfSupportForSchoolInfoDb{}
selfSupportForSchoolInfoDb.Set(identity.EnterpriseId)
selfSupportForSchoolInfo, err := selfSupportForSchoolInfoDb.GetSelfSupportForSchoolInfo()
if err != nil {
e.OutErr(c, e.ERR_DB_ORM, err.Error())
return
}
if selfSupportForSchoolInfo == nil {
e.OutErr(c, e.ERR_NO_DATA, "当前学校暂未完成《一脸通行入驻》")
return
}

//请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息)
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
var certType string
switch identity.CertType {
case enum.UserIdentityCertTypeForIdCard:
certType = "1"
case enum.UserIdentityCertTypeForStudentId:
certType = "X"
case enum.UserIdentityCertTypeForPassport:
certType = "A"
}
err, info := svc.CurlEducateSceneTokenCreateForSchoolFacePassQuery(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: certType,
CertNo: identity.IdNo,
StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id),
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
OperatorUserId: user.UserId,
})
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
e.OutSuc(c, info, nil)
return
}

func EducateFacepayApply(c *gin.Context) {
faceOpenId := c.DefaultQuery("face_open_id", "")
userIdentityId := c.DefaultQuery("user_identity_id", "")


+ 46
- 0
app/customer/svc/svc_curl_smart_pay.go Просмотреть файл

@@ -663,6 +663,52 @@ func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err
return nil, result.Data
}

func CurlEducateSceneTokenCreateForSchoolFacePassQuery(args md.CurlEducateSceneTokenReq) (err error, resp interface{}) {
utils.FilePutContents("CurlEducateSceneTokenCreateForSchoolFacePassQuery", utils.SerializeStr(map[string]interface{}{
"args": args,
}))

//1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
bytes, err := 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",
"operator_user_id": args.OperatorUserId, //采集人员的支付宝会员标识。(当sub_code为SCHOOL_PAYMENT_REMOTE_OPEN_ACCOUNT时,当前参数必选)
}), nil)
if err != nil {
return
}
var result struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
utils.FilePutContents("CurlEducateSceneTokenCreateForSchoolFacePassQuery", utils.SerializeStr(result))
err = json.Unmarshal(bytes, &result)
if err != nil {
return
}
if result.Code != 0 {
if result.Msg != "" {
err = errors.New(result.Msg)
return
}
err = errors.New("请求智慧餐厅支付 异常/失败")
return
}

return nil, result.Data
}

func CurlEducateSceneTokenCreateForConcentratedCollectApplet(args md.CurlEducateSceneTokenReq) (err error, resp interface{}) {
utils.FilePutContents("CurlEducateSceneTokenCreateForConcentratedCollectApplet", utils.SerializeStr(map[string]interface{}{
"args": args,


+ 1
- 0
app/router/customer_router.go Просмотреть файл

@@ -116,6 +116,7 @@ func rSelfSupportForSchool(r *gin.RouterGroup) { //自营学校
r.GET("/educateSceneTokenQuery", selfSupportForSchoolhdl.EducateSceneTokenQuery) // 自营学校-查询刷脸用户开通详细信息
r.GET("/educateSceneTokenCreateForApplet", selfSupportForSchoolhdl.EducateSceneTokenCreateForApplet) // 自营学校-教育场景token生成处理器(作用于 跳转到一脸通行小程序采集人脸)
r.GET("/educateSceneTokenCreateForConcentratedCollectApplet", selfSupportForSchoolhdl.EducateSceneTokenCreateForConcentratedCollectApplet) // 自营学校-教育场景token生成处理器(作用于 跳转到集采小程序)
r.GET("/educateSceneTokenCreateForSchoolFacePassQuery", selfSupportForSchoolhdl.EducateSceneTokenCreateForSchoolFacePassQuery) // 自营学校-教育场景token生成处理器(作用于 查看刷脸照片)
r.GET("/educateFacepayApply", selfSupportForSchoolhdl.EducateFacepayApply) // 自营学校-创建刷脸支付开通标识
r.GET("/concentrateFacePassStudentList", selfSupportForSchoolhdl.ConcentrateFacePassStudentList) // 自营学校-集采学生列表
r.GET("/concentrateFacePassStudentConfirm", selfSupportForSchoolhdl.ConcentrateFacePassStudentConfirm) // 自营学校-集采学生确认


Загрузка…
Отмена
Сохранить