瀏覽代碼

返回坐标

k.zhang 2 月之前
父節點
當前提交
9194409088
共有 2 個文件被更改,包括 22 次插入1 次删除
  1. 14 1
      apis/shanghu/merchant.active.config.go
  2. 8 0
      apis/shanghu/models/active.config.go

+ 14 - 1
apis/shanghu/merchant.active.config.go

@@ -650,6 +650,8 @@ func GetClientActiveQR(c *gin.Context) {
 	var outData models.ClientCardQRReply
 	var qr models.QRRequest
 	var getQR models.GetQRRequest
+	var activeSql shanghu.MerchantActiveConfig
+	var out models.ClientActiveQRReply
 
 	err := c.ShouldBindJSON(&inData)
 	if err != nil {
@@ -716,12 +718,23 @@ func GetClientActiveQR(c *gin.Context) {
 		app.Error(c, 500, err, getQR.Errmsg)
 		return
 	}
+	activeSql.ID = inData.ActiveConfigId
+	activeInfo, err := activeSql.GetConfigInfoById()
+	if err != nil {
+		app.Error(c, 500, err, getQR.Errmsg)
+		return
+	}
 
 	//fmt.Println(string(reply))
 
 	encoded := base64.StdEncoding.EncodeToString(reply)
+	out.H = activeInfo.H
+	out.W = activeInfo.W
+	out.X = activeInfo.X
+	out.Y = activeInfo.Y
+	out.Encoded = encoded
 
-	app.OK(c, encoded, app.Success)
+	app.OK(c, out, app.Success)
 
 }
 

+ 8 - 0
apis/shanghu/models/active.config.go

@@ -118,6 +118,14 @@ type ClientActiveQRRequest struct {
 	OpenId         string `json:"open_id"`
 }
 
+type ClientActiveQRReply struct {
+	Encoded string `json:"encoded"`
+	W       string `json:"w"`
+	H       string `json:"h"`
+	X       string `json:"x"`
+	Y       string `json:"y"`
+}
+
 type GroupBuyUnifiedOrderRequest struct {
 	RequestId      string          `json:"request_id"`      //request id
 	OutTradeNo     string          `json:"out_trade_no"`    //交易id