@@ -118,10 +118,7 @@ func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderR | |||
func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrderRefundAuditReq) (err error) { | |||
sysCfgDb := db.SysCfgDb{} | |||
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() | |||
defer session.Close() | |||
@@ -193,11 +190,20 @@ func CentralKitchenForSchoolOrderRefundAudit(req md.CentralKitchenForSchoolOrder | |||
//3、调用支付宝进行退款 | |||
if req.State == 1 { | |||
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, | |||
RefundAmount: returnDay.Amount, | |||
RefundReason: "央厨订餐退款", | |||
OutRequestNo: returnDay.OutRequestNo, | |||
AppAuthToken: sysCfg.Val, | |||
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken], | |||
}) | |||
if err6 != nil { | |||
_ = session.Rollback() | |||
@@ -9,6 +9,7 @@ type Config struct { | |||
Prd bool `yaml:"prd"` | |||
SrvAddr string `yaml:"srv_addr"` | |||
RedisAddr string `yaml:"redis_addr"` | |||
RedisPassword string `yaml:"redis_password"` | |||
SmartCanteenPay string `yaml:"smart_canteen_pay"` | |||
DB DBCfg `yaml:"db"` | |||
Log LogCfg `yaml:"log"` | |||
@@ -5,5 +5,5 @@ import ( | |||
) | |||
func InitCache() { | |||
cache.NewRedis(RedisAddr) | |||
cache.NewRedis(RedisAddr, RedisPassword) | |||
} |
@@ -14,6 +14,7 @@ var ( | |||
SrvAddr string | |||
SmartCanteenPay string | |||
RedisAddr string | |||
RedisPassword string | |||
DB *DBCfg | |||
Log *LogCfg | |||
) | |||
@@ -43,6 +44,7 @@ func InitCfg() { | |||
DB = &conf.DB | |||
Log = &conf.Log | |||
RedisAddr = conf.RedisAddr | |||
RedisPassword = conf.RedisPassword | |||
SmartCanteenPay = conf.SmartCanteenPay | |||
SrvAddr = conf.SrvAddr | |||
} |
@@ -29,6 +29,7 @@ func InitTaskCfg() { | |||
DB = &conf.DB | |||
Log = &conf.Log | |||
RedisAddr = conf.RedisAddr | |||
RedisPassword = conf.RedisPassword | |||
} | |||
var MemCache mc.Cache | |||
@@ -4,7 +4,9 @@ import ( | |||
"applet/app/customer/lib/validate" | |||
"applet/app/customer/md" | |||
"applet/app/customer/svc" | |||
"applet/app/db" | |||
"applet/app/e" | |||
"applet/app/enum" | |||
"github.com/gin-gonic/gin" | |||
) | |||
@@ -17,6 +19,11 @@ func AesDecrypt(c *gin.Context) { | |||
e.OutErr(c, err1.Code, err1.Error()) | |||
return | |||
} | |||
sysCfgDb := db.SysCfgDb{} | |||
sysCfgDb.Set() | |||
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAesKey) | |||
req.AesKey = sysCfg[enum.OpenAppletAesKey] | |||
err, result := svc.AesDecrypt(req) | |||
if err != nil { | |||
e.OutErr(c, e.ERR, err.Error()) | |||
@@ -35,6 +42,18 @@ func SystemOauthToken(c *gin.Context) { | |||
e.OutErr(c, err1.Code, err1.Error()) | |||
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) | |||
if err != nil { | |||
e.OutErr(c, e.ERR, err.Error()) | |||
@@ -51,15 +51,19 @@ func OrdState(c *gin.Context) { | |||
//处于待支付状态,请求支付宝同步订单状态 | |||
sysCfgDb := db.SysCfgDb{} | |||
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{ | |||
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, | |||
AppAuthToken: sysCfg.Val, | |||
AppAuthToken: sysCfg[enum.JsapiPayAppAutToken], | |||
}) | |||
if err2 != nil { | |||
e.OutErr(c, e.ERR, err2.Error()) | |||
@@ -5,6 +5,7 @@ import ( | |||
"applet/app/customer/svc" | |||
"applet/app/db" | |||
"applet/app/e" | |||
"applet/app/enum" | |||
"applet/app/utils" | |||
"github.com/gin-gonic/gin" | |||
) | |||
@@ -32,7 +33,19 @@ func EducateSceneTokenQuery(c *gin.Context) { | |||
return | |||
} | |||
//请求支付宝 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{ | |||
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, | |||
StudentName: identity.Name, | |||
OutUserId: utils.IntToStr(identity.Id), | |||
@@ -68,7 +81,19 @@ func EducateSceneTokenCreateForApplet(c *gin.Context) { | |||
return | |||
} | |||
//请求支付宝 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{ | |||
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, | |||
StudentName: identity.Name, | |||
OutUserId: utils.IntToStr(identity.Id), | |||
@@ -106,6 +131,10 @@ func EducateFacepayApply(c *gin.Context) { | |||
} | |||
//请求支付宝 alipay.commerce.educate.scene.token.query(查询刷脸用户开通详细信息) | |||
sysCfgDb := db.SysCfgDb{} | |||
sysCfgDb.Set() | |||
sysCfg := sysCfgDb.SysCfgFindWithDb(enum.OpenAppletAppid, enum.OpenAppletAppPrivateKey, enum.OpenAppletPublicKey) | |||
selfSupportForUserFaceInfoDb := db.SelfSupportForUserFaceInfoDb{} | |||
selfSupportForUserFaceInfoDb.Set(utils.StrToInt(userIdentityId)) | |||
faceInfo, err := selfSupportForUserFaceInfoDb.GetSelfSupportForUserFaceInfo() | |||
@@ -118,6 +147,15 @@ func EducateFacepayApply(c *gin.Context) { | |||
return | |||
} | |||
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, | |||
FaceOpenId: faceOpenId, | |||
SchoolStdCode: selfSupportForSchoolInfo.SchoolStdCode, | |||
@@ -152,8 +190,21 @@ func EducateSceneTokenCreateForConcentratedCollectApplet(c *gin.Context) { | |||
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) | |||
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, | |||
StudentName: identity.Name, | |||
OutUserId: utils.IntToStr(identity.Id), | |||
@@ -1,10 +1,16 @@ | |||
package md | |||
type CurlAesDecrypt struct { | |||
AesKey string `json:"aes_key" label:"支付宝开放平台-小程序-接口内容加密-aesKey"` | |||
Content string `json:"content" binding:"required" label:"解密内容"` | |||
} | |||
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:"授权码"` | |||
} | |||
@@ -13,7 +19,7 @@ type CurlAlipayTradeCreateReq 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" binding:"required" label:"配置信息"` | |||
} `json:"config" label:"配置信息"` | |||
OpAppId string `json:"op_app_id" binding:"required" label:"小程序支付中,商户实际经营主体的小程序应用的appid,也即最终唤起收银台支付所在的小程序的应用id"` | |||
BuyerId string `json:"buyer_id" binding:"required" label:"买家支付宝用户ID"` | |||
TotalAmount string `json:"total_amount" binding:"required" label:"订单总金额"` | |||
@@ -30,6 +36,11 @@ type CurlAlipayTradeCreateResp 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:"商户订单号"` | |||
AppAuthToken string `json:"app_auth_token" binding:"required" label:"应用授权token"` | |||
} | |||
@@ -43,6 +54,11 @@ type CurlAlipayTradeQueryResp 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:"商户订单号"` | |||
RefundAmount string `json:"refund_amount" label:"退款金额"` | |||
RefundReason string `json:"refund_reason" label:"退款原因"` | |||
@@ -51,6 +67,11 @@ type CurlAlipayTradeRefundReq 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:"身份证号码"` | |||
StudentName string `json:"student_name" label:"姓名"` | |||
OutUserId string `json:"out_user_id" label:"服务商内部用户唯一ID,用于与支付宝用户 ID 进行关联"` | |||
@@ -59,6 +80,11 @@ type CurlEducateSceneTokenReq 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"` | |||
FaceOpenId string `json:"face_open_id" label:"刷脸用户openId"` | |||
SchoolStdCode string `json:"school_std_code" label:"学校外标"` | |||
@@ -173,7 +173,12 @@ func CurlEducateSceneTokenQuery(args md.CurlEducateSceneTokenReq, userIdentityId | |||
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]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, | |||
"school_std_code": args.SchoolStdCode, | |||
"student_name": args.StudentName, | |||
@@ -293,7 +298,12 @@ func CurlEducateSceneTokenCreateForApplet(args md.CurlEducateSceneTokenReq) (err | |||
//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]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, | |||
"school_std_code": args.SchoolStdCode, | |||
"student_name": args.StudentName, | |||
@@ -333,7 +343,12 @@ func CurlEducateSceneTokenCreateForConcentratedCollectApplet(args md.CurlEducate | |||
//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]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, | |||
"school_std_code": args.SchoolStdCode, | |||
"student_name": args.StudentName, | |||
@@ -374,7 +389,12 @@ func CurlEducateFacepayApply(args md.CurlEducateFacepayApplyReq) (err error, res | |||
//1、TODO::alipay.commerce.educate.facepay.apply(人脸开通支付申请) | |||
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, | |||
"school_std_code": args.SchoolStdCode, | |||
"face_open_id": args.FaceOpenId, | |||
@@ -3,17 +3,19 @@ package enum | |||
type SysCfg string | |||
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" | |||
FileBucketRegion = "file_bucket_region" | |||
FileBucketScheme = "file_bucket_scheme" | |||
@@ -13,6 +13,7 @@ func CustomerInit(r *gin.RouterGroup) { | |||
rSelfSupportForSchool(r.Group("/selfSupportForSchool")) | |||
r.POST("/curlAlipayPlanetEcocampusApiRosterSignUpInfoTest", hdl.CurlAlipayPlanetEcocampusApiRosterSignUpInfo) | |||
r.POST("/login", hdl.Login) | |||
r.POST("/register", hdl.Register) | |||
r.POST("/aesDecrypt", hdl.AesDecrypt) | |||
@@ -36,7 +36,7 @@ type Config struct { | |||
var pool *redigo.Pool | |||
var conf *Config | |||
func NewRedis(addr string) { | |||
func NewRedis(addr, password string) { | |||
if addr == "" { | |||
panic("\nredis connect string cannot be empty\n") | |||
} | |||
@@ -48,6 +48,7 @@ func NewRedis(addr string) { | |||
Wait: true, | |||
Dial: func() (redigo.Conn, error) { | |||
c, err := redigo.Dial("tcp", addr, | |||
redigo.DialPassword(password), | |||
redigo.DialConnectTimeout(redisDialTTL), | |||
redigo.DialReadTimeout(redisReadTTL), | |||
redigo.DialWriteTimeout(redisWriteTTL), | |||
@@ -402,8 +403,7 @@ func Scan(cursor int64, pattern string, count int64) (int64, []string, error) { | |||
return newCursor, items, nil | |||
} | |||
func LPushMax(key string, data ...interface{}) (interface{}, error) { | |||
// set | |||
return Do("LPUSH", key, data) | |||
} | |||
} |