Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
45a6fd0540
13 changed files with 165 additions and 32 deletions
  1. +11
    -5
      app/admin/svc/order/svc_central_kitchen_for_school_order.go
  2. +1
    -0
      app/cfg/cfg_app.go
  3. +1
    -1
      app/cfg/init_cache.go
  4. +2
    -0
      app/cfg/init_cfg.go
  5. +1
    -0
      app/cfg/init_task.go
  6. +19
    -0
      app/customer/hdl/hdl_alipay.go
  7. +11
    -7
      app/customer/hdl/hdl_pay.go
  8. +51
    -0
      app/customer/hdl/self_support_for_school/hdl_faceCollection.go
  9. +27
    -1
      app/customer/md/md_curl_smart_pay.go
  10. +24
    -4
      app/customer/svc/svc_curl_smart_pay.go
  11. +13
    -11
      app/enum/enum_sys_cfg.go
  12. +1
    -0
      app/router/customer_router.go
  13. +3
    -3
      app/utils/cache/redis.go

+ 11
- 5
app/admin/svc/order/svc_central_kitchen_for_school_order.go View File

@@ -118,10 +118,7 @@ func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderR
func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrderRefundAuditReq) (err error) { func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrderRefundAuditReq) (err error) {
sysCfgDb := db.SysCfgDb{} sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set() sysCfgDb.Set()
sysCfg, err := sysCfgDb.SysCfgGetOne(enum.JsapiPayAppAutToken)
if err != nil {
return
}
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)


session := db.Db.NewSession() session := db.Db.NewSession()
defer session.Close() defer session.Close()
@@ -193,11 +190,20 @@ func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrder
//3、调用支付宝进行退款 //3、调用支付宝进行退款
if req.State == 1 { if req.State == 1 {
err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{ err6, _ := svc2.CurlAlipayTradeRefund(md2.CurlAlipayTradeRefundReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" binding:"required" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: returnDay.OutTradeNo, OutTradeNo: returnDay.OutTradeNo,
RefundAmount: returnDay.Amount, RefundAmount: returnDay.Amount,
RefundReason: "央厨订餐退款", RefundReason: "央厨订餐退款",
OutRequestNo: returnDay.OutRequestNo, OutRequestNo: returnDay.OutRequestNo,
AppAuthToken: sysCfg.Val,
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
}) })
if err6 != nil { if err6 != nil {
_ = session.Rollback() _ = session.Rollback()


+ 1
- 0
app/cfg/cfg_app.go View File

@@ -9,6 +9,7 @@ type Config struct {
Prd bool `yaml:"prd"` Prd bool `yaml:"prd"`
SrvAddr string `yaml:"srv_addr"` SrvAddr string `yaml:"srv_addr"`
RedisAddr string `yaml:"redis_addr"` RedisAddr string `yaml:"redis_addr"`
RedisPassword string `yaml:"redis_password"`
SmartCanteenPay string `yaml:"smart_canteen_pay"` SmartCanteenPay string `yaml:"smart_canteen_pay"`
DB DBCfg `yaml:"db"` DB DBCfg `yaml:"db"`
Log LogCfg `yaml:"log"` Log LogCfg `yaml:"log"`


+ 1
- 1
app/cfg/init_cache.go View File

@@ -5,5 +5,5 @@ import (
) )


func InitCache() { func InitCache() {
cache.NewRedis(RedisAddr)
cache.NewRedis(RedisAddr, RedisPassword)
} }

+ 2
- 0
app/cfg/init_cfg.go View File

@@ -14,6 +14,7 @@ var (
SrvAddr string SrvAddr string
SmartCanteenPay string SmartCanteenPay string
RedisAddr string RedisAddr string
RedisPassword string
DB *DBCfg DB *DBCfg
Log *LogCfg Log *LogCfg
) )
@@ -43,6 +44,7 @@ func InitCfg() {
DB = &conf.DB DB = &conf.DB
Log = &conf.Log Log = &conf.Log
RedisAddr = conf.RedisAddr RedisAddr = conf.RedisAddr
RedisPassword = conf.RedisPassword
SmartCanteenPay = conf.SmartCanteenPay SmartCanteenPay = conf.SmartCanteenPay
SrvAddr = conf.SrvAddr SrvAddr = conf.SrvAddr
} }

+ 1
- 0
app/cfg/init_task.go View File

@@ -29,6 +29,7 @@ func InitTaskCfg() {
DB = &conf.DB DB = &conf.DB
Log = &conf.Log Log = &conf.Log
RedisAddr = conf.RedisAddr RedisAddr = conf.RedisAddr
RedisPassword = conf.RedisPassword
} }


var MemCache mc.Cache var MemCache mc.Cache


+ 19
- 0
app/customer/hdl/hdl_alipay.go View File

@@ -4,7 +4,9 @@ import (
"applet/app/customer/lib/validate" "applet/app/customer/lib/validate"
"applet/app/customer/md" "applet/app/customer/md"
"applet/app/customer/svc" "applet/app/customer/svc"
"applet/app/db"
"applet/app/e" "applet/app/e"
"applet/app/enum"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )


@@ -17,6 +19,11 @@ func AesDecrypt(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error()) e.OutErr(c, err1.Code, err1.Error())
return return
} }
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAesKey)
req.AesKey = sysCfg[enum.OpenAppletAesKey]

err, result := svc.AesDecrypt(req) err, result := svc.AesDecrypt(req)
if err != nil { if err != nil {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())
@@ -35,6 +42,18 @@ func SystemOauthToken(c *gin.Context) {
e.OutErr(c, err1.Code, err1.Error()) e.OutErr(c, err1.Code, err1.Error())
return return
} }
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
req.Config = struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
}{
AliAppId: sysCfg[enum.OpenAppletAppid],
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
}
err, result := svc.SystemOauthToken(req) err, result := svc.SystemOauthToken(req)
if err != nil { if err != nil {
e.OutErr(c, e.ERR, err.Error()) e.OutErr(c, e.ERR, err.Error())


+ 11
- 7
app/customer/hdl/hdl_pay.go View File

@@ -51,15 +51,19 @@ func OrdState(c *gin.Context) {
//处于待支付状态,请求支付宝同步订单状态 //处于待支付状态,请求支付宝同步订单状态
sysCfgDb := db.SysCfgDb{} sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set() sysCfgDb.Set()
sysCfg, err1 := sysCfgDb.SysCfgGetOne(enum.JsapiPayAppAutToken)
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}

sysCfg := sysCfgDb.SysCfgFindWithDb(enum.JsapiPayAppAutToken, enum.OpenAlipayAppid, enum.OpenAlipayAppPrivateKey, enum.OpenAlipayPublicKey)
err2, result := svc.CurlAlipayTradeQuery(md.CurlAlipayTradeQueryReq{ err2, result := svc.CurlAlipayTradeQuery(md.CurlAlipayTradeQueryReq{
Config: struct {
PayAliAppId string `json:"pay_ali_app_id" binding:"required" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
}{
PayAliAppId: sysCfg[enum.OpenAlipayAppid],
PayAliPrivateKey: sysCfg[enum.OpenAlipayAppPrivateKey],
PayAliPublicKey: sysCfg[enum.OpenAlipayPublicKey],
},
OutTradeNo: outTradeNo, OutTradeNo: outTradeNo,
AppAuthToken: sysCfg.Val,
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken],
}) })
if err2 != nil { if err2 != nil {
e.OutErr(c, e.ERR, err2.Error()) e.OutErr(c, e.ERR, err2.Error())


+ 51
- 0
app/customer/hdl/self_support_for_school/hdl_faceCollection.go View File

@@ -5,6 +5,7 @@ import (
"applet/app/customer/svc" "applet/app/customer/svc"
"applet/app/db" "applet/app/db"
"applet/app/e" "applet/app/e"
"applet/app/enum"
"applet/app/utils" "applet/app/utils"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@@ -32,7 +33,19 @@ func EducateSceneTokenQuery(c *gin.Context) {
return return
} }
//请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息) //请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息)
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
err, info := svc.CurlEducateSceneTokenQuery(md.CurlEducateSceneTokenReq{ err, info := svc.CurlEducateSceneTokenQuery(md.CurlEducateSceneTokenReq{
Config: struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
}{
AliAppId: sysCfg[enum.OpenAlipayAppid],
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
CertNo: identity.IdNo, CertNo: identity.IdNo,
StudentName: identity.Name, StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id), OutUserId: utils.IntToStr(identity.Id),
@@ -68,7 +81,19 @@ func EducateSceneTokenCreateForApplet(c *gin.Context) {
return return
} }
//请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息) //请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息)
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
err, info := svc.CurlEducateSceneTokenCreateForApplet(md.CurlEducateSceneTokenReq{ err, info := svc.CurlEducateSceneTokenCreateForApplet(md.CurlEducateSceneTokenReq{
Config: struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
}{
AliAppId: sysCfg[enum.OpenAlipayAppid],
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
CertNo: identity.IdNo, CertNo: identity.IdNo,
StudentName: identity.Name, StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id), OutUserId: utils.IntToStr(identity.Id),
@@ -106,6 +131,10 @@ func EducateFacepayApply(c *gin.Context) {
} }


//请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息) //请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息)
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)

selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{}
selfSupportForUserFaceInfoDb.Set(utils.StrToInt(userIdentityId)) selfSupportForUserFaceInfoDb.Set(utils.StrToInt(userIdentityId))
faceInfo, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo() faceInfo, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo()
@@ -118,6 +147,15 @@ func EducateFacepayApply(c *gin.Context) {
return return
} }
err, info := svc.CurlEducateFacepayApply(md.CurlEducateFacepayApplyReq{ err, info := svc.CurlEducateFacepayApply(md.CurlEducateFacepayApplyReq{
Config: struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
}{
AliAppId: sysCfg[enum.OpenAppletAppid],
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
FaceUid: faceInfo.UserId, FaceUid: faceInfo.UserId,
FaceOpenId: faceOpenId, FaceOpenId: faceOpenId,
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode, SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode,
@@ -152,8 +190,21 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) {
e.OutErr(c, e.ERR_NO_DATA, "当前学校暂未完成《一脸通行入驻》") e.OutErr(c, e.ERR_NO_DATA, "当前学校暂未完成《一脸通行入驻》")
return return
} }

//请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息) //请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息)
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey)
err, info := svc.CurlEducateSceneTokenCreateForConcentratedCollectApplet(md.CurlEducateSceneTokenReq{ err, info := svc.CurlEducateSceneTokenCreateForConcentratedCollectApplet(md.CurlEducateSceneTokenReq{
Config: struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
}{
AliAppId: sysCfg[enum.OpenAlipayAppid],
AliPrivateKey: sysCfg[enum.OpenAppletAppPrivateKey],
AliPublicKey: sysCfg[enum.OpenAppletPublicKey],
},
CertNo: identity.IdNo, CertNo: identity.IdNo,
StudentName: identity.Name, StudentName: identity.Name,
OutUserId: utils.IntToStr(identity.Id), OutUserId: utils.IntToStr(identity.Id),


+ 27
- 1
app/customer/md/md_curl_smart_pay.go View File

@@ -1,10 +1,16 @@
package md package md


type CurlAesDecrypt struct { type CurlAesDecrypt struct {
AesKey string `json:"aes_key" label:"支付宝开放平台-小程序-接口内容加密-aesKey"`
Content string `json:"content" binding:"required" label:"解密内容"` Content string `json:"content" binding:"required" label:"解密内容"`
} }


type SystemOauthTokenReq struct { type SystemOauthTokenReq struct {
Config struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
} `json:"config" label:"配置信息"`
Code string `json:"code" binding:"required" label:"授权码"` Code string `json:"code" binding:"required" label:"授权码"`
} }


@@ -13,7 +19,7 @@ type CurlAlipayTradeCreateReq struct {
PayAliAppId string `json:"pay_ali_app_id" binding:"required" label:"支付宝开放平台-第三方应用-appid"` PayAliAppId string `json:"pay_ali_app_id" binding:"required" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"` PayAliPrivateKey string `json:"pay_ali_private_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"` PayAliPublicKey string `json:"pay_ali_public_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
} `json:"config" binding:"required" label:"配置信息"`
} `json:"config" label:"配置信息"`
OpAppId string `json:"op_app_id" binding:"required" label:"小程序支付中,商户实际经营主体的小程序应用的appid,也即最终唤起收银台支付所在的小程序的应用id"` OpAppId string `json:"op_app_id" binding:"required" label:"小程序支付中,商户实际经营主体的小程序应用的appid,也即最终唤起收银台支付所在的小程序的应用id"`
BuyerId string `json:"buyer_id" binding:"required" label:"买家支付宝用户ID"` BuyerId string `json:"buyer_id" binding:"required" label:"买家支付宝用户ID"`
TotalAmount string `json:"total_amount" binding:"required" label:"订单总金额"` TotalAmount string `json:"total_amount" binding:"required" label:"订单总金额"`
@@ -30,6 +36,11 @@ type CurlAlipayTradeCreateResp struct {
} }


type CurlAlipayTradeQueryReq struct { type CurlAlipayTradeQueryReq struct {
Config struct {
PayAliAppId string `json:"pay_ali_app_id" binding:"required" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
} `json:"config" label:"配置信息"`
OutTradeNo string `json:"out_trade_no" label:"商户订单号"` OutTradeNo string `json:"out_trade_no" label:"商户订单号"`
AppAuthToken string `json:"app_auth_token" binding:"required" label:"应用授权token"` AppAuthToken string `json:"app_auth_token" binding:"required" label:"应用授权token"`
} }
@@ -43,6 +54,11 @@ type CurlAlipayTradeQueryResp struct {
} }


type CurlAlipayTradeRefundReq struct { type CurlAlipayTradeRefundReq struct {
Config struct {
PayAliAppId string `json:"pay_ali_app_id" binding:"required" label:"支付宝开放平台-第三方应用-appid"`
PayAliPrivateKey string `json:"pay_ali_private_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-应用私钥"`
PayAliPublicKey string `json:"pay_ali_public_key" binding:"required" label:"支付宝开放平台-第三方应用-接口加签-支付宝公钥"`
} `json:"config" label:"配置信息"`
OutTradeNo string `json:"out_trade_no" label:"商户订单号"` OutTradeNo string `json:"out_trade_no" label:"商户订单号"`
RefundAmount string `json:"refund_amount" label:"退款金额"` RefundAmount string `json:"refund_amount" label:"退款金额"`
RefundReason string `json:"refund_reason" label:"退款原因"` RefundReason string `json:"refund_reason" label:"退款原因"`
@@ -51,6 +67,11 @@ type CurlAlipayTradeRefundReq struct {
} }


type CurlEducateSceneTokenReq struct { type CurlEducateSceneTokenReq struct {
Config struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
} `json:"config" label:"配置信息"`
CertNo string `json:"cert_no" label:"身份证号码"` CertNo string `json:"cert_no" label:"身份证号码"`
StudentName string `json:"student_name" label:"姓名"` StudentName string `json:"student_name" label:"姓名"`
OutUserId string `json:"out_user_id" label:"服务商内部用户唯一ID,用于与支付宝用户 ID 进行关联"` OutUserId string `json:"out_user_id" label:"服务商内部用户唯一ID,用于与支付宝用户 ID 进行关联"`
@@ -59,6 +80,11 @@ type CurlEducateSceneTokenReq struct {
} }


type CurlEducateFacepayApplyReq struct { type CurlEducateFacepayApplyReq struct {
Config struct {
AliAppId string `json:"ali_app_id" binding:"required" label:"支付宝开放平台-小程序-appid"`
AliPrivateKey string `json:"ali_private_key" binding:"required" label:"支付宝开放平台-小程序-应用私钥"`
AliPublicKey string `json:"ali_public_key" binding:"required" label:"支付宝开放平台-小程序-支付宝公钥"`
} `json:"config" label:"配置信息"`
FaceUid string `json:"face_uid" label:"刷脸用户id"` FaceUid string `json:"face_uid" label:"刷脸用户id"`
FaceOpenId string `json:"face_open_id" label:"刷脸用户openId"` FaceOpenId string `json:"face_open_id" label:"刷脸用户openId"`
SchoolStdCode string `json:"school_std_code" label:"学校外标"` SchoolStdCode string `json:"school_std_code" label:"学校外标"`


+ 24
- 4
app/customer/svc/svc_curl_smart_pay.go View File

@@ -173,7 +173,12 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentityId
if userToken == "" { if userToken == "" {
//1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token) //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate" url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
bytes, err1 := utils.CurlPost(url, utils.Serialize(map[string]string{
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, "cert_no": args.CertNo,
"school_std_code": args.SchoolStdCode, "school_std_code": args.SchoolStdCode,
"student_name": args.StudentName, "student_name": args.StudentName,
@@ -293,7 +298,12 @@ func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err


//1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token) //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate" url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
bytes, err := utils.CurlPost(url, utils.Serialize(map[string]string{
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, "cert_no": args.CertNo,
"school_std_code": args.SchoolStdCode, "school_std_code": args.SchoolStdCode,
"student_name": args.StudentName, "student_name": args.StudentName,
@@ -333,7 +343,12 @@ func CurlEducateSceneTokenCreateForConcentratedCollectApplet(args md.CurlEducate


//1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token) //1、TODO::生成用户信息token(使用 alipay.commerce.educate.scene.token.create 接口生成用户信息token)
url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate" url := cfg.SmartCanteenPay + "/alipay/faceCollection/educateSceneTokenCreate"
bytes, err := utils.CurlPost(url, utils.Serialize(map[string]string{
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, "cert_no": args.CertNo,
"school_std_code": args.SchoolStdCode, "school_std_code": args.SchoolStdCode,
"student_name": args.StudentName, "student_name": args.StudentName,
@@ -374,7 +389,12 @@ func CurlEducateFacepayApply(args md.CurlEducateFacepayApplyReq) (err error, res


//1、TODO::alipay.commerce.educate.facepay.apply(人脸开通支付申请) //1、TODO::alipay.commerce.educate.facepay.apply(人脸开通支付申请)
url := cfg.SmartCanteenPay + "/alipay/faceScanPay/educateFacepayApply" url := cfg.SmartCanteenPay + "/alipay/faceScanPay/educateFacepayApply"
bytes, err := utils.CurlPost(url, utils.Serialize(map[string]string{
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,
},
"face_uid": args.FaceUid, "face_uid": args.FaceUid,
"school_std_code": args.SchoolStdCode, "school_std_code": args.SchoolStdCode,
"face_open_id": args.FaceOpenId, "face_open_id": args.FaceOpenId,


+ 13
- 11
app/enum/enum_sys_cfg.go View File

@@ -3,17 +3,19 @@ package enum
type SysCfg string type SysCfg string


const ( const (
AppName = "app_name"
OpenAlipayAesKey = "open_alipay_aes_key"
OpenAlipayAppPrivateKey = "open_alipay_app_private_key"
OpenAlipayAppPublicKey = "open_alipay_app_public_key"
OpenAlipayPublicKey = "open_alipay_public_key"
OpenAppletAesKey = "open_applet_aes_key"
OpenAppletAppPrivateKey = "open_applet_app_private_key"
OpenAppletAppPublicKey = "open_applet_app_public_key"
OpenAppletPublicKey = "open_applet_public_key"
OpenAlipayAppid = "open_alipay_appid"
OpenAppletAppid = "open_applet_appid"
AppName = "app_name"
OpenAlipayAppid = "open_alipay_appid"
OpenAlipayAesKey = "open_alipay_aes_key"
OpenAlipayAppPrivateKey = "open_alipay_app_private_key"
OpenAlipayAppPublicKey = "open_alipay_app_public_key"
OpenAlipayPublicKey = "open_alipay_public_key"
OpenAppletAesKey = "open_applet_aes_key"

OpenAppletAppid = "open_applet_appid"
OpenAppletAppPrivateKey = "open_applet_app_private_key"
OpenAppletAppPublicKey = "open_applet_app_public_key"
OpenAppletPublicKey = "open_applet_public_key"

FileBucketHost = "file_bucket_host" FileBucketHost = "file_bucket_host"
FileBucketRegion = "file_bucket_region" FileBucketRegion = "file_bucket_region"
FileBucketScheme = "file_bucket_scheme" FileBucketScheme = "file_bucket_scheme"


+ 1
- 0
app/router/customer_router.go View File

@@ -13,6 +13,7 @@ func CustomerInit(r *gin.RouterGroup) {
rSelfSupportForSchool(r.Group("/selfSupportForSchool")) rSelfSupportForSchool(r.Group("/selfSupportForSchool"))


r.POST("/curlAlipayPlanetEcocampusApiRosterSignUpInfoTest", hdl.CurlAlipayPlanetEcocampusApiRosterSignUpInfo) r.POST("/curlAlipayPlanetEcocampusApiRosterSignUpInfoTest", hdl.CurlAlipayPlanetEcocampusApiRosterSignUpInfo)

r.POST("/login", hdl.Login) r.POST("/login", hdl.Login)
r.POST("/register", hdl.Register) r.POST("/register", hdl.Register)
r.POST("/aesDecrypt", hdl.AesDecrypt) r.POST("/aesDecrypt", hdl.AesDecrypt)


+ 3
- 3
app/utils/cache/redis.go View File

@@ -36,7 +36,7 @@ type Config struct {
var pool *redigo.Pool var pool *redigo.Pool
var conf *Config var conf *Config


func NewRedis(addr string) {
func NewRedis(addr, password string) {
if addr == "" { if addr == "" {
panic("\nredis connect string cannot be empty\n") panic("\nredis connect string cannot be empty\n")
} }
@@ -48,6 +48,7 @@ func NewRedis(addr string) {
Wait: true, Wait: true,
Dial: func() (redigo.Conn, error) { Dial: func() (redigo.Conn, error) {
c, err := redigo.Dial("tcp", addr, c, err := redigo.Dial("tcp", addr,
redigo.DialPassword(password),
redigo.DialConnectTimeout(redisDialTTL), redigo.DialConnectTimeout(redisDialTTL),
redigo.DialReadTimeout(redisReadTTL), redigo.DialReadTimeout(redisReadTTL),
redigo.DialWriteTimeout(redisWriteTTL), redigo.DialWriteTimeout(redisWriteTTL),
@@ -402,8 +403,7 @@ func Scan(cursor int64, pattern string, count int64) (int64, []string, error) {
return newCursor, items, nil return newCursor, items, nil
} }



func LPushMax(key string, data ...interface{}) (interface{}, error) { func LPushMax(key string, data ...interface{}) (interface{}, error) {
// set // set
return Do("LPUSH", key, data) return Do("LPUSH", key, data)
}
}

Loading…
Cancel
Save