💥添加通道编号相关信息
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"html/template"
|
||||
"merchant/datas"
|
||||
"merchant/models/merchant"
|
||||
"merchant/models/road"
|
||||
"merchant/service"
|
||||
"merchant/sys/enum"
|
||||
"merchant/utils/mfa"
|
||||
@@ -152,29 +153,6 @@ func (c *UserInfo) ShowUserInfoUI() {
|
||||
c.TplName = "show_userInfo.html"
|
||||
}
|
||||
|
||||
// QueryAllowedMM 获取允许的面值
|
||||
func (c *UserInfo) QueryAllowedMM() {
|
||||
us := c.GetSession(enum.UserSession)
|
||||
u := us.(merchant.MerchantInfo)
|
||||
if u.Id == 0 {
|
||||
c.Data["json"] = response.CommonRes{
|
||||
Msg: "获取用户失败",
|
||||
Code: -1,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
}
|
||||
result := service.QueryAllowedDeployInfoMM(u.MerchantUid, "CARD_DH")
|
||||
c.Data["json"] = response.CommonResWithData{
|
||||
CommonRes: response.CommonRes{
|
||||
Msg: "成功",
|
||||
Code: 0,
|
||||
},
|
||||
Data: result,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
func (c *UserInfo) SaveTotp() {
|
||||
code := c.GetString("totpCode")
|
||||
secret := c.GetString("totpSecret")
|
||||
@@ -245,3 +223,67 @@ func (c *UserInfo) ResetTotp() {
|
||||
_ = c.SetSession(enum.UserSession, u)
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
func (c *UserInfo) QueryAllowedRoad() {
|
||||
us := c.GetSession(enum.UserSession)
|
||||
u := us.(merchant.MerchantInfo)
|
||||
if u.Id == 0 {
|
||||
c.Data["json"] = response.CommonRes{
|
||||
Msg: "获取用户失败",
|
||||
Code: -1,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
}
|
||||
result := service.QueryAllowedRoad(u.MerchantUid)
|
||||
c.Data["json"] = response.CommonResWithData{
|
||||
CommonRes: response.CommonRes{
|
||||
Msg: "成功",
|
||||
Code: 0,
|
||||
},
|
||||
Data: result,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
// QueryAllowedMM 获取允许的面值
|
||||
func (c *UserInfo) QueryAllowedMM() {
|
||||
roadCode := c.GetString("roadCode")
|
||||
if roadCode == "" {
|
||||
c.Data["json"] = response.CommonRes{
|
||||
Msg: "请填写通道编码",
|
||||
Code: -1,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
}
|
||||
roadPool := road.GetRoadByProductCode(roadCode)
|
||||
if roadPool.Id == 0 {
|
||||
c.Data["json"] = response.CommonRes{
|
||||
Msg: "当前通道不存在",
|
||||
Code: -1,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
}
|
||||
|
||||
us := c.GetSession(enum.UserSession)
|
||||
u := us.(merchant.MerchantInfo)
|
||||
if u.Id == 0 {
|
||||
c.Data["json"] = response.CommonRes{
|
||||
Msg: "获取用户失败",
|
||||
Code: -1,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return
|
||||
}
|
||||
result := service.QueryAllowedDeployInfoMM(u.MerchantUid, roadPool.RoadUid)
|
||||
c.Data["json"] = response.CommonResWithData{
|
||||
CommonRes: response.CommonRes{
|
||||
Msg: "成功",
|
||||
Code: 0,
|
||||
},
|
||||
Data: result,
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
}
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
/***************************************************
|
||||
** @Desc : This file for ...
|
||||
** @Time : 2019/9/8 12:09
|
||||
** @Author : yuebin
|
||||
** @File : road_info
|
||||
** @Last Modified by : yuebin
|
||||
** @Last Modified time: 2019/9/8 12:09
|
||||
** @Software: GoLand
|
||||
****************************************************/
|
||||
package road
|
||||
|
||||
import (
|
||||
@@ -41,6 +32,12 @@ type RoadInfo struct {
|
||||
RequestSuccess int
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
ProductCode string
|
||||
}
|
||||
|
||||
type SimpleRoadInfo struct {
|
||||
ProductCode string `json:"productCode"`
|
||||
RoadName string `json:"roadName"`
|
||||
}
|
||||
|
||||
const ROAD_INFO = "road_info"
|
||||
@@ -160,3 +157,15 @@ func DeleteRoadByRoadUid(roadUid string) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func GetRoadByProductCode(productCode string) RoadInfo {
|
||||
o := orm.NewOrm()
|
||||
var roadInfo RoadInfo
|
||||
err := o.QueryTable(ROAD_INFO).Exclude("status", "delete").
|
||||
Filter("product_code", productCode).
|
||||
One(&roadInfo)
|
||||
if err != nil {
|
||||
logs.Error("get road info by name fail: ", err)
|
||||
}
|
||||
return roadInfo
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ func init() {
|
||||
beego.Router("/user_info/submitTotp", &controllers.UserInfo{}, "*:SaveTotp")
|
||||
beego.Router("/user_info/resetTotp", &controllers.UserInfo{}, "*:ResetTotp")
|
||||
beego.Router("/userInfo/queryAllowedMM", &controllers.UserInfo{}, "*:QueryAllowedMM")
|
||||
beego.Router("/userInfo/queryAllowedRoad", &controllers.UserInfo{}, "*:QueryAllowedRoad")
|
||||
|
||||
beego.Router("/withdraw/show_ui", &controllers.Withdraw{}, "*:ShowWithdrawUI")
|
||||
beego.Router("/withdraw/balance", &controllers.Withdraw{}, "*:UserBalance")
|
||||
|
||||
@@ -3,18 +3,19 @@ package service
|
||||
import (
|
||||
"encoding/json"
|
||||
"merchant/models/merchant"
|
||||
"merchant/models/road"
|
||||
)
|
||||
|
||||
// QueryAllowedDeployInfoMM 获取指定商户的允许面额信息
|
||||
func QueryAllowedDeployInfoMM(merchantUid, payType string) []merchant.ProfitMargin {
|
||||
var resInfo []merchant.ProfitMargin
|
||||
func QueryAllowedDeployInfoMM(merchantUid, roadUid string) []merchant.ProfitMargin {
|
||||
resInfo := make([]merchant.ProfitMargin, 0)
|
||||
merchantInfoList := merchant.GetMerchantDeployByUid(merchantUid)
|
||||
if len(merchantInfoList) == 0 {
|
||||
return resInfo
|
||||
}
|
||||
|
||||
for _, info := range merchantInfoList {
|
||||
if info.PayType == payType {
|
||||
if info.SingleRoadUid == roadUid {
|
||||
err := json.Unmarshal([]byte(info.SingleRoadPlatformRate), &resInfo)
|
||||
if err != nil {
|
||||
break
|
||||
@@ -23,3 +24,28 @@ func QueryAllowedDeployInfoMM(merchantUid, payType string) []merchant.ProfitMarg
|
||||
}
|
||||
return resInfo
|
||||
}
|
||||
|
||||
// QueryAllowedRoad 获取商户允许通道信息
|
||||
func QueryAllowedRoad(merchantUid string) []road.SimpleRoadInfo {
|
||||
var resInfo []road.SimpleRoadInfo
|
||||
merchantInfoList := merchant.GetMerchantDeployByUid(merchantUid)
|
||||
if len(merchantInfoList) == 0 {
|
||||
return resInfo
|
||||
}
|
||||
|
||||
//创建列表
|
||||
var roadIdList []string
|
||||
for _, info := range merchantInfoList {
|
||||
roadIdList = append(roadIdList, info.SingleRoadUid)
|
||||
}
|
||||
|
||||
roadInfoList := road.GetRoadInfosByRoadUids(roadIdList)
|
||||
|
||||
for _, info := range roadInfoList {
|
||||
resInfo = append(resInfo, road.SimpleRoadInfo{
|
||||
ProductCode: info.ProductCode,
|
||||
RoadName: info.RoadName,
|
||||
})
|
||||
}
|
||||
return resInfo
|
||||
}
|
||||
|
||||
@@ -71,20 +71,36 @@
|
||||
<h2 class="no-margin-bottom">生成链接</h2>
|
||||
</div>
|
||||
</header>
|
||||
<section class="dashboard-counts ">
|
||||
<section class="dashboard-counts" style="margin-bottom: 2rem">
|
||||
<div class="container-fluid">
|
||||
<div class="row bg-white has-shadow">
|
||||
<div class="col-5 mm-select-label">
|
||||
<label>
|
||||
通道选择:
|
||||
<select name="mm-select-road" id="mm-select-road">
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-1 mm-select-label">
|
||||
<button type="button" class="btn btn-default" onclick="queryAllowedMM()">获取面额</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section class="dashboard-counts ">
|
||||
<div class="container-fluid">
|
||||
<div class="row bg-white has-shadow">
|
||||
<div class="col-3 mm-select-label">
|
||||
<label>
|
||||
面值选择:
|
||||
<select name="mm-select" id="mm-select">
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-2 gen-link">
|
||||
<div class="col-1 gen-link">
|
||||
<button type="button" class="btn btn-default" onclick="genLink()">生成链接</button>
|
||||
</div>
|
||||
<div class="col-2 gen-link">
|
||||
<div class="col-1 gen-link">
|
||||
<button type="button" class="btn btn-default" onclick="createOnNewTab()">在新页面打开
|
||||
</button>
|
||||
</div>
|
||||
@@ -115,12 +131,11 @@
|
||||
<script>
|
||||
let globalSelectedValue = [];
|
||||
|
||||
|
||||
function genLink() {
|
||||
const mm = $("#mm-select").val();
|
||||
const result = globalSelectedValue.filter((item) => item.showLabel === Number(mm));
|
||||
if (result.length !== 0) {
|
||||
$(".mm-iframe").attr("src", `${$("#payLink").val()}&showMM=${result[0].showLabel}`);
|
||||
$(".mm-iframe").attr("src", `${$("#payLink").val()}&productCode=${$("#mm-select-road").val()}&showMM=${result[0].showLabel}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,9 +149,13 @@
|
||||
}
|
||||
|
||||
// 获取可允许面值
|
||||
function getAllowedMM() {
|
||||
function queryAllowedMM() {
|
||||
$.ajax({
|
||||
url: "/userInfo/queryAllowedMM",
|
||||
dataType: "json",
|
||||
data: {
|
||||
"roadCode": $("#mm-select-road").val(),
|
||||
},
|
||||
method: "GET",
|
||||
success: (res) => {
|
||||
if (res.code !== 0) {
|
||||
@@ -150,6 +169,25 @@
|
||||
},
|
||||
})
|
||||
}
|
||||
getAllowedMM()
|
||||
|
||||
function queryAllowedRoad() {
|
||||
$.ajax({
|
||||
url: "/userInfo/queryAllowedRoad",
|
||||
method: "GET",
|
||||
success: (res) => {
|
||||
if (res.code !== 0) {
|
||||
alert(res.msg)
|
||||
} else {
|
||||
globalSelectedValue = res.data;
|
||||
for (let i = 0; i < res.data.length; i++) {
|
||||
console.log(res.data[i])
|
||||
$("#mm-select-road").append(`<option value="${res.data[i].productCode}">${res.data[i].roadName}</option>`)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
queryAllowedRoad()
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user