Commit 3f227fc3 authored by wangp's avatar wangp

lakala-wxjsapi-alipay

parent ce89200b
...@@ -4,6 +4,8 @@ import ( ...@@ -4,6 +4,8 @@ import (
"fmt" "fmt"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"system_pay/controller/base" "system_pay/controller/base"
"system_pay/models"
"system_pay/repository/pay"
) )
// 卡拉卡统一支付回调 // 卡拉卡统一支付回调
...@@ -36,24 +38,20 @@ func (l *PayController) WxNotice(c *gin.Context) { ...@@ -36,24 +38,20 @@ func (l *PayController) WxNotice(c *gin.Context) {
//} //}
//fmt.Println(ph2) //fmt.Println(ph2)
//ph := new(models.WxNoticeInput) ph := new(models.WxNoticeInput)
//err := c.ShouldBindJSON(ph) err := c.ShouldBindJSON(ph)
//if err != nil { if err != nil {
// response := new(base.ResponseDataWxNotice)
// response.Code = "FAIL"
// response.Message = "执行失败2"
// base.ResponseWxNotice(c, response)
// return
//}
////fmt.Println(ph)
//
//// 拉卡拉统一支付微信回调
//response, err := pay.WxNotice(ph)
//
//fmt.Println("拉卡拉微信回调end")
response := new(base.ResponseDataWxNotice) response := new(base.ResponseDataWxNotice)
response.Code = "SUCCESS" response.Code = "FAIL"
response.Message = "执行成功" response.Message = "执行失败2"
base.ResponseWxNotice(c, response)
return
}
//fmt.Println(ph)
// 拉卡拉统一支付微信回调
response, err := pay.WxNotice(ph)
fmt.Println("拉卡拉微信回调end")
base.ResponseWxNotice(c, response) base.ResponseWxNotice(c, response)
} }
...@@ -26,7 +26,7 @@ type PayController struct { ...@@ -26,7 +26,7 @@ type PayController struct {
func (l *PayController) UnifiedOrder(c *gin.Context) { func (l *PayController) UnifiedOrder(c *gin.Context) {
ph := new(models.PlaceAnOrderParamInput) ph := new(models.PlaceAnOrderParamInput)
fmt.Println("ContentType="+c.ContentType()) //fmt.Println("ContentType="+c.ContentType())
err := c.ShouldBindJSON(ph) err := c.ShouldBindJSON(ph)
if err != nil { if err != nil {
zap.L().Error(err.Error()) zap.L().Error(err.Error())
...@@ -34,8 +34,13 @@ func (l *PayController) UnifiedOrder(c *gin.Context) { ...@@ -34,8 +34,13 @@ func (l *PayController) UnifiedOrder(c *gin.Context) {
return return
} }
// clientIp ip
//ip = c.Ctx.Input.IP()
ip := c.ClientIP()
fmt.Println("ip="+ip)
// 拉卡拉统一支付 // 拉卡拉统一支付
rtn, err := pay.UnifiedOrder(ph) rtn, err := pay.UnifiedOrder(ph, ip)
if err != nil { if err != nil {
zap.L().Error(err.Error()) zap.L().Error(err.Error())
//base.ResponseErrorWithMsg(c, base.ServerError) //base.ResponseErrorWithMsg(c, base.ServerError)
......
package jwt package jwt
import (
"fmt"
"github.com/gin-gonic/gin"
"system_pay/controller/base"
"system_pay/utils"
)
//var DataAnalysisCh chan models.DataAnalysisModel //var DataAnalysisCh chan models.DataAnalysisModel
func init() { func init() {
...@@ -15,51 +8,51 @@ func init() { ...@@ -15,51 +8,51 @@ func init() {
} }
// JWTAuthMiddleWare 基于JWT的认证中间件 // JWTAuthMiddleWare 基于JWT的认证中间件
func JWTAuthMiddleWare() func(c *gin.Context) { //func JWTAuthMiddleWare() func(c *gin.Context) {
return func(c *gin.Context) { // return func(c *gin.Context) {
//客户端携带Token放在请求头 // //客户端携带Token放在请求头
authHeader := c.Request.Header.Get("Authorization") // authHeader := c.Request.Header.Get("Authorization")
if authHeader == "" { // if authHeader == "" {
base.ResponseErrorWithMsg(c, base.AuthorizationEmpty) // base.ResponseErrorWithMsg(c, base.AuthorizationEmpty)
c.Abort() // c.Abort()
return // return
} // }
//
mc, err := utils.ParseToken(authHeader) // mc, err := utils.ParseToken(authHeader)
if err != nil { // if err != nil {
base.ResponseErrorWithMsg(c, base.AuthorizationEmpty) // base.ResponseErrorWithMsg(c, base.AuthorizationEmpty)
c.Abort() // c.Abort()
return // return
} // }
//
// des解密 // // des解密
phoneMob := utils.ToDesDecrypt(mc.PhoneMob) // phoneMob := utils.ToDesDecrypt(mc.PhoneMob)
userId := utils.ToDesDecrypt(mc.UserId) // userId := utils.ToDesDecrypt(mc.UserId)
userName := utils.ToDesDecrypt(mc.UserName) // userName := utils.ToDesDecrypt(mc.UserName)
//hospitalCode := utils.ToDesDecrypt(mc.HospitalCode) // //hospitalCode := utils.ToDesDecrypt(mc.HospitalCode)
//chainCode := utils.ToDesDecrypt(mc.ChainCode) // //chainCode := utils.ToDesDecrypt(mc.ChainCode)
//hospitalID := utils.ToDesDecrypt(mc.HospitalID) // //hospitalID := utils.ToDesDecrypt(mc.HospitalID)
//hospitalName := utils.ToDesDecrypt(mc.HospitalName) // //hospitalName := utils.ToDesDecrypt(mc.HospitalName)
//ChainID := utils.ToDesDecrypt(mc.ChainID) // //ChainID := utils.ToDesDecrypt(mc.ChainID)
// 将当前请求的username信息保存到请求的上下文c上 // // 将当前请求的username信息保存到请求的上下文c上
c.Set("phone_mob", phoneMob) // c.Set("phone_mob", phoneMob)
fmt.Println(phoneMob) // fmt.Println(phoneMob)
c.Set("user_id", userId) // c.Set("user_id", userId)
fmt.Println(userId) // fmt.Println(userId)
c.Set("user_name", userName) // c.Set("user_name", userName)
fmt.Println(userName) // fmt.Println(userName)
//c.Set("hospital_code", hospitalCode) // //c.Set("hospital_code", hospitalCode)
//c.Set("chain_code", chainCode) // //c.Set("chain_code", chainCode)
//c.Set("hospital_id", hospitalID) // //c.Set("hospital_id", hospitalID)
//c.Set("hospital_name", hospitalName) // //c.Set("hospital_name", hospitalName)
//c.Set("chain_id", ChainID) // //c.Set("chain_id", ChainID)
// 后续的处理函数可以用过c.Get("username")来获取当前请求的用户信息 // // 后续的处理函数可以用过c.Get("username")来获取当前请求的用户信息
//
// 埋点生产者 // // 埋点生产者
//BuriedProducer(c, hospitalCode, hospitalName, hospitalID) // //BuriedProducer(c, hospitalCode, hospitalName, hospitalID)
c.Next() // c.Next()
} // }
} //}
// 埋点消费者 // 埋点消费者
//func DataAnalysisChannel() { //func DataAnalysisChannel() {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment