duxin преди 2 години
родител
ревизия
83466c4507
променени са 1 файла, в които са добавени 17 реда и са изтрити 2 реда
  1. 17 2
      src/jfw/modules/subscribepay/src/util/sellerOrder.go

+ 17 - 2
src/jfw/modules/subscribepay/src/util/sellerOrder.go

@@ -8,6 +8,7 @@ import (
 	"jy/src/jfw/modules/subscribepay/src/config"
 	"net/http"
 	"net/url"
+	"strings"
 	"time"
 
 	qutil "app.yhyue.com/moapp/jybase/common"
@@ -134,8 +135,8 @@ func SendStationMessages(href, userId, action, msgType, title, content, link, an
 	if VipType == 1 {
 		name = "超级订阅(续费)"
 	}
-	pushHref := fmt.Sprintf("%s?_action=%s&userIds=%s&msgType=%s&title=%s&content=%s&link=%s&sendMode=2&sendTime=%s&androidUrl=%s&iosUrl=%s&weChatUrl=%s&_token=12311&reqSource=1&callPlatform=dyhxd&name=%s&orderid=%s&ordermoney=%d&details=您的订单%s处于未支付状态,为了使您获取更多...",
-		href, action, userId, msgType, title, content, link, NowFormat(Date_Short_Layout), androidUrl, iosUrl, weChatUrl, name, OrderCode, OrderMoney, OrderCode)
+	pushHref := fmt.Sprintf("%s?_action=%s&userIds=%s&msgType=%s&title=%s&content=%s&link=%s&sendMode=2&sendTime=%s&androidUrl=%s&iosUrl=%s&weChatUrl=%s&_token=12311&reqSource=1&callPlatform=dyhxd&name=%s&orderid=%s&ordermoney=%s&details=您的订单%s处于未支付状态,为了使您获取更多...",
+		href, action, userId, msgType, title, content, link, NowFormat(Date_Short_Layout), androidUrl, iosUrl, weChatUrl, name, OrderCode, OrderMoneyFormStr(OrderMoney), OrderCode)
 	log.Info("href:", pushHref)
 	log.Println(pushHref)
 	resp, err := http.Get(pushHref)
@@ -184,6 +185,20 @@ func SendStationMessages(href, userId, action, msgType, title, content, link, an
 	//	}
 }
 
+// OrderMoneyFormStr 金额取值
+func OrderMoneyFormStr(orderMoney int) string {
+	if orderMoney == 0 {
+		return "0"
+	}
+	str := fmt.Sprintf("%.2f", float64(orderMoney)/100)
+	if strings.Contains(str, ".00") {
+		str = strings.ReplaceAll(str, ".00", "")
+	} else if strings.HasSuffix(str, "0") {
+		str = strings.TrimRight(str, "0")
+	}
+	return str
+}
+
 // 加密
 func encode(i *identity.IdentityInfo) string {
 	b, _ := json.Marshal(i)