♻️ 后台链接改为后台配置

🐛 修复配置链接

🐛 修复配置链接

🐛 修复配置链接

♻️ 后台链接改为后台配置

♻️ 后台链接改为后台配置

🐛 修复配置链接

🐛 修复配置链接
This commit is contained in:
sunxiaolong
2024-06-25 02:47:26 +08:00
parent 23d1af53c5
commit db8c97f780
9 changed files with 34 additions and 15 deletions

View File

@@ -24,6 +24,9 @@ db = 10
[gateway] [gateway]
host = http://localhost:12309/ host = http://localhost:12309/
[portal]
host = http://localhost:12400/
[testExtraLink] [testExtraLink]
; 测试连接 ; 测试连接
host = http://localhost:12305 host = http://localhost:12305

View File

@@ -19,6 +19,11 @@ func GetGatewayHost() string {
return host return host
} }
func GetPortalHost() string {
host, _ := web.AppConfig.String("portal::host")
return host
}
func GetRedisConfig() (*RedisConfig, error) { func GetRedisConfig() (*RedisConfig, error) {
// 获取redis配置 // 获取redis配置
redisConfig := &RedisConfig{} redisConfig := &RedisConfig{}

View File

@@ -3,6 +3,7 @@ package controllers
import ( import (
"boss/config" "boss/config"
"boss/service"
"boss/utils" "boss/utils"
"encoding/base64" "encoding/base64"
"strconv" "strconv"
@@ -18,11 +19,11 @@ type PageController struct {
func (c *PageController) Index() { func (c *PageController) Index() {
c.TplName = "index.html" c.TplName = "index.html"
testExtraLink, err := web.AppConfig.String("testExtraLink::host") testExtraLink, err := web.AppConfig.String("testExtraLink::host")
if err != nil { if err != nil {
testExtraLink = "http://127.0.0.1:12305" testExtraLink = "http://127.0.0.1:12305"
} }
roadList := service.QueryRoad()
c.Data["roadList"] = roadList
c.Data["extraAddr"] = testExtraLink c.Data["extraAddr"] = testExtraLink
} }
@@ -82,6 +83,7 @@ func (c *PageAuthController) MerchantV2Page() {
token = base64.URLEncoding.EncodeToString(tokenB) token = base64.URLEncoding.EncodeToString(tokenB)
} }
c.Data["token"] = token c.Data["token"] = token
c.Data["portalHost"] = config.GetPortalHost()
c.TplName = "merchant_v2.html" c.TplName = "merchant_v2.html"
} }
@@ -99,6 +101,7 @@ func (c *PageAuthController) RechargeAppleAccountPage() {
token = base64.URLEncoding.EncodeToString(tokenB) token = base64.URLEncoding.EncodeToString(tokenB)
} }
c.Data["token"] = token c.Data["token"] = token
c.Data["portalHost"] = config.GetPortalHost()
c.TplName = "apple-card/account.html" c.TplName = "apple-card/account.html"
} }
@@ -116,6 +119,7 @@ func (c *PageAuthController) OrderSummary() {
token = base64.URLEncoding.EncodeToString(tokenB) token = base64.URLEncoding.EncodeToString(tokenB)
} }
c.Data["token"] = token c.Data["token"] = token
c.Data["portalHost"] = config.GetPortalHost()
c.TplName = "order_summary.html" c.TplName = "order_summary.html"
} }
@@ -135,6 +139,7 @@ func (c *PageAuthController) RechargeAppleOrderPage() {
token = base64.URLEncoding.EncodeToString(tokenB) token = base64.URLEncoding.EncodeToString(tokenB)
} }
c.Data["token"] = token c.Data["token"] = token
c.Data["portalHost"] = config.GetPortalHost()
c.TplName = "apple-card/recharge-order.html" c.TplName = "apple-card/recharge-order.html"
} }

View File

@@ -5,6 +5,7 @@ import (
"boss/datas" "boss/datas"
"boss/models/order" "boss/models/order"
"boss/models/payfor" "boss/models/payfor"
"boss/models/road"
"boss/models/user" "boss/models/user"
"boss/utils/mfa" "boss/utils/mfa"
"fmt" "fmt"
@@ -279,14 +280,16 @@ func QueryTodaySummary(params map[string]string) order.Summary {
func ValidTotp(accountUid, totpCode string) bool { func ValidTotp(accountUid, totpCode string) bool {
userInfo := user.GetUserInfoByUserID(accountUid) userInfo := user.GetUserInfoByUserID(accountUid)
if userInfo.Id == 0 { if userInfo.Id == 0 {
return false return false
} }
if userInfo.OtpSecret == "" { if userInfo.OtpSecret == "" {
return true return true
} }
return mfa.ValidCode(totpCode, userInfo.OtpSecret) return mfa.ValidCode(totpCode, userInfo.OtpSecret)
} }
func QueryRoad() []road.RoadInfo {
roadInfoList := road.GetAllRoad(map[string]string{})
return roadInfoList
}

View File

@@ -13,7 +13,7 @@
</style> </style>
<script> <script>
// 构建链接 // 构建链接
const url = "http://" + window.location.hostname + ":12400" + "/iframe/appleAccount?token={{.token}}"; const url = "{{.portalHost}}" + "/iframe/appleAccount?token={{.token}}";
// 链接添加至到iframe中 // 链接添加至到iframe中
document.getElementsByTagName("iframe")[0].src = url; document.getElementsByTagName("iframe")[0].src = url;
</script> </script>

View File

@@ -13,7 +13,7 @@
</style> </style>
<script> <script>
// 构建链接 // 构建链接
const url = "http://" + window.location.hostname + ":12400" + "/iframe/rechargeOrder?token={{.token}}"; const url = "{{.portalHost}}" + "/iframe/rechargeOrder?token={{.token}}";
// 链接添加至到iframe中 // 链接添加至到iframe中
document.getElementsByTagName("iframe")[0].src = url; document.getElementsByTagName("iframe")[0].src = url;
</script> </script>

View File

@@ -344,20 +344,23 @@
<a href="#" onclick='loadMainContent("/account_history.html")'><span>资金流水</span></a> <a href="#" onclick='loadMainContent("/account_history.html")'><span>资金流水</span></a>
</div> </div>
</div> </div>
{{range.roadList}}
<div> <div>
<a href="#" class="first-menu"> <a href="#" class="first-menu">
<span class="glyphicon glyphicon-book"></span> <span class="glyphicon glyphicon-book"></span>
<span class="first-title">订单管理</span> <span class="first-title">订单管理({{RoadName}})</span>
<span class="glyphicon glyphicon-plus last-glyphicon"></span> <span class="glyphicon glyphicon-plus last-glyphicon"></span>
</a> </a>
<div class="second-menu"> <div class="second-menu">
<a href="#" onclick='loadMainContent("/order_info.html")'><span>实时订单</span></a> <a href="#"
<a href="#" onclick='loadMainContent("/order_profit.html")'><span>订单收益</span></a> onclick='loadMainContent("/order_info.html?roadId={{{RoadUid}}")'><span>实时订单</span></a>
<a href="#" onclick='loadMainContent("/order-summary-info.html")'><span>订单汇总</span></a> <a href="#"
onclick='loadMainContent("/order_profit.html?roadId={{{RoadUid}}")'><span>订单收益</span></a>
<a href="#"
onclick='loadMainContent("/order-summary-info.html?roadId={{{RoadUid}}")'><span>订单汇总</span></a>
</div> </div>
</div> </div>
{{end}}
<div> <div>
<a href="#" class="first-menu"> <a href="#" class="first-menu">
<span class="glyphicon glyphicon-piggy-bank"></span> <span class="glyphicon glyphicon-piggy-bank"></span>

View File

@@ -13,7 +13,7 @@
</style> </style>
<script> <script>
// 构建链接 // 构建链接
const url = "http://" + window.location.hostname + ":12400" + "/iframe/merchantConfig?token={{.token}}"; const url = "{{.portalHost}}" + "/iframe/merchantConfig?token={{.token}}";
// 链接添加至到iframe中 // 链接添加至到iframe中
document.getElementsByTagName("iframe")[0].src = url; document.getElementsByTagName("iframe")[0].src = url;
</script> </script>

View File

@@ -12,7 +12,7 @@
</style> </style>
<script> <script>
// 构建链接 // 构建链接
const url = "http://" + window.location.hostname + ":12400" + "/iframe/orderSummary?token={{.token}}"; const url = "{{.portalHost}}" + "/iframe/orderSummary?token={{.token}}";
// 链接添加至到iframe中 // 链接添加至到iframe中
document.getElementsByTagName("iframe")[0].src = url; document.getElementsByTagName("iframe")[0].src = url;
</script> </script>