添加暂停命令
This commit is contained in:
33
.drone.yml
Normal file
33
.drone.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: ssh
|
||||
name: default
|
||||
|
||||
server:
|
||||
host: 121.37.253.228
|
||||
user: www
|
||||
password:
|
||||
from_secret: www_password
|
||||
|
||||
server:
|
||||
host: 121.37.253.228
|
||||
user: www
|
||||
password:
|
||||
from_secret: www_password
|
||||
|
||||
steps:
|
||||
- name: build docker compose
|
||||
commands:
|
||||
- echo hello world
|
||||
- docker compose -f docker-compose.yaml up -d --build
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
when:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- tag
|
||||
- promote
|
||||
- rollback
|
||||
1
Jenkinsfile
vendored
1
Jenkinsfile
vendored
@@ -10,6 +10,7 @@ pipeline {
|
||||
sh "docker ps -a --format '{{.ID}} {{.Names}}' | awk '{if (\$2 !~ /^1Panel-jenkins/) print \$1}' | xargs -r docker stop"
|
||||
sh 'docker compose -f docker-compose.yaml up -d --build'
|
||||
sh 'docker start \$(docker ps -a -q)'
|
||||
sh 'sleep 10'
|
||||
sh "docker restart \$(docker ps -a | grep kami_ | awk '{print \$1}')"
|
||||
echo 'Build success'
|
||||
} catch (err) {
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"shop/service"
|
||||
"shop/utils"
|
||||
"shop/utils/client"
|
||||
"strings"
|
||||
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
"github.com/beego/beego/v2/server/web"
|
||||
@@ -59,7 +60,7 @@ func (c *HomeAction) ShowHome() {
|
||||
c.Redirect("/error.html", 302)
|
||||
return
|
||||
}
|
||||
logs.Info("获取真实价格失败", resp, err)
|
||||
logs.Info("获取真实价格", resp, err)
|
||||
r, err := client.Unmarshal(resp)
|
||||
if err != nil {
|
||||
flash := web.NewFlash()
|
||||
@@ -85,7 +86,8 @@ func (c *HomeAction) ShowHome() {
|
||||
return
|
||||
}
|
||||
var profitMarginList []merchant_deploy.ProfitMargin
|
||||
err = utils.MapToStruct(r.Data.(map[string]interface{}), &profitMarginList)
|
||||
logs.Info(fmt.Sprintf("详细数据:%+v", r.Data))
|
||||
err = utils.MapToStruct(r.Data.([]interface{}), &profitMarginList)
|
||||
if err != nil || len(profitMarginList) == 0 {
|
||||
flash := web.NewFlash()
|
||||
logs.Error("获取真实价格失败", r.Data, err)
|
||||
@@ -94,36 +96,42 @@ func (c *HomeAction) ShowHome() {
|
||||
c.Redirect("/error.html", 302)
|
||||
return
|
||||
}
|
||||
logs.Info(fmt.Sprintf("转换后的数据:%+v", profitMarginList))
|
||||
//处理linkID
|
||||
for i, margin := range profitMarginList {
|
||||
profitMarginList[i].LinkID = url.QueryEscape(margin.LinkID)
|
||||
if strings.Contains(margin.LinkID, "?") {
|
||||
// 分离出?后面的内容
|
||||
linkIDList := strings.Split(margin.LinkID, "?")
|
||||
profitMarginList[i].LinkID = linkIDList[0] + url.QueryEscape(strings.Join(linkIDList[1:], "?"))
|
||||
}
|
||||
switch margin.PlatformLabel {
|
||||
case "淘宝":
|
||||
profitMarginList[i].Color = "--bs-orange"
|
||||
profitMarginList[i].PlatformLabel = "淘宝购买(70%推荐,好运提升70%)"
|
||||
if margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = url.QueryEscape(fmt.Sprintf("tbopen://m.taobao.com/tbopen/index.html?h5Url=https://h5.m.taobao.com/awp/core/detail.htm?id=%s", margin.LinkID))
|
||||
if !margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = "tbopen://" + url.QueryEscape(fmt.Sprintf("m.taobao.com/tbopen/index.html?h5Url=https://h5.m.taobao.com/awp/core/detail.htm?id=%s", margin.LinkID))
|
||||
}
|
||||
case "京东":
|
||||
profitMarginList[i].Color = "--bs-red"
|
||||
profitMarginList[i].PlatformLabel = "京东购买(99%推荐,好运提升100%)"
|
||||
if margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = url.QueryEscape(fmt.Sprintf("openapp.jdmobile://virtual?params={\"des\":\"m\",\"url\":\"%s?ad_od=share&utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=CopyURL\",\"category\":\"jump\"}", margin.LinkID))
|
||||
if !margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = "openapp.jdmobile://" + url.QueryEscape(fmt.Sprintf("virtual?params={\"des\":\"m\",\"url\":\"%s?ad_od=share&utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=CopyURL\",\"category\":\"jump\"}", margin.LinkID))
|
||||
}
|
||||
case "拼多多":
|
||||
profitMarginList[i].Color = "--bs-red"
|
||||
if margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = url.QueryEscape(fmt.Sprintf("pinduoduo://com.xunmeng.pinduoduo/https_detail.html?goods_id=%s", margin.LinkID))
|
||||
if !margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = "pinduoduo://" + url.QueryEscape(fmt.Sprintf("com.xunmeng.pinduoduo/https_detail.html?goods_id=%s", margin.LinkID))
|
||||
}
|
||||
case "抖音":
|
||||
profitMarginList[i].Color = "--bs-black"
|
||||
if margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = url.QueryEscape(fmt.Sprintf("snssdk1128://ec_goods_detail?promotion_id=%s", margin.LinkID))
|
||||
if !margin.IsLinkSingle {
|
||||
profitMarginList[i].LinkID = "snssdk1128://" + url.QueryEscape(fmt.Sprintf("ec_goods_detail?promotion_id=%s", margin.LinkID))
|
||||
}
|
||||
default:
|
||||
profitMarginList[i].Color = "--bs-info"
|
||||
}
|
||||
}
|
||||
logs.Info("兑换信息%+v", profitMarginList)
|
||||
//数据回显
|
||||
c.Data["siteName"] = siteName
|
||||
c.Data["pname"] = productName
|
||||
@@ -229,6 +237,7 @@ func (c *HomeAction) ShowHome() {
|
||||
c.Redirect("/error.html", 302)
|
||||
return
|
||||
}
|
||||
logs.Info(fmt.Sprintf("请求数据%+v", requestOrder))
|
||||
requestSign := utils.GetMD5SignMF(requestOrder.ToStrMap(), merchantInfo.MerchantSecret)
|
||||
requestOrder.Sign = requestSign
|
||||
//创建订单
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package merchant_deploy
|
||||
|
||||
import "html/template"
|
||||
|
||||
type ProfitMargin struct {
|
||||
FactLabel float64 `json:"factLabel" description:"实际面值"`
|
||||
ShowLabel float64 `json:"showLabel" description:"展示面额"`
|
||||
PlatformLabel string `json:"platformLabel" description:"平台"`
|
||||
IsLinkSingle bool `json:"isLinkSingle" description:"链接是否单独放置"`
|
||||
LinkID string `json:"linkID" description:"链接"`
|
||||
Color string `json:"color" description:"颜色"`
|
||||
FactLabel float64 `json:"factLabel" description:"实际面值"`
|
||||
ShowLabel float64 `json:"showLabel" description:"展示面额"`
|
||||
PlatformLabel string `json:"platformLabel" description:"平台"`
|
||||
IsLinkSingle bool `json:"isLinkSingle" description:"链接是否单独放置"`
|
||||
LinkID string `json:"linkID" description:"链接"`
|
||||
Color template.CSS `json:"color" description:"颜色"`
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package utils
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
func MapToStruct(m map[string]interface{}, dest interface{}) error {
|
||||
func MapToStruct(m []interface{}, dest interface{}) error {
|
||||
result, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
7
utils/type_test.go
Normal file
7
utils/type_test.go
Normal file
@@ -0,0 +1,7 @@
|
||||
package utils
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestMapToStruct(t *testing.T) {
|
||||
|
||||
}
|
||||
@@ -1,19 +1,21 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>错误页面</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<p>{{.error}}</p>
|
||||
<button onclick="backToOrigin()">
|
||||
返回原地址
|
||||
</button>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<p>{{.error}}</p>
|
||||
<button onclick="backToOrigin()">
|
||||
返回原地址
|
||||
</button>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
<script>
|
||||
function backToOrigin() {
|
||||
const returnUrl = "{{.returnUrl}}";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title>{{.siteName}}</title>
|
||||
@@ -8,70 +9,71 @@
|
||||
<script src="../static/js/bootstrap.bundle.min.js"></script>
|
||||
<link href="../static/css/cashier.css" rel="stylesheet">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="tastesdk-box">
|
||||
<div class="header bg-light border-4 pt-3 bt-2 border-warning border-bottom clearfix">
|
||||
<div class="title d-flex justify-content-center align-content-center">
|
||||
<img src="static/img/apple/logo.png" alt="" class="img-fluid" style="height: 60px; margin-right: 5px">
|
||||
<span>苹果礼品卡</span>
|
||||
<!-- <p class="text-end" style="font-size: 36px">-->
|
||||
<!-- <span style="width: 100%;">{{.siteName}}</span>-->
|
||||
<!-- </p>-->
|
||||
<div class="tastesdk-box">
|
||||
<div class="header bg-light border-4 pt-3 bt-2 border-warning border-bottom clearfix">
|
||||
<div class="title d-flex justify-content-center align-content-center">
|
||||
<img src="static/img/apple/logo.png" alt="" class="img-fluid" style="height: 60px; margin-right: 5px">
|
||||
<span>苹果礼品卡</span>
|
||||
<!-- <p class="text-end" style="font-size: 36px">-->
|
||||
<!-- <span style="width: 100%;">{{.siteName}}</span>-->
|
||||
<!-- </p>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main px-5 py-3 mx-4 ">
|
||||
<div class="text-center fs-1">
|
||||
¥<span class="text-danger fw-bolder mmValue" style="font-size: 84px">{{.mmValue}}</span>
|
||||
</div>
|
||||
<div class="pay-jd mb-4">
|
||||
<div class="two-step" style="font-size: 36px">
|
||||
<div>
|
||||
<p class="text-success">
|
||||
请您在提交订单后<strong class="text-danger">24小时</strong>内完成支付,否则订单会自动取消。
|
||||
</p>
|
||||
</div>
|
||||
<div class="my-5" hidden>
|
||||
<div class="mr-3">
|
||||
商品名称:{{.pname}}
|
||||
<div class="main px-5 py-3 mx-4 ">
|
||||
<div class="text-center fs-1">
|
||||
¥<span class="text-danger fw-bolder mmValue" style="font-size: 84px">{{.mmValue}}</span>
|
||||
</div>
|
||||
<div class="pay-jd mb-4">
|
||||
<div class="two-step" style="font-size: 36px">
|
||||
<div>
|
||||
<p class="text-success">
|
||||
请您在提交订单后<strong class="text-danger">24小时</strong>内完成支付,否则订单会自动取消。
|
||||
</p>
|
||||
</div>
|
||||
<div class="ml-2">
|
||||
订单编号:{{.orderNo}}
|
||||
<div class="my-5" hidden>
|
||||
<div class="mr-3">
|
||||
商品名称:{{.pname}}
|
||||
</div>
|
||||
<div class="ml-2">
|
||||
订单编号:{{.orderNo}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
{{range.Persons}}
|
||||
<button class="btn btn-primary mt-2" onclick="openExternalLink('{{.LinkID}}')"
|
||||
<div>
|
||||
{{range.profitMarginList}}
|
||||
<button class="btn btn-primary mt-2" onclick="openExternalLink('{{.LinkID}}')"
|
||||
style="background: var({{.Color}}); width: 100%; color: white; font-size: 36px; height: 80px; margin: 0">
|
||||
{{.PlatformLabel}}
|
||||
</button>
|
||||
{{ end }}
|
||||
<!-- <button class="btn btn-primary mt-2" onclick="openAlipay()"-->
|
||||
<!-- style="width: 100%; color: white; font-size: 36px;height: 80px">-->
|
||||
<!-- 打开支付宝购买卡密-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
<form action="/pay.html" method="post" autocomplete="off">
|
||||
<input type="text" style="display: none" name="productCode" value="{{.productCode}}">
|
||||
<input type="text" style="display: none" name="notifyUrl" value="{{.notifyUrl}}">
|
||||
<input type="text" style="display: none" name="orderId" value="{{.orderNo}}">
|
||||
<input type="text" style="display: none" name="sign" value="{{.sign}}">
|
||||
<input type="text" style="display: none" name="returnUrl" value="{{.returnUrl}}">
|
||||
<div class="border border-3 rounded px-3 py-2 mt-4 rounded-4 bg-light">
|
||||
<div class="my-2 row g-3">
|
||||
<div class="col-12 mb-3" hidden>
|
||||
<label class="form-label">面值:
|
||||
<input class="form-control" type="text" id="factMMValue" name="factMMValue"
|
||||
style="font-size: 36px" value="{{.mmValue}}" required>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-12 mb-3" hidden>
|
||||
<label class="form-label" for="recoveryType">回收类型:</label>
|
||||
<select name="recoveryType" class="form-select" id="recoveryType"
|
||||
{{.PlatformLabel}}
|
||||
</button>
|
||||
{{ end }}
|
||||
<!-- <button class="btn btn-primary mt-2" onclick="openAlipay()"-->
|
||||
<!-- style="width: 100%; color: white; font-size: 36px;height: 80px">-->
|
||||
<!-- 打开支付宝购买卡密-->
|
||||
<!-- </button>-->
|
||||
</div>
|
||||
<form action="/pay.html" method="post" autocomplete="off">
|
||||
<input type="text" style="display: none" name="productCode" value="{{.productCode}}">
|
||||
<input type="text" style="display: none" name="notifyUrl" value="{{.notifyUrl}}">
|
||||
<input type="text" style="display: none" name="orderId" value="{{.orderNo}}">
|
||||
<input type="text" style="display: none" name="sign" value="{{.sign}}">
|
||||
<input type="text" style="display: none" name="returnUrl" value="{{.returnUrl}}">
|
||||
<div class="border border-3 rounded px-3 py-2 mt-4 rounded-4 bg-light">
|
||||
<div class="my-2 row g-3">
|
||||
<div class="col-12 mb-3" hidden>
|
||||
<label class="form-label">面值:
|
||||
<input class="form-control" type="text" id="factMMValue" name="factMMValue"
|
||||
style="font-size: 36px" value="{{.mmValue}}" required>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-12 mb-3" hidden>
|
||||
<label class="form-label" for="recoveryType">回收类型:</label>
|
||||
<select name="recoveryType" class="form-select" id="recoveryType"
|
||||
style="font-size: 36px">
|
||||
<option value="2" selected>卡密</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="col-12 mb-3">
|
||||
<option value="2" selected>卡密</option>
|
||||
</select>
|
||||
</div>
|
||||
<!-- <div class="col-12 mb-3">
|
||||
<label class="form-label" for="chard">卡号:</label>
|
||||
<input class="form-control" type="text" id="card_no" name="cardNo"
|
||||
style="font-size: 36px" required>
|
||||
@@ -79,60 +81,60 @@
|
||||
<div class="col-12 mb-3 text-center">
|
||||
卡号格式:GCA3238734750243
|
||||
</div> -->
|
||||
<div class="col-12 mb-3">
|
||||
<label class="form-label" for="chard">卡密:</label>
|
||||
<input class="form-control" type="text" id="chard" name="chard" style="font-size: 36px"
|
||||
required>
|
||||
</div>
|
||||
<div class="col-12 mb-3 text-center">
|
||||
卡密格式:X7VJW56YTE98WGF4
|
||||
<div class="col-12 mb-3">
|
||||
<label class="form-label" for="chard">卡密:</label>
|
||||
<input class="form-control" type="text" id="chard" name="chard"
|
||||
style="font-size: 36px" required>
|
||||
</div>
|
||||
<div class="col-12 mb-3 text-center">
|
||||
卡密格式:X7VJW56YTE98WGF4
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operate-record px-3 py-2 fs-2 mt-4">
|
||||
<p>操作步骤:</p>
|
||||
<p>1. 注意商家要求【提前确认收货】的都【无法使用】!!</p>
|
||||
<p>2.京东显示没货,可以打开京东备用或在平台搜索App Store自行购买</p>
|
||||
<p>3. 核对清楚卡片面值,如面值不符无法上分</p>
|
||||
<p>4.自己绑定卡密提交无法上分!不要点击平台内的一键兑换!</p>
|
||||
<p>请在指定链接中购买苹果(Apple)充值卡</p>
|
||||
<p>付款成功后点击订单详情</p>
|
||||
<p>点击查看卡密,正确输入卡密密码,一定点击确认提交!</p>
|
||||
<p class="text-danger fw-bolder">注意:若不按照操作步骤导致订单无法核实需要您个人承担损失!!!</p>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<button type="submit" class="btn btn-primary w-100" style="font-size: 40px; height: 100px">
|
||||
点击此处提交卡密
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="operate-record px-3 py-2 fs-2 mt-4">
|
||||
<p>操作步骤:</p>
|
||||
<p>1. 注意商家要求【提前确认收货】的都【无法使用】!!</p>
|
||||
<p>2.京东显示没货,可以打开京东备用或在平台搜索App Store自行购买</p>
|
||||
<p>3. 核对清楚卡片面值,如面值不符无法上分</p>
|
||||
<p>4.自己绑定卡密提交无法上分!不要点击平台内的一键兑换!</p>
|
||||
<p>请在指定链接中购买苹果(Apple)充值卡</p>
|
||||
<p>付款成功后点击订单详情</p>
|
||||
<p>点击查看卡密,正确输入卡密密码,一定点击确认提交!</p>
|
||||
<p class="text-danger fw-bolder">注意:若不按照操作步骤导致订单无法核实需要您个人承担损失!!!</p>
|
||||
</div>
|
||||
<div class="mt-5">
|
||||
<button type="submit" class="btn btn-primary w-100" style="font-size: 40px; height: 100px">
|
||||
点击此处提交卡密
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal fade fs-1" id="exampleModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-dialog-centered" style="min-width: 80vw">
|
||||
<div class="modal-content px-4 py-4">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title">信息</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h1 class="text-center py-3 fs-1 fw-bolder">使用帮助</h1>
|
||||
<p>1.<strong class="text-primary">此卡为苹果(Apple)充值卡</strong></p>
|
||||
<p>2. 京东显示没货,可以打开京东备用或在平台搜索App Store自行购买</p>
|
||||
<p>3.核对清楚卡片面值,如面值不符无法上分</p>
|
||||
<p>4.自己绑定卡密提交无法上分!不要点击平台内的一键兑换!</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal"
|
||||
<div class="modal fade fs-1" id="exampleModal" tabindex="-1">
|
||||
<div class="modal-dialog modal-dialog-centered" style="min-width: 80vw">
|
||||
<div class="modal-content px-4 py-4">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title">信息</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<h1 class="text-center py-3 fs-1 fw-bolder">使用帮助</h1>
|
||||
<p>1.<strong class="text-primary">此卡为苹果(Apple)充值卡</strong></p>
|
||||
<p>2. 京东显示没货,可以打开京东备用或在平台搜索App Store自行购买</p>
|
||||
<p>3.核对清楚卡片面值,如面值不符无法上分</p>
|
||||
<p>4.自己绑定卡密提交无法上分!不要点击平台内的一键兑换!</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" data-bs-dismiss="modal"
|
||||
style="height: 80px; font-size: 40px">
|
||||
别绑定!我已知晓
|
||||
</button>
|
||||
别绑定!我已知晓
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="../static/js/base.js"></script>
|
||||
@@ -184,7 +186,8 @@
|
||||
// }
|
||||
|
||||
let m = document.getElementById("exampleModal");
|
||||
const myModal = new bootstrap.Modal(m, {keyboard: false});
|
||||
const myModal = new bootstrap.Modal(m, { keyboard: false });
|
||||
myModal.show();
|
||||
</script>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user