Compare commits

..

No commits in common. "55e079b0e6a40cd194581b07862db171ef4af3c1" and "3d67fbbb6265571b3f828edfb5bb7497d137c2e7" have entirely different histories.

294 changed files with 4198 additions and 11689 deletions

View File

@ -1,6 +1,7 @@
package constants
const INVOICE_TEMPLATE_01 = `
// 发票主体页面
const MAIN_INVOICE_HTML = `
<!DOCTYPE html>
<html lang="en">
@ -10,38 +11,17 @@ const INVOICE_TEMPLATE_01 = `
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Invoice</title>
<style>
@font-face {
font-family: "Montserrat-SemiBold";
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/b808164b4f7ecc19f560d235db5b1f5b99fe8ab218b606f15debab2b9c4230e2");
}
@font-face {
font-family: "Montserrat-Medium";
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/3d91bbd91ba6fac26b8460a078742b61bfd1e2976311c065f8ac9c5270be6901");
}
@font-face {
font-family: "Montserrat-Light";
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/24e580a4a5afebf94596ec7b6c8d9c8d57f75a5429ee757217da552d5f03e5d1");
}
@font-face {
font-family: "Montserrat-Regular";
src: url("https://s3.us-west-1.amazonaws.com/storage.fusenpack.com/78072d2cbce0a3f88c01ab2830ba3a453f0968b516388e45e9a6fb5e970450b8");
}
body {
margin: 0;
}
.header_warp {
background-color: #F8F8FA;
padding: 40px 5% 40px 6%;
padding: 20px 5% 20px 6%;
}
.header_td {
width: 50%;
font-family: Montserrat-SemiBold;
}
.header_td.logo {
@ -49,33 +29,31 @@ const INVOICE_TEMPLATE_01 = `
}
.header_logo {
max-height: 30px;
max-height: 15px;
max-width: 100%;
margin-top: 10px;
margin-top: 5px;
}
.header_td.title {
color: #212121;
font-weight: 600;
font-size: 72px;
font-size: 36px;
}
.information_warp {
padding: 60px 5% 60px 6%;
padding: 30px 5% 30px 6%;
}
.information_td {
width: 50%;
font-size: 26px;
line-height: 39px;
font-size: 13px;
line-height: 20px;
font-weight: 300;
font-family: Montserrat-Light;
}
.information_td.bill {
color: #212121;
font-weight: 500;
font-family: Montserrat-Medium;
}
.information_td.right {
@ -84,7 +62,7 @@ const INVOICE_TEMPLATE_01 = `
.information_td.info {
color: #666666;
line-height: 34px;
line-height: 17px;
}
.bill_warp {
@ -92,7 +70,7 @@ const INVOICE_TEMPLATE_01 = `
}
.bill_td {
font-size: 26px;
font-size: 13px;
}
.bill_td:first-child {
@ -100,23 +78,17 @@ const INVOICE_TEMPLATE_01 = `
}
.bill_td.title {
border-top: 4px solid #333;
padding: 26px 0 14px;
border-top: 2px solid #333;
padding: 13px 0 7px;
font-weight: 500;
color: #212121;
font-family: Montserrat-Medium;
}
.bill_td.info {
color: #666;
border-bottom: 2px solid #ccc;
padding: 16px 0;
border-bottom: 1px solid #ccc;
padding: 8px 0;
font-weight: 400;
font-family: Montserrat-Light;
}
.bill_td.info:first-child {
font-family: Montserrat-Regular;
}
.bill_warp tr:last-child .bill_td.info {
@ -124,37 +96,34 @@ const INVOICE_TEMPLATE_01 = `
}
.total_warp {
padding: 28px 5% 48px 0;
padding: 14px 5% 24px 0;
}
.total_td {
color: #212121;
padding: 16px 0 14px;
font-size: 24px;
padding: 8px 0 7px;
font-size: 12px;
font-weight: 500;
font-family: Montserrat-Medium;
}
.total_td.info {
color: #666;
font-weight: 400;
font-family: Montserrat-Regular;
}
.total_td.border-dashed {
border-bottom: 2px dashed #ccc;
border-bottom: 1px dashed #ccc;
}
.total_td.border-solid {
border-bottom: 4px solid #333;
padding-bottom: 24px;
border-bottom: 2px solid #333;
padding-bottom: 12px;
}
.total_td.total {
padding-top: 24px;
font-size: 26px;
padding-top: 12px;
font-size: 13px;
font-weight: 600;
font-family: Montserrat-SemiBold;
}
.notes_warp {
@ -162,18 +131,16 @@ const INVOICE_TEMPLATE_01 = `
}
.notes_td {
font-size: 26px;
font-size: 13px;
color: #666;
font-weight: 300;
width: 50%;
line-height: 42px;
font-family: Montserrat-Light;
line-height: 21px;
}
.notes_td.title {
color: #212121;
font-weight: 500;
font-family: Montserrat-Medium;
}
.notes_td.notes {
@ -183,119 +150,95 @@ const INVOICE_TEMPLATE_01 = `
</head>
<body>
<!-- header -->
<table class="header_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="header_td logo" align="left">
<img class="header_logo" src="https://fusenapi.kayue.cn:8010/storage/email/logo.png" alt="logo">
</td>
<td class="header_td title" align="right">Invoice</td>
</tr>
</table>
`
const INVOICE_TEMPLATE_02 = `
<!-- information -->
<table class="information_warp width100" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="information_td bill" align="left">Bill To:</td>
<td class="information_td right" align="right">Invoice No. #%v</td>
</tr>
<tr>
<td class="information_td info" align="left">%v</td>
<td class="information_td right" align="right">Date: %v</td>
</tr>
<tr>
<td class="information_td info" align="left">%v</td>
<td class="information_td" align="right"></td>
</tr>
<tr>
<td class="information_td info" align="left">%v</td>
<td class="information_td" align="right"></td>
</tr>
<tr>
<td class="information_td info" align="left">%v</td>
<td class="information_td" align="right"></td>
</tr>
</table>
`
const INVOICE_TEMPLATE_03 = `
<!-- bill -->
<table class="bill_warp width100" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="bill_td title" align="left">Product Name</td>
<td class="bill_td title" align="right">Price</td>
<td class="bill_td title" align="right">Quantity</td>
<td class="bill_td title" align="right">Total</td>
</tr>
%v
</table>
`
const INVOICE_TEMPLATE_0301 = `
<!-- header -->
<table class="header_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="bill_td info" align="left">%v</td>
<td class="bill_td info" align="right">%v</td>
<td class="bill_td info" align="right">%v %v</td>
<td class="bill_td info" align="right">%v</td>
<td class="header_td logo" align="left">
<img class="header_logo" src="https://fusenapi.kayue.cn:8010/storage/email/logo.png" alt="logo">
</td>
<td class="header_td title" align="right">Invoice</td>
</tr>
`
const INVOICE_TEMPLATE_04 = `
<!-- total -->
<table class="total_warp width50" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td class="total_td" align="right">Subtotal</td>
<td class="total_td info" align="right">%v</td>
</tr>
<tr>
<td class="total_td" align="right">Shipping Fee</td>
<td class="total_td info" align="right">Free</td>
</tr>
<tr>
<td class="total_td border-dashed" align="right">Tax</td>
<td class="total_td info border-dashed" align="right">%v</td>
</tr>
<tr>
<td class="total_td" align="right">Total</td>
<td class="total_td info" align="right">%v</td>
</tr>
<tr>
<td class="total_td border-solid" align="right">%v</td>
<td class="total_td info border-solid" align="right">%v</td>
</tr>
<tr>
<td class="total_td total" align="right">%v</td>
<td class="total_td total" align="right">%v</td>
</tr>
</table>
`
const INVOICE_TEMPLATE_05 = `
<!-- notes -->
<table class="notes_warp width100" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="notes_td title" align="left">Payment Method:</td>
<td class="notes_td title" align="left">Notes:</td>
</tr>
<tr>
<td class="notes_td" align="left">%v</td>
<td class="notes_td notes" align="left" rowspan="2">Thank you for your business !</td>
</tr>
<tr>
<td class="notes_td" align="left">Account No. :%v</td>
</tr>
</table>
`
const INVOICE_TEMPLATE_06 = `
</table>
<!-- information -->
<table class="information_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="information_td bill" align="left">Bill To:</td>
<td class="information_td right" align="right">Invoice No. {{invoice_number}}</td>
</tr>
<tr>
<td class="information_td info" align="left">{{buyer_name}}</td>
<td class="information_td right" align="right">Date: {{buy_date}}</td>
</tr>
<tr>
<td class="information_td info" align="left">{{street}}</td>
<td class="information_td" align="right"></td>
</tr>
<tr>
<td class="information_td info" align="left">{{city}}</td>
<td class="information_td" align="right"></td>
</tr>
<tr>
<td class="information_td info" align="left">{{country}}</td>
<td class="information_td" align="right"></td>
</tr>
</table>
<!-- bill -->
<table class="bill_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
<!--循环部分-->
{{product_loop_html}}
<!--循环部分-->
</table>
<!-- total -->
<table class="total_warp" border="0" align="right" cellpadding="0" cellspacing="0" width="50%">
<tr>
<td class="total_td" align="right">Subtotal</td>
<td class="total_td info" align="right">${{subtotal_price}}</td>
</tr>
<tr>
<td class="total_td" align="right">Shipping Fee</td>
<td class="total_td info" align="right">Free</td>
</tr>
<tr>
<td class="total_td border-dashed" align="right">Tax</td>
<td class="total_td info border-dashed" align="right">${{tax}}</td>
</tr>
<tr>
<td class="total_td" align="right">Total</td>
<td class="total_td info" align="right">${{total_price}}</td>
</tr>
<tr>
<td class="total_td border-solid" align="right">Deposit Requested</td>
<td class="total_td info border-solid" align="right">${{deposit_price}}</td>
</tr>
<tr>
<td class="total_td total" align="right">Deposit Due</td>
<td class="total_td total" align="right">${{deposit_price}}</td>
</tr>
</table>
<!-- notes -->
<table class="notes_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="notes_td title" align="left">Payment Method:</td>
<td class="notes_td title" align="left">Notes:</td>
</tr>
<tr>
<td class="notes_td" align="left">{{payment_method}}</td>
<td class="notes_td notes" align="left" rowspan="2">{{notes}}</td>
</tr>
<tr>
<td class="notes_td" align="left">Account No. {{account_number}}</td>
</tr>
</table>
</body>
<style>
.width50 {
width: 50%;
}
.width100 {
width: 100%;
}
</style>
</html>
`
// 产品循环部分{{product_loop_html}}
const PRODUCT_LOOP_HTML_CONTENT = ` <tr>
<td class="bill_td title" align="left">{{product_name}}</td>
<td class="bill_td title" align="right">${{product_item_price}}</td>
<td class="bill_td title" align="right">{{purchase_quantity}}</td>
<td class="bill_td title" align="right">${{product_total_price}}</td>
</tr>`

View File

@ -10,7 +10,7 @@ const (
type Currency string
const (
CURRENCYUSD Currency = "usd" // 美金
CURRENCYUSD Currency = "usd"
)
// 金额单位
@ -23,8 +23,8 @@ type ExchangeRateUnit interface{}
type PayMethods string
const (
PAY_METHOD_CARD PayMethods = "CARD" //card
PAY_METHOD_VISA PayMethods = "VISA" //visa
PAY_METHOD_CARD PayMethods = "CARD"
PAY_METHOD_VISA PayMethods = "VISA"
)
// 支付状态
@ -45,11 +45,11 @@ type OrderPayStatusCode int64
// 30,已付尾款
// 40,已退尾款
const (
ORDER_PAY_STATUS_UNPAIDDEPOSIT OrderPayStatusCode = 0 // 0,未付首款
ORDER_PAY_STATUS_PAIDDEPOSIT OrderPayStatusCode = 10 // 10,已付首款
ORDER_PAY_STATUS_REFUNDEDDEPOSIT OrderPayStatusCode = 20 // 20,已退首款
ORDER_PAY_STATUS_PAIDDREMAINING OrderPayStatusCode = 30 // 30,已付尾款
ORDER_PAY_STATUS_REFUNDEDREMAINING OrderPayStatusCode = 40 // 40,已退尾款
ORDER_PAY_STATUS_UNPAIDDEPOSIT OrderPayStatusCode = 0
ORDER_PAY_STATUS_PAIDDEPOSIT OrderPayStatusCode = 10
ORDER_PAY_STATUS_REFUNDEDDEPOSIT OrderPayStatusCode = 20
ORDER_PAY_STATUS_PAIDDREMAINING OrderPayStatusCode = 30
ORDER_PAY_STATUS_REFUNDEDREMAINING OrderPayStatusCode = 40
)
// 订单状态
@ -92,27 +92,20 @@ var OrderStatusUserDIRECTMAIL []OrderStatusCode
// 订单状态--用户可见--云仓
var OrderStatusUserCLOUDSTORE []OrderStatusCode
// 订单货币
var OrderCurrencyMessage map[Currency]string
func init() {
// 订单货币
OrderCurrencyMessage = make(map[Currency]string, 1)
OrderCurrencyMessage[CURRENCYUSD] = "$"
// 订单状态名称
OrderPayStatusMessage = make(map[OrderPayStatusCode]string)
OrderPayStatusMessage[ORDER_PAY_STATUS_UNPAIDDEPOSIT] = "Deposit Payment Unpaid" // 未支付首款
OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDEPOSIT] = "Deposit Payment Paid" // 已支付首款
OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDDEPOSIT] = "Deposit Payment Refunded" // 首款已回退
OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDREMAINING] = "Final Payment Paid" // 尾款未支付
OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDREMAINING] = "Final Payment Refunded" // 已退款
OrderPayStatusMessage[ORDER_PAY_STATUS_UNPAIDDEPOSIT] = "Deposit Payment Unpaid"
OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDEPOSIT] = "Deposit Payment Paid"
OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDDEPOSIT] = "Deposit Payment Refunded"
OrderPayStatusMessage[ORDER_PAY_STATUS_PAIDDREMAINING] = "Final Payment Paid"
OrderPayStatusMessage[ORDER_PAY_STATUS_REFUNDEDREMAINING] = "Final Payment Refunded"
// 订单状态名称
PayStatusMessage = make(map[PayStatusCode]string)
PayStatusMessage[PAY_STATUS_UNPAID] = "Unpaid" // 未支付
PayStatusMessage[PAY_STATUS_PAID] = "Paid" // 已支付
PayStatusMessage[PAY_STATUS_REFUNDED] = "Refunded" // 已退款
PayStatusMessage[PAY_STATUS_UNPAID] = "Unpaid"
PayStatusMessage[PAY_STATUS_PAID] = "Paid"
PayStatusMessage[PAY_STATUS_REFUNDED] = "Refunded"
// 订单状态名称
OrderStatusMessage = make(map[OrderStatusCode]string)
@ -121,14 +114,14 @@ func init() {
OrderStatusMessage[ORDER_STATUS_COMPLETE] = "Completed" // 已完成
OrderStatusMessage[ORDER_STATUS_DELETE] = "Deleted" // 已删除
OrderStatusMessage[ORDER_STATUS_DIRECTMAIL_ORDERED] = "Ordered" // 直邮单--已下单
OrderStatusMessage[ORDER_STATUS_DIRECTMAIL_ORDERED] = "Order" // 直邮单--已下单
OrderStatusMessage[ORDER_STATUS_DIRECTMAIL_ORDEREDMAINING] = "Final Payment Paid" // 直邮单--已下单--尾款
OrderStatusMessage[ORDER_STATUS_DIRECTMAIL_STARTPRODUCTION] = "Start Production" // 直邮单--开始生产
OrderStatusMessage[ORDER_STATUS_DIRECTMAIL_COMPLETEPRODUCTION] = "Production Complete" // 直邮单--生产完成
OrderStatusMessage[ORDER_STATUS_DIRECTMAIL_SHIPPED] = "Shipped" // 直邮单--已发货
OrderStatusMessage[ORDER_STATUS_DIRECTMAIL_ARRIVED] = "Delivered" // 直邮单--已到达
OrderStatusMessage[ORDER_STATUS_CLOUDSTORE_ORDERED] = "Ordered" // 云仓单--已下单
OrderStatusMessage[ORDER_STATUS_CLOUDSTORE_ORDERED] = "Order" // 云仓单--已下单
OrderStatusMessage[ORDER_STATUS_CLOUDSTORE_ORDEREDMAINING] = "Final Payment Paid" // 云仓单--已下单-尾款
OrderStatusMessage[ORDER_STATUS_CLOUDSTORE_STARTPRODUCTION] = "Start Production" // 云仓单--开始生产
OrderStatusMessage[ORDER_STATUS_CLOUDSTORE_COMPLETEPRODUCTION] = "Production Complete" // 云仓单--生产完成

View File

@ -21,12 +21,11 @@ const (
// websocket消息类型(云渲染类别)
const (
WEBSOCKET_RENDER_IMAGE Websocket = "WEBSOCKET_RENDER_IMAGE" //图片渲染消息(1级消息双向通信)
WEBSOCKET_RENDER_IMAGE_ERR Websocket = "WEBSOCKET_RENDER_IMAGE_ERR" //图片渲染失败消息1级消息单向通信
WEBSOCKET_COMBINE_IMAGE Websocket = "WEBSOCKET_COMBINE_IMAGE" //反回合成刀版图消息2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
WEBSOCKET_ASSEMBLE_RENDER_DATA Websocket = "WEBSOCKET_ASSEMBLE_RENDER_DATA" //组装unity需要的数据 2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
WEBSOCKET_SEND_DATA_TO_UNITY Websocket = "WEBSOCKET_SEND_DATA_TO_UNITY" //发送到unity进行渲染 2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
WEBSOCKET_REQUIRE_BROWSER_RESEND_RENDER Websocket = "WEBSOCKET_REQUIRE_BROWSER_RESEND_RENDER" //后端请求前端去重发渲染任务事件2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
WEBSOCKET_RENDER_IMAGE Websocket = "WEBSOCKET_RENDER_IMAGE" //图片渲染消息(1级消息双向通信)
WEBSOCKET_RENDER_IMAGE_ERR Websocket = "WEBSOCKET_RENDER_IMAGE_ERR" //图片渲染失败消息1级消息单向通信
WEBSOCKET_COMBINE_IMAGE Websocket = "WEBSOCKET_COMBINE_IMAGE" //反回合成刀版图消息2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
WEBSOCKET_ASSEMBLE_RENDER_DATA Websocket = "WEBSOCKET_ASSEMBLE_RENDER_DATA" //组装unity需要的数据 2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
WEBSOCKET_SEND_DATA_TO_UNITY Websocket = "WEBSOCKET_SEND_DATA_TO_UNITY" //发送到unity进行渲染 2级消息单向通信属于 WEBSOCKET_RENDER_IMAGE 消息的子流程)
)
// websocket消息类型系统数据变更通知

View File

@ -1,116 +0,0 @@
Subject: Please confirm your {{ .CompanyName }} account;
MIME-version: 1.0;
Content-Type: text/html; charset="UTF-8";
From: "Fusen Support";
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>订单状态流转</title>
</head>
<style>
* {
margin: 0;
padding: 0;
}
</style>
<body>
<div style="
width: 50%;
max-width: 600px;
min-width: 350px;
margin: 0 auto;
background-color: #FFFFFF;">
<div>
<h1><img style="
width: 22%;
height: 6%;
padding: 50px 0 30px 8%;" src="https://fusenstorage.s3.us-east-2.amazonaws.com/2c3938702c52d46550fffae344f1619dd71c447f3b19882045205fcd8adbd6bf" alt=""></h1>
</div>
<div>
<h2 style="
width: 84%;
font-size: 47px;
font-family: Gotham-Bold, Gotham;
font-weight: bold;
color: #212121;
line-height: 58px;
padding-bottom: 24px;
padding-left: 8%;">The status of your order has changed!</h2>
<p style="
width: 84%;
font-size: 14px;
font-weight: normal;
color: #212121;
line-height: 21px;
padding-bottom: 40px;
padding-left: 8%;">
Your order has been changed from "原状态" to "现状态".</p>
<a href="" style="
display: block;
text-align: center;
width: 80%;
height: 24px;
font-size: 16px;
font-family: Gotham-Bold, Gotham;
font-weight: bold;
color: #FFFFFF;
line-height: 24px;
margin: 0 auto;
background-color: #FF7F00;
padding: 15px 12px;
margin-bottom: 60px;
border-radius: 200px;
text-decoration: none;">Check Your Order</a>
</div>
<div>
<div style="
width: 80%;
background-color: #F8F8F8;
padding: 20px 30px;
margin: 0 auto;">
<h3 style="
height: 28px;
font-size: 16px;
font-family: Gotham-Bold, Gotham;
font-weight: bold;
color: #212121;
line-height: 28px;">Search Logo, Get Design</h3>
<p style=" height: 21px;
font-size: 12px;
font-family: Gotham-Medium, Gotham;
font-weight: 500;
color: #212121;
line-height: 21px;">Our products</p>
<p style=" height: 21px;
font-size: 12px;
font-family: Gotham-Medium, Gotham;
font-weight: 500;
color: #212121;
line-height: 21px;">Try it out</p>
<div style="
width: 100%;
padding: 17px 0 10px 0 ;
border-bottom: 1px solid #CCCCCC;
margin-bottom: 10px;">
<img style="width: 14px;height: 14px;" src="https://fusenstorage.s3.us-east-2.amazonaws.com/7d6e04f8a90762210f8b8fc307198776b8dc42998adc90bab41e178053552b2c" alt="">
<span> support@fusenpack.com</span>
</div>
<span style="
width: 74px;
height: 21px;
font-size: 12px;
font-weight: normal;
color: #999999;
line-height: 21px;
display: block;
cursor: pointer;
text-decoration: none;">Unsubscribe</span>
</div>
</div>
</div>
</body>
</html>

23
go.mod
View File

@ -5,21 +5,17 @@ go 1.20
require (
github.com/474420502/passer v0.0.1
github.com/SebastiaanKlippert/go-wkhtmltopdf v1.9.0
github.com/aliyun/aliyun-oss-go-sdk v3.0.1+incompatible
github.com/aws/aws-sdk-go v1.44.295
github.com/bwmarrin/snowflake v0.3.0
github.com/disintegration/imaging v1.6.2
github.com/go-ldap/ldap/v3 v3.4.6
github.com/go-resty/resty/v2 v2.7.0
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/uuid v1.3.1
github.com/google/uuid v1.3.0
github.com/gorilla/websocket v1.5.0
github.com/hashicorp/raft v1.5.0
github.com/lni/dragonboat/v4 v4.0.0-20230709075559-54497b9553be
github.com/mozillazg/go-pinyin v0.19.0
github.com/nacos-group/nacos-sdk-go/v2 v2.2.3
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/streadway/amqp v1.1.0
github.com/stripe/stripe-go/v75 v75.7.0
@ -33,8 +29,6 @@ require (
require (
cloud.google.com/go/compute v1.20.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/BurntSushi/toml v1.1.0 // indirect
github.com/DataDog/zstd v1.4.5 // indirect
github.com/HdrHistogram/hdrhistogram-go v1.1.2 // indirect
github.com/VictoriaMetrics/metrics v1.18.1 // indirect
@ -47,18 +41,17 @@ require (
github.com/cockroachdb/pebble v0.0.0-20221207173255-0f086d933dac // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/getsentry/sentry-go v0.12.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-immutable-radix v1.0.0 // indirect
github.com/hashicorp/go-msgpack v0.5.5 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-sockaddr v1.0.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/hashicorp/memberlist v0.3.1 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
@ -81,14 +74,14 @@ require (
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230728194245-b0cb94b80691 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/ini.v1 v1.66.2 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
)
@ -96,7 +89,7 @@ require (
github.com/474420502/requests v1.42.0
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/tidwall/gjson v1.13.0
github.com/tidwall/gjson v1.12.0
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
)
@ -136,8 +129,8 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/automaxprocs v1.5.2 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0
golang.org/x/sys v0.10.0 // indirect
golang.org/x/text v0.11.0
google.golang.org/genproto v0.0.0-20230530153820-e85fd2cbaebc // indirect
google.golang.org/grpc v1.56.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect

58
go.sum
View File

@ -41,11 +41,8 @@ github.com/474420502/random v0.4.1 h1:HUUyLXRWMijVb7CJoEC16f0aFQOW25Lkr80Mut6PoK
github.com/474420502/requests v1.42.0 h1:aUj0rWhfldbOOlGHDIcqT9zgXEoSlK4IBmRF3LxI1+Y=
github.com/474420502/requests v1.42.0/go.mod h1:2SCVzim0ONFYG09g/GrM7RTeJIC6qTyZfnohsjnG5C8=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 h1:mFRzDkZVAjdal+s7s0MwaRv9igoPqLRdzOLzw/8Xvq8=
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzSsl7ZWRAuOIE23GDNzjWuZquvFlgA8xmpunjU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/CloudyKit/fastprinter v0.0.0-20170127035650-74b38d55f37a/go.mod h1:EFZQ978U7x8IRnstaskI3IysnWY5Ao3QgZUKOXlsAdw=
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno=
@ -70,12 +67,8 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74 h1:Kk6a4nehpJ3UuJRqlA3JxYxBZEqCeOmATOvrbT4p9RA=
github.com/alexbrainman/sspi v0.0.0-20210105120005-909beea2cc74/go.mod h1:cEWa1LVoE5KvSD9ONXsZrj0z6KqySlCCNKHlLzbqAt4=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704 h1:PpfENOj/vPfhhy9N2OFRjpue0hjM5XqAp2thFmkXXIk=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1704/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU=
github.com/aliyun/aliyun-oss-go-sdk v3.0.1+incompatible h1:so4m5rRA32Tc5GgKg/5gKUu0CRsYmVO3ThMP6T3CwLc=
github.com/aliyun/aliyun-oss-go-sdk v3.0.1+incompatible/go.mod h1:T/Aws4fEfogEE9v+HPhhw+CntffsBHJ8nXQCwKr0/g8=
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
@ -174,8 +167,6 @@ github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgoo
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA=
github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
@ -184,8 +175,6 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-ldap/ldap/v3 v3.4.6 h1:ert95MdbiG7aWo/oPYp9btL3KJlMPKnP58r09rI8T+A=
github.com/go-ldap/ldap/v3 v3.4.6/go.mod h1:IGMQANNtxpsOzj7uUAMjpGBaOVTC4DYyIy8VsTdxmtc=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
@ -281,8 +270,8 @@ github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hf
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
@ -303,9 +292,8 @@ github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brv
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c=
github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
@ -320,9 +308,8 @@ github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/C
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.1 h1:0hERBMJE1eitiLkihrMvRVBYAkpHzc/J3QdDN+dAcgU=
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/memberlist v0.3.1 h1:MXgUXLqva1QvpVEDQW1IQLG0wivQAtmFlHRQ+1vWZfM=
github.com/hashicorp/memberlist v0.3.1/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
@ -438,8 +425,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
github.com/mozillazg/go-pinyin v0.19.0 h1:p+J8/kjJ558KPvVGYLvqBhxf8jbZA2exSLCs2uUVN8c=
github.com/mozillazg/go-pinyin v0.19.0/go.mod h1:iR4EnMMRXkfpFVV5FMi4FNB6wGq9NV6uDWbUuPhP4Yc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nacos-group/nacos-sdk-go/v2 v2.2.3 h1:sUQx4f1bXDeeOOEQZjGAitzxYApbYY9fVDbxVCaBW+I=
github.com/nacos-group/nacos-sdk-go/v2 v2.2.3/go.mod h1:UL4U89WYdnyajgKJUMpuT1Rr6iNmbjrxOO40JRgtA00=
@ -464,8 +449,6 @@ github.com/openzipkin/zipkin-go v0.4.1/go.mod h1:qY0VqDSN1pOBN94dBc6w2GJlWLiovAy
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml/v2 v2.0.9 h1:uH2qQXheeefCCkuBBSLi7jCiSmj3VRh2+Goq2N7Xxu0=
github.com/pelletier/go-toml/v2 v2.0.9/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
@ -556,8 +539,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stripe/stripe-go/v75 v75.7.0 h1:Zk7trlj0kClZOwnpjGz7FgVQRBI0Koi28/eaNATgAs0=
github.com/stripe/stripe-go/v75 v75.7.0/go.mod h1:wT44gah+eCY8Z0aSpY/vQlYYbicU9uUAbAqdaUxxDqE=
github.com/tidwall/gjson v1.13.0 h1:3TFY9yxOQShrvmjdM76K+jc66zJeT6D3/VFFYCGQf7M=
github.com/tidwall/gjson v1.13.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/gjson v1.12.0 h1:61wEp/qfvFnqKH/WCI3M8HuRut+mHT6Mr82QrFmM2SY=
github.com/tidwall/gjson v1.12.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
@ -642,8 +625,8 @@ golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -686,7 +669,6 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@ -729,8 +711,6 @@ golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -752,7 +732,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI=
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -812,16 +791,11 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -831,10 +805,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4=
golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -893,7 +865,6 @@ golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@ -1014,9 +985,8 @@ gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.66.2 h1:XfR1dOYubytKy4Shzc2LHrrGhU0lDCfDGG1yLPmpgsI=
gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/ini.v1 v1.66.4 h1:SsAcf+mM7mRZo2nJNGt8mZCjG8ZRaNGMURJw7BsIST4=
gopkg.in/ini.v1 v1.66.4/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=

View File

@ -1,34 +0,0 @@
package initalize
import (
"github.com/go-ldap/ldap/v3"
"log"
)
func InitLdap(host, bindDN, password string) *ldap.Conn {
// LDAP服务器配置
/*certFile := "/path/to/certificate.crt"
keyFile := "/path/to/certificate.crt"
// 加载证书文件
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
log.Fatal(err)
}
// 配置TLS
tlsConfig := &tls.Config{
InsecureSkipVerify: true, // 忽略证书验证(请谨慎使用)
Certificates: []tls.Certificate{cert},
}*/
// 连接到LDAP服务器
l, err := ldap.DialURL(host /*, ldap.DialWithTLSConfig(tlsConfig)*/)
if err != nil {
log.Fatal(err)
}
// 进行身份认证
err = l.Bind(bindDN, password)
if err != nil {
l.Close()
log.Fatal(err)
}
return l
}

View File

@ -1,23 +0,0 @@
package gmodel
import (
"log"
"testing"
"github.com/tidwall/gjson"
)
func TestCase1(t *testing.T) {
v := `{"base": {"mobile": "18588505404", "company": "fusen", "last_name": "sm", "first_name": "h", "resetaurant": "boy"}, "sub_status": {"notification_email": {"newseleter": false, "order_update": false}, "notification_phone": {"newseleter": true, "order_update": false}}, "logo_selected": {"logo_url": "https://fusenstorage.s3.us-east-2.amazonaws.com/d163cba052dc03e7684a4fa8574a17c629e08b6cd0f47f9c239866949365f807", "logo_selected_id": 5018, "merchant_category": 10, "template_tag_selected": {"color": [["#25211F"], ["#1E1916"]], "version": "2", "template_tag": "C6", "selected_index": 0}}}`
// log.Println(userId, guestId, v)
if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() {
log.Println(logoSelected)
log.Println(logoSelected.Get("version"))
if ver := logoSelected.Get("version"); ver.Exists() && ver.String() == versionML {
log.Println(ver)
}
}
// gjson.Get(content, "logo_selected")
}

View File

@ -4,15 +4,16 @@ import (
"gorm.io/gorm"
)
// casbin_rule
// casbin_rule 后台--权限规则表
type CasbinRule struct {
PType *string `gorm:"default:'';" json:"p_type"` //
V0 *string `gorm:"default:'';" json:"v0"` //
V1 *string `gorm:"default:'';" json:"v1"` //
V2 *string `gorm:"default:'';" json:"v2"` //
V3 *string `gorm:"default:'';" json:"v3"` //
V4 *string `gorm:"default:'';" json:"v4"` //
V5 *string `gorm:"default:'';" json:"v5"` //
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
PType *string `gorm:"default:'';" json:"p_type"` //
V0 *string `gorm:"default:'';" json:"v0"` //
V1 *string `gorm:"default:'';" json:"v1"` //
V2 *string `gorm:"default:'';" json:"v2"` //
V3 *string `gorm:"default:'';" json:"v3"` //
V4 *string `gorm:"default:'';" json:"v4"` //
V5 *string `gorm:"default:'';" json:"v5"` //
}
type CasbinRuleModel struct {
db *gorm.DB

View File

@ -0,0 +1,32 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_admin_api 后台--接口表
type FsAdminApi struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
Name *string `gorm:"default:'';" json:"name"` //
Path *string `gorm:"default:'';" json:"path"` //
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
Remark *string `gorm:"default:'';" json:"remark"` //
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
CreateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_time"` //
UpdateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"update_time"` //
DeleteTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"delete_time"` //
CreateUid *int64 `gorm:"default:0;" json:"create_uid"` // 创建人
UpdateUid *int64 `gorm:"default:0;" json:"update_uid"` // 更新人
DeleteUid *int64 `gorm:"default:0;" json:"delete_uid"` // 删除人
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除1=是 0=否
Method *int64 `gorm:"default:0;" json:"method"` // 接口方法
}
type FsAdminApiModel struct {
db *gorm.DB
name string
}
func NewFsAdminApiModel(db *gorm.DB) *FsAdminApiModel {
return &FsAdminApiModel{db: db, name: "fs_admin_api"}
}

View File

@ -0,0 +1,33 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_admin_auth_role 后台--角色表
type FsAdminAuthRole struct {
Id int64 `gorm:"primary_key;default:0;" json:"id"` // 序号
RolePid *int64 `gorm:"default:0;" json:"role_pid"` // 上级角色
RoleName *string `gorm:"default:'';" json:"role_name"` //
DataAuthType *int64 `gorm:"default:1;" json:"data_auth_type"` // 数据权限类型
DataAuth *string `gorm:"default:'';" json:"data_auth"` //
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
Remark *string `gorm:"default:'';" json:"remark"` //
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
CreateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_time"` //
UpdateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"update_time"` //
DeleteTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"delete_time"` //
CreateUid *int64 `gorm:"default:0;" json:"create_uid"` // 创建人
UpdateUid *int64 `gorm:"default:0;" json:"update_uid"` // 更新人
DeleteUid *int64 `gorm:"default:0;" json:"delete_uid"` // 删除人
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除1=是 0=否
}
type FsAdminAuthRoleModel struct {
db *gorm.DB
name string
}
func NewFsAdminAuthRoleModel(db *gorm.DB) *FsAdminAuthRoleModel {
return &FsAdminAuthRoleModel{db: db, name: "fs_admin_auth_role"}
}

View File

@ -0,0 +1,35 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_admin_department 后台--部门表
type FsAdminDepartment struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
DeptPid *int64 `gorm:"default:0;" json:"dept_pid"` // 上级部门
DeptNo *string `gorm:"default:'';" json:"dept_no"` //
DeptName *string `gorm:"unique_key;default:'';" json:"dept_name"` //
ShortName *string `gorm:"default:'';" json:"short_name"` //
UserId *int64 `gorm:"default:0;" json:"user_id"` // 部门负责人
Phone *string `gorm:"default:'';" json:"phone"` //
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
Remark *string `gorm:"default:'';" json:"remark"` //
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
CreateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_time"` //
UpdateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"update_time"` //
DeleteTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"delete_time"` //
CreateUid *int64 `gorm:"default:0;" json:"create_uid"` // 创建人
UpdateUid *int64 `gorm:"default:0;" json:"update_uid"` // 更新人
DeleteUid *int64 `gorm:"default:0;" json:"delete_uid"` // 删除人
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除1=是 0=否
}
type FsAdminDepartmentModel struct {
db *gorm.DB
name string
}
func NewFsAdminDepartmentModel(db *gorm.DB) *FsAdminDepartmentModel {
return &FsAdminDepartmentModel{db: db, name: "fs_admin_department"}
}

View File

@ -0,0 +1,44 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_admin_menu 后台--菜单表
type FsAdminMenu struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
Pid *int64 `gorm:"default:0;" json:"pid"` // 上级菜单
Name *string `gorm:"unique_key;default:'';" json:"name"` //
Path *string `gorm:"default:'';" json:"path"` //
Hide *string `gorm:"default:'';" json:"hide"` //
Type *int64 `gorm:"default:0;" json:"type"` // 类型1=菜单2=iframe3=外链4=按钮
Alias *string `gorm:"default:'';" json:"alias"` //
Icon *string `gorm:"default:'';" json:"icon"` //
Redirect *string `gorm:"default:'';" json:"redirect"` //
Highlight *string `gorm:"default:'';" json:"highlight"` //
View *string `gorm:"default:'';" json:"view"` //
Colour *string `gorm:"default:'';" json:"colour"` //
FullPageRout *int64 `gorm:"default:0;" json:"full_page_rout"` // 整页路由1=是0=否
Label *string `gorm:"default:'';" json:"label"` //
Metadata *[]byte `gorm:"default:'';" json:"metadata"` // 元数据,json格式
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
Remark *string `gorm:"default:'';" json:"remark"` //
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
CreateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_time"` //
UpdateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"update_time"` //
DeleteTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"delete_time"` //
CreateUid *int64 `gorm:"default:0;" json:"create_uid"` // 创建人
UpdateUid *int64 `gorm:"default:0;" json:"update_uid"` // 更新人
DeleteUid *int64 `gorm:"default:0;" json:"delete_uid"` // 删除人
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除1=是 0=否
ApiAuth *[]byte `gorm:"default:'';" json:"api_auth"` //
}
type FsAdminMenuModel struct {
db *gorm.DB
name string
}
func NewFsAdminMenuModel(db *gorm.DB) *FsAdminMenuModel {
return &FsAdminMenuModel{db: db, name: "fs_admin_menu"}
}

View File

@ -0,0 +1,23 @@
package gmodel
import (
"gorm.io/gorm"
)
// fs_admin_role_api 后台--角色接口表
type FsAdminRoleApi struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
RoleId *int64 `gorm:"index;default:0;" json:"role_id"` // 角色ID
MenuId *int64 `gorm:"index;default:0;" json:"menu_id"` // 菜单ID
ApiId *int64 `gorm:"index;default:0;" json:"api_id"` // 接口ID
ApiPath *string `gorm:"default:'';" json:"api_path"` //
ApiMethod *int64 `gorm:"default:0;" json:"api_method"` // 接口方法
}
type FsAdminRoleApiModel struct {
db *gorm.DB
name string
}
func NewFsAdminRoleApiModel(db *gorm.DB) *FsAdminRoleApiModel {
return &FsAdminRoleApiModel{db: db, name: "fs_admin_role_api"}
}

View File

@ -0,0 +1,34 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_admin_role 后台--角色表
type FsAdminRole struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
RolePid *int64 `gorm:"default:0;" json:"role_pid"` // 上级角色
RoleName *string `gorm:"unique_key;default:'';" json:"role_name"` //
DataAuthType *int64 `gorm:"default:1;" json:"data_auth_type"` // 数据权限类型
DataAuth *string `gorm:"default:'';" json:"data_auth"` //
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
Remark *string `gorm:"default:'';" json:"remark"` //
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
CreateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_time"` //
UpdateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"update_time"` //
DeleteTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"delete_time"` //
CreateUid *int64 `gorm:"default:0;" json:"create_uid"` // 创建人
UpdateUid *int64 `gorm:"default:0;" json:"update_uid"` // 更新人
DeleteUid *int64 `gorm:"default:0;" json:"delete_uid"` // 删除人
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除1=是 0=否
MenuAuth *[]byte `gorm:"default:'';" json:"menu_auth"` //
}
type FsAdminRoleModel struct {
db *gorm.DB
name string
}
func NewFsAdminRoleModel(db *gorm.DB) *FsAdminRoleModel {
return &FsAdminRoleModel{db: db, name: "fs_admin_role"}
}

View File

@ -0,0 +1,44 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_admin_user 后台--管理员表
type FsAdminUser struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 序号
DepartmentId *int64 `gorm:"default:0;" json:"department_id"` // 部门
RoleId *int64 `gorm:"default:0;" json:"role_id"` // 角色
EmployeeId *int64 `gorm:"default:0;" json:"employee_id"` // 员工
Type *int64 `gorm:"default:0;" json:"type"` // 类型1=超级管理员2=普通管理员
Account *string `gorm:"unique_key;default:'';" json:"account"` //
Password *string `gorm:"default:'';" json:"password"` //
Nickname *string `gorm:"default:'';" json:"nickname"` //
Mobile *string `gorm:"default:'';" json:"mobile"` //
Email *string `gorm:"default:'';" json:"email"` //
Salt *string `gorm:"default:'';" json:"salt"` //
LoginInitPassword *string `gorm:"default:'';" json:"login_init_password"` //
LoginLastTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"login_last_time"` //
LoginLastIp *string `gorm:"default:'';" json:"login_last_ip"` //
LoginNum *int64 `gorm:"default:0;" json:"login_num"` // 登录次数
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
Remark *string `gorm:"default:'';" json:"remark"` //
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
CreateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"create_time"` //
UpdateTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"update_time"` //
DeleteTime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"delete_time"` //
CreateUid *int64 `gorm:"default:0;" json:"create_uid"` // 创建人
UpdateUid *int64 `gorm:"default:0;" json:"update_uid"` // 更新人
DeleteUid *int64 `gorm:"default:0;" json:"delete_uid"` // 删除人
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除1=是 0=否
RoleIds *string `gorm:"default:'';" json:"role_ids"` //
}
type FsAdminUserModel struct {
db *gorm.DB
name string
}
func NewFsAdminUserModel(db *gorm.DB) *FsAdminUserModel {
return &FsAdminUserModel{db: db, name: "fs_admin_user"}
}

View File

@ -0,0 +1,2 @@
package gmodel
// TODO: 使用model的属性做你想做的

View File

@ -8,8 +8,12 @@ import (
type FsCloudRenderLog struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
UserId *int64 `gorm:"default:0;" json:"user_id"` // 用户id
GuestId *int64 `gorm:"default:0;" json:"guest_id"` // 游客id
PostData *string `gorm:"default:'';" json:"post_data"` //
PostUrl *string `gorm:"default:'';" json:"post_url"` //
Title *string `gorm:"index;default:'';" json:"title"` //
Time *int64 `gorm:"default:0;" json:"time"` // 所用时间
Result *string `gorm:"default:'';" json:"result"` //
Tag *string `gorm:"index;default:'';" json:"tag"` // 标识
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
}
type FsCloudRenderLogModel struct {

View File

@ -11,7 +11,6 @@ type FsDepartment struct {
Status *int64 `gorm:"default:0;" json:"status"` // 状态 1正常0停用
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
ParentId *int64 `gorm:"default:0;" json:"parent_id"` // 父级id
Manager *int64 `gorm:"default:0;" json:"manager"` // 负责人
}
type FsDepartmentModel struct {
db *gorm.DB

View File

@ -1,27 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_feishu_webhook_log 飞书webhook记录表
type FsFeishuWebhookLog struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
AppId *string `gorm:"default:'';" json:"app_id"` // app_id
EventId *string `gorm:"index;default:'';" json:"event_id"` // 事件唯一id
EventType *string `gorm:"default:'';" json:"event_type"` // 事件名
HttpHeader *string `gorm:"default:'';" json:"http_header"` // http响应头信息
Data *string `gorm:"default:'';" json:"data"` //
DecryptData *string `gorm:"default:'';" json:"decrypt_data"` //
MsgCtime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"msg_ctime"` //
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
}
type FsFeishuWebhookLogModel struct {
db *gorm.DB
name string
}
func NewFsFeishuWebhookLogModel(db *gorm.DB) *FsFeishuWebhookLogModel {
return &FsFeishuWebhookLogModel{db: db, name: "fs_feishu_webhook_log"}
}

View File

@ -1,9 +0,0 @@
package gmodel
import "context"
// TODO: 使用model的属性做你想做的
func (w *FsFeishuWebhookLogModel) Create(ctx context.Context, data *FsFeishuWebhookLog) error {
return w.db.WithContext(ctx).Model(&FsFeishuWebhookLog{}).Create(&data).Error
}

View File

@ -7,9 +7,9 @@ import (
// fs_font 字体配置
type FsFont struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
Title *string `gorm:"default:'';" json:"title"` //
Title *string `gorm:"default:'';" json:"title"` // 字体名字
LinuxFontname *string `gorm:"default:'';" json:"linux_fontname"` // linux对应字体名
FilePath *string `gorm:"default:'';" json:"file_path"` //
FilePath *string `gorm:"default:'';" json:"file_path"` // 字体文件路径
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
}
type FsFontModel struct {

View File

@ -41,7 +41,7 @@ func (m *FsGuestModel) GenerateGuestID(ctx context.Context, AccessSecret uint64)
Ctime: &now,
Utime: &now,
}
return tx.Model(&FsUserInfo{}).Create(uinfo).Error
return tx.Model(FsUserInfo{}).Create(uinfo).Error
})
if err != nil {

View File

@ -1,18 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
)
// fs_logo_preprocess
type FsLogoPreprocess struct {
RestaurantName *string `gorm:"index;default:'';" json:"restaurant_name"` // 餐厅名字
}
type FsLogoPreprocessModel struct {
db *gorm.DB
name string
}
func NewFsLogoPreprocessModel(db *gorm.DB) *FsLogoPreprocessModel {
return &FsLogoPreprocessModel{db: db, name: "fs_logo_preprocess"}
}

View File

@ -1,33 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_message_log 消息记录表
type FsMessageLog struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
Type *string `gorm:"default:'';" json:"type"` //
Channel *string `gorm:"default:'';" json:"channel"` // 发送途径sm=短信 email=邮件 feishu=飞书
Module *string `gorm:"default:'';" json:"module"` //
Source *string `gorm:"default:'';" json:"source"` //
Sender *string `gorm:"default:'';" json:"sender"` //
Receiver *string `gorm:"default:'';" json:"receiver"` //
TemplateSn *string `gorm:"default:'';" json:"template_sn"` //
Title *string `gorm:"default:'';" json:"title"` //
Content *[]byte `gorm:"default:'';" json:"content"` //
Status *int64 `gorm:"default:0;" json:"status"` // 状态0=未发送 1=已发送
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
}
type FsMessageLogModel struct {
db *gorm.DB
name string
}
func NewFsMessageLogModel(db *gorm.DB) *FsMessageLogModel {
return &FsMessageLogModel{db: db, name: "fs_message_log"}
}

View File

@ -1,25 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_order_combine_image_record 刀版图记录表
type FsOrderCombineImageRecord struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // Id
OrderId *int64 `gorm:"default:0;" json:"order_id"` // 订单id
CartId *int64 `gorm:"default:0;" json:"cart_id"` // 购物车id
ProductId *int64 `gorm:"default:0;" json:"product_id"` // 产品id
CombineImage *string `gorm:"default:'';" json:"combine_image"` //
GerentId *int64 `gorm:"default:0;" json:"gerent_id"` // 操作人
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
}
type FsOrderCombineImageRecordModel struct {
db *gorm.DB
name string
}
func NewFsOrderCombineImageRecordModel(db *gorm.DB) *FsOrderCombineImageRecordModel {
return &FsOrderCombineImageRecordModel{db: db, name: "fs_order_combine_image_record"}
}

View File

@ -25,9 +25,6 @@ type FsOrder struct {
PayStatusLink *[]byte `gorm:"default:'';" json:"pay_status_link"` //
ShoppingCartSnapshot *[]byte `gorm:"default:'';" json:"shopping_cart_snapshot"` //
ShoppingProductSnapshot *[]byte `gorm:"default:'';" json:"shopping_product_snapshot"` //
SaleGerentId *int64 `gorm:"default:0;" json:"sale_gerent_id"` // 销售负责人
DesignGerentId *int64 `gorm:"default:0;" json:"design_gerent_id"` // 设计负责人
Scm *[]byte `gorm:"default:'';" json:"scm"` //
}
type FsOrderModel struct {
db *gorm.DB

View File

@ -19,14 +19,9 @@ type OrderDetail struct {
// 收货地址
type OrderAddress struct {
Street string `json:"street"` // 详细地址
City string `json:"city"` // 城市
FirstName string `json:"first_name"` // 姓
LastName string `json:"last_name"` // 名
Mobile string `json:"mobile"` // 手机
State string `json:"state"` // 州
Suite string `json:"suite"` // 房号
ZipCode string `json:"zip_code"` // 邮编号码
Address string `json:"address"` // 详细地址
Mobile string `json:"mobile"` // 手机
Name string `json:"name"` // 姓名
}
// 订单金额
@ -53,12 +48,11 @@ type PayInfo struct {
// 金额明细
type AmountInfo struct {
Change AmountCurrency `json:"change"` // 变动金额
ChangeRemark string `json:"change_remark"` // 变动备注
Current AmountCurrency `json:"current"` // 当前金额
Initiate AmountCurrency `json:"initiate"` // 初始金额
Metadata map[string]interface{} `json:"metadata"` // 额外明细
IsUpdate int64 `json:"is_update"`
Change AmountCurrency `json:"change,omitempty"` // 变动金额
ChangeRemark string `json:"change_remark,omitempty"` // 变动备注
Current AmountCurrency `json:"current"` // 当前金额
Initiate AmountCurrency `json:"initiate"` // 初始金额
Metadata map[string]interface{} `json:"metadata"` // 额外明细
}
// 金额货币
@ -68,7 +62,6 @@ type AmountCurrency struct {
CurrentAmount constants.AmountUnit `json:"current_amount"` // 当前金额
OriginalCurrency string `json:"original_currency"` // 原始货币
OriginalAmount constants.AmountUnit `json:"original_amount"` // 原始金额
IsUpdate int64 `json:"is_update"`
}
// 支付状态
@ -109,7 +102,6 @@ type OrderProduct struct {
PurchaseQuantity PurchaseQuantity `json:"purchase_quantity"` // 购买数量
ProductId int64 `json:"product_id"` // 商品ID
ProductSn string `json:"product_sn"` // 商品编码
ProductWebsiteUnit *ProductWebsiteUnit `json:"product_website_unit"` //产品前台网站单位
ProductName string `json:"product_name"` // 商品名称
ProductCover string `json:"product_cover"` // 商品封面
ProductCoverMetadata map[string]interface{} `json:"product_cover_metadata"` // 商品封面
@ -126,7 +118,6 @@ type OrderProduct struct {
type PurchaseQuantity struct {
Current interface{} `json:"current"`
Initiate interface{} `json:"initiate"`
IsUpdate int64 `json:"is_update"`
}
type OrderProductSizeInfo struct {
@ -148,7 +139,6 @@ type OrderProductFittingInfo struct {
type ExpectedDelivery struct {
Current time.Time `json:"current"`
Initiate time.Time `json:"initiate"`
IsUpdate int64 `json:"is_update"`
}
type OrderProductInter struct {
@ -161,7 +151,6 @@ type OrderProductInter struct {
ProductCover string `json:"product_cover"` // 商品封面
ProductCoverMetadata map[string]interface{} `json:"product_cover_metadata"` // 商品封面
ProductSn string `json:"product_sn"` // 商品编码
ProductWebsiteUnit *ProductWebsiteUnit `json:"product_website_unit"` //产品前台网站单位
DiyInformation *UserDiyInformation `json:"diy_information"`
SizeInfo *OrderProductSizeInfo `json:"size_info"`
FittingInfo *OrderProductFittingInfo `json:"fitting_info"`

View File

@ -25,7 +25,6 @@ type FsOrderTrade struct {
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
PayTitle *string `gorm:"default:'';" json:"pay_title"` //
ReceiptSn *string `gorm:"default:'';" json:"receipt_sn"` //
}
type FsOrderTradeModel struct {
db *gorm.DB

View File

@ -1,35 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_preprocess_logo logo数据表
type FsPreprocessLogo struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 自增的唯一id
LocationCode *string `gorm:"index;default:'';" json:"location_code"` //
RestaurantName *string `gorm:"index;default:'';" json:"restaurant_name"` //
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
ResourceVectorUrl *string `gorm:"default:'';" json:"resource_vector_url"` //
OriginFileName *string `gorm:"default:'';" json:"origin_file_name"` //
RestaurantType *string `gorm:"default:'';" json:"restaurant_type"` //
Address *string `gorm:"default:'';" json:"address"` //
ZipCode *string `gorm:"default:'';" json:"zip_code"` //
Phone *string `gorm:"default:'';" json:"phone"` //
Website *string `gorm:"default:'';" json:"website"` //
IsBranch *int64 `gorm:"default:0;" json:"is_branch"` // 是否分店
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
Source *string `gorm:"index;default:'';" json:"source"` //
IsDel *int64 `gorm:"index;default:0;" json:"is_del"` // 是否删除
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
}
type FsPreprocessLogoModel struct {
db *gorm.DB
name string
}
func NewFsPreprocessLogoModel(db *gorm.DB) *FsPreprocessLogoModel {
return &FsPreprocessLogoModel{db: db, name: "fs_preprocess_logo"}
}

View File

@ -1,102 +0,0 @@
package gmodel
import (
"context"
"fmt"
"regexp"
"strings"
"github.com/zeromicro/go-zero/core/logx"
)
type PreLogoSearchResult struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 自增的唯一id
RestaurantName *string `gorm:"index;default:'';" json:"restaurant_name"` //
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
RestaurantType *string `gorm:"default:'';" json:"restaurant_type"` //
Address *string `gorm:"default:'';" json:"address"` //
ZipCode *string `gorm:"default:'';" json:"zip_code"` //
Phone *string `gorm:"default:'';" json:"phone"` //
Website *string `gorm:"default:'';" json:"website"` //
IsBranch *int64 `gorm:"default:0;" json:"is_branch"` // 是否分店
}
// TODO: 使用model的属性做你想做的
// 搜索
func (p *FsPreprocessLogoModel) PreLogoSearch(ctx context.Context, zipcode string, keywordsStr string, count int) (resp []PreLogoSearchResult, err error) {
keywordsList := SplitSearchKeywords(keywordsStr)
var keywords []string
for _, v := range keywordsList {
if len(v) > 1 {
keywords = append(keywords, "+"+v+"*")
}
}
if len(keywords) != 0 {
sqlstr := fmt.Sprintf("SELECT id,restaurant_name,resource_url,address,zip_code,phone,website,is_branch FROM fs_preprocess_logo WHERE MATCH(restaurant_name) AGAINST(? IN BOOLEAN MODE) AND `is_del` = 0 AND `zip_code` = ? limit %d;", count)
tx := p.db.WithContext(ctx).Model(&FsPreprocessLogo{}).Raw(sqlstr, strings.Join(keywords, " "), zipcode)
err = tx.Scan(&resp).Error
if err != nil {
logx.Error(err)
return nil, err
}
for i := range resp {
if resp[i].RestaurantType == nil {
resp[i].RestaurantType = FsString("")
}
}
}
if resp == nil {
resp = make([]PreLogoSearchResult, 0)
}
return resp, nil
}
func SplitSearchKeywords(keywordsStr string) []string {
return regexp.MustCompile(`\s+|\++`).Split(keywordsStr, -1)
}
// 搜索建议
func (p *FsPreprocessLogoModel) PreLogoSearchSuggestions(ctx context.Context, keywordsStr string, count int) (resp []PreLogoSearchResult, err error) {
// keywordsList := regexp.MustCompile(`\s+|\++`).Split(keywordsStr, -1)
keywordsList := SplitSearchKeywords(keywordsStr)
var keywords []string
for _, v := range keywordsList {
if len(v) > 1 {
keywords = append(keywords, "+"+v+"*")
}
}
if len(keywords) != 0 {
sqlstr := fmt.Sprintf("SELECT id,restaurant_name,resource_url,address,zip_code,phone,website,is_branch FROM fs_preprocess_logo WHERE MATCH(restaurant_name) AGAINST(? IN BOOLEAN MODE) AND `is_del` = 0 limit %d;", count)
tx := p.db.WithContext(ctx).Model(&FsPreprocessLogo{}).Raw(sqlstr, strings.Join(keywords, " "))
err = tx.Scan(&resp).Error
if err != nil {
logx.Error(err)
return nil, err
}
for i := range resp {
if resp[i].RestaurantType == nil {
resp[i].RestaurantType = FsString("")
}
}
}
if resp == nil {
resp = make([]PreLogoSearchResult, 0)
}
return resp, nil
}

View File

@ -36,9 +36,7 @@ type FsProduct struct {
RecommendProductSort *string `gorm:"default:'';" json:"recommend_product_sort"` //
SceneIds *string `gorm:"default:'';" json:"scene_ids"` //
IsCustomization *int64 `gorm:"default:0;" json:"is_customization"` // 是否可定制
WebsiteUnit *string `gorm:"default:'';" json:"website_unit"` //
Unit *string `gorm:"default:'';" json:"unit"` //
SupplyChainManager *int64 `gorm:"default:0;" json:"supply_chain_manager"` // 供应链负责人
}
type FsProductModel struct {
db *gorm.DB

View File

@ -1,23 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_product_history_template 模板历史表
type FsProductHistoryTemplate struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
TemplateId *int64 `gorm:"index;default:0;" json:"template_id"` // 模板id
TemplateInfo *string `gorm:"default:'';" json:"template_info"` //
RelativePublicTemplateId *int64 `gorm:"default:0;" json:"relative_public_template_id"` // 变更之前关联的公共模板id仅供查看
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
}
type FsProductHistoryTemplateModel struct {
db *gorm.DB
name string
}
func NewFsProductHistoryTemplateModel(db *gorm.DB) *FsProductHistoryTemplateModel {
return &FsProductHistoryTemplateModel{db: db, name: "fs_product_history_template"}
}

View File

@ -11,11 +11,6 @@ func (m *FsProductModel) TableName() string {
return m.name
}
func (t *FsProductModel) FindAll(ctx context.Context) (resp []FsProduct, err error) {
err = t.db.WithContext(ctx).Model(&FsProduct{}).Find(&resp).Error
return resp, err
}
func (p *FsProductModel) FindOne(ctx context.Context, id int64, fields ...string) (resp *FsProduct, err error) {
db := p.db.WithContext(ctx).Model(&FsProduct{}).Where("`id` = ? ", id)
if len(fields) != 0 {
@ -93,14 +88,9 @@ func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (r
Where("`is_del` =? and `is_shelf` = ?", 0, 1).Order("RAND()").Limit(limit).Find(&resp).Error
return resp, err
}
func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, notEqType int64, limit int, notInProductIds []int64) (resp []FsProduct, err error) {
db := p.db.WithContext(ctx).Model(&FsProduct{}).
//过滤报价单产品
Where("`is_del` =? and `is_shelf` = ? and `type` != ?", 0, 1, notEqType)
if len(notInProductIds) > 0 {
db = db.Where("`id` not in(?)", notInProductIds)
}
err = db.Order("RAND()").Limit(limit).Find(&resp).Error
func (p *FsProductModel) GetIgnoreRandomProductList(ctx context.Context, limit int, notInProductIds []int64) (resp []FsProduct, err error) {
err = p.db.WithContext(ctx).Model(&FsProduct{}).
Where("`is_del` =? and `is_shelf` = ? and `id` not in(?)", 0, 1, notInProductIds).Order("RAND()").Limit(limit).Find(&resp).Error
return resp, err
}
func (p *FsProductModel) FindAllOnlyByIds(ctx context.Context, ids []int64) (resp []FsProduct, err error) {

View File

@ -29,7 +29,7 @@ type FsProductModel3d struct {
IsCloudRender *int64 `gorm:"default:0;" json:"is_cloud_render"` // 是否设置为云渲染模型
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
StepPrice *[]byte `gorm:"default:'';" json:"step_price"` //
PackedUnit *int64 `gorm:"default:1;" json:"packed_unit"` // 被打包的数量单位
PackedUnit *int64 `gorm:"default:0;" json:"packed_unit"` // 被打包的数量单位
}
type FsProductModel3dModel struct {
db *gorm.DB

View File

@ -2,10 +2,6 @@ package gmodel
import "context"
func (t *FsProductModel3dLightModel) FindAll(ctx context.Context) (resp []FsProductModel3dLight, err error) {
err = t.db.WithContext(ctx).Model(&FsProductModel3dLight{}).Find(&resp).Error
return resp, err
}
func (l *FsProductModel3dLightModel) FindOne(ctx context.Context, id int64) (resp *FsProductModel3dLight, err error) {
err = l.db.WithContext(ctx).Model(&FsProductModel3dLight{}).Where("`id` = ? and `status` = ?", id, 1).Take(&resp).Error
return resp, err

View File

@ -3,6 +3,7 @@ package gmodel
import (
"context"
"encoding/json"
"errors"
"fmt"
"fusenapi/constants"
"sort"
@ -19,11 +20,6 @@ type StepPriceJsonStruct struct {
MinBuyUnitsNum int64 `json:"min_buy_units_num"`
}
func (t *FsProductModel3dModel) FindAll(ctx context.Context) (resp []FsProductModel3d, err error) {
err = t.db.WithContext(ctx).Model(&FsProductModel3d{}).Find(&resp).Error
return resp, err
}
func (d *FsProductModel3dModel) FindOne(ctx context.Context, id int64, fields ...string) (resp *FsProductModel3d, err error) {
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` = ? and `status` =? ", id, 1)
if len(fields) > 0 {
@ -176,59 +172,13 @@ func (d *FsProductModel3dModel) GetAllByProductIdsTags(ctx context.Context, prod
return resp, err
}
// 获取尺寸最低价格
func (d *FsProductModel3dModel) GetProductSizeMinPrice(modelList []FsProductModel3d, mapProductSizeMinPrice map[string]int64) error {
mapModelMinPrice := make(map[int64]int64)
//每个模型/配件存储最小价格
for _, modelInfo := range modelList {
switch *modelInfo.Tag {
case constants.TAG_MODEL: //模型
if modelInfo.StepPrice == nil || len(*modelInfo.StepPrice) == 0 {
mapModelMinPrice[modelInfo.Id] = 0
continue
}
var stepPrice StepPriceJsonStruct
if err := json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil {
return fmt.Errorf("failed to parse model step price:%d", modelInfo.Id)
}
lenRange := len(stepPrice.PriceRange)
if lenRange == 0 {
mapModelMinPrice[modelInfo.Id] = 0
continue
}
sort.SliceStable(stepPrice.PriceRange, func(i, j int) bool {
return stepPrice.PriceRange[i].Price > stepPrice.PriceRange[j].Price
})
mapModelMinPrice[modelInfo.Id] = stepPrice.PriceRange[lenRange-1].Price
case constants.TAG_PARTS: //配件
mapModelMinPrice[modelInfo.Id] = *modelInfo.Price
}
}
//给产品存储最小价格
for _, v := range modelList {
if *v.Tag != constants.TAG_MODEL {
continue
}
itemPrice := mapModelMinPrice[v.Id]
if *v.PartId > 0 {
if fittingPrice, ok := mapModelMinPrice[*v.PartId]; ok {
itemPrice += fittingPrice
}
}
key := fmt.Sprintf("%d_%d", *v.ProductId, *v.SizeId)
if minPrice, ok := mapProductSizeMinPrice[key]; ok {
if itemPrice < minPrice {
mapProductSizeMinPrice[key] = itemPrice
}
continue
}
mapProductSizeMinPrice[key] = itemPrice
}
return nil
}
// 获取每个产品最低价格
func (d *FsProductModel3dModel) GetProductMinPrice(modelList []FsProductModel3d, mapProductMinPrice map[int64]int64) error {
func (d *FsProductModel3dModel) GetProductMinPrice(ctx context.Context, productIds []int64, mapProductMinPrice map[int64]int64) error {
//获取产品模型价格列表
modelList, err := d.GetAllByProductIdsTags(ctx, productIds, []int{constants.TAG_MODEL, constants.TAG_PARTS}, "id,product_id,price,tag,part_id,step_price")
if err != nil {
return errors.New("failed to get model list")
}
mapModelMinPrice := make(map[int64]int64)
//每个模型/配件存储最小价格
for _, modelInfo := range modelList {
@ -239,8 +189,8 @@ func (d *FsProductModel3dModel) GetProductMinPrice(modelList []FsProductModel3d,
continue
}
var stepPrice StepPriceJsonStruct
if err := json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil {
return fmt.Errorf("failed to parse model step price:%d", modelInfo.Id)
if err = json.Unmarshal(*modelInfo.StepPrice, &stepPrice); err != nil {
return errors.New(fmt.Sprintf("failed to parse model step price:%d", modelInfo.Id))
}
lenRange := len(stepPrice.PriceRange)
if lenRange == 0 {
@ -276,11 +226,3 @@ func (d *FsProductModel3dModel) GetProductMinPrice(modelList []FsProductModel3d,
}
return nil
}
func (d *FsProductModel3dModel) GetAllByProductIdTags(ctx context.Context, productId int64, tags []int64, fields ...string) (resp []FsProductModel3d, err error) {
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`product_id`= ? and `tag` in(?) and `status` = ?", productId, tags, 1)
if len(fields) != 0 {
db = db.Select(fields[0])
}
err = db.Find(&resp).Error
return resp, err
}

View File

@ -4,11 +4,6 @@ import (
"context"
)
func (t *FsProductTemplateTagsModel) FindAll(ctx context.Context) (resp []FsProductTemplateTags, err error) {
err = t.db.WithContext(ctx).Model(&FsProductTemplateTags{}).Find(&resp).Error
return resp, err
}
func (pt *FsProductTemplateTagsModel) GetListByIds(ctx context.Context, ids []int64) (resp []FsProductTemplateTags, err error) {
if len(ids) == 0 {
return

View File

@ -4,29 +4,27 @@ import (
"gorm.io/gorm"
)
// fs_product_template_v2 产品-模型- 模板表
// fs_product_template_v2 产品-模型-模板表
type FsProductTemplateV2 struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID
ModelId *int64 `gorm:"default:0;" json:"model_id"` // 模型ID
Title *string `gorm:"default:'';" json:"title"` // 模板sku,预留字段
Name *string `gorm:"default:'';" json:"name"` // 名称
CoverImg *string `gorm:"default:'';" json:"cover_img"` //
TemplateInfo *string `gorm:"default:'';" json:"template_info"` // 模板详情
MaterialImg *string `gorm:"default:'';" json:"material_img"` //
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
LogoWidth *int64 `gorm:"default:0;" json:"logo_width"` // logo图最大宽度
LogoHeight *int64 `gorm:"default:0;" json:"logo_height"` // logo图最大高度
IsPublic *int64 `gorm:"default:0;" json:"is_public"` // 是否可公用1:可以0不可以,仅供模型关联)
IsPublicTemplate *int64 `gorm:"default:0;" json:"is_public_template"` // 是否是公共模板0非1是(仅针对模板之间)
RelativePublicTemplateId *int64 `gorm:"default:0;" json:"relative_public_template_id"` // 模板间关联的公共模板id
Status *int64 `gorm:"default:0;" json:"status"` // 状态1正常 2异常
TemplateTag *string `gorm:"default:'';" json:"template_tag"` //
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除
SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息
Version *int64 `gorm:"default:0;" json:"version"` // 默认1
ElementModelId *int64 `gorm:"default:0;" json:"element_model_id"` // 云渲染对应模型id
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
ProductId *int64 `gorm:"index;default:0;" json:"product_id"` // 产品ID
ModelId *int64 `gorm:"default:0;" json:"model_id"` // 模型ID
Title *string `gorm:"default:'';" json:"title"` // 模板sku,预留字段
Name *string `gorm:"default:'';" json:"name"` // 名称
CoverImg *string `gorm:"default:'';" json:"cover_img"` // 模板背景图
TemplateInfo *string `gorm:"default:'';" json:"template_info"` // 模板详情
MaterialImg *string `gorm:"default:'';" json:"material_img"` // 合成好的贴图
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
LogoWidth *int64 `gorm:"default:0;" json:"logo_width"` // logo图最大宽度
LogoHeight *int64 `gorm:"default:0;" json:"logo_height"` // logo图最大高度
IsPublic *int64 `gorm:"default:0;" json:"is_public"` // 是否可公用1:可以0不可以
Status *int64 `gorm:"default:0;" json:"status"` // 状态1正常 2异常
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
TemplateTag *string `gorm:"default:'';" json:"template_tag"` //
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除
SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息
Version *int64 `gorm:"default:0;" json:"version"` // 默认1
ElementModelId *int64 `gorm:"default:0;" json:"element_model_id"` // 云渲染对应模型id
}
type FsProductTemplateV2Model struct {
db *gorm.DB

View File

@ -4,11 +4,6 @@ import (
"context"
)
func (t *FsProductTemplateV2Model) FindAll(ctx context.Context) (resp []FsProductTemplateV2, err error) {
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Find(&resp).Error
return resp, err
}
func (t *FsProductTemplateV2Model) FindAllByProductIds(ctx context.Context, productIds []int64, sort string, fields ...string) (resp []FsProductTemplateV2, err error) {
if len(productIds) == 0 {
return
@ -23,16 +18,15 @@ func (t *FsProductTemplateV2Model) FindAllByProductIds(ctx context.Context, prod
err = db.Find(&resp).Error
return resp, err
}
func (t *FsProductTemplateV2Model) FindAllByIds(ctx context.Context, ids []int64, fields ...string) (resp []FsProductTemplateV2, err error) {
func (t *FsProductTemplateV2Model) FindAllByIds(ctx context.Context, ids []int64) (resp []FsProductTemplateV2, err error) {
if len(ids) == 0 {
return
}
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` in (?) and `is_del` = ? and `status` = ?", ids, 0, 1)
if len(fields) != 0 {
db = db.Select(fields[0])
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` in (?) and `is_del` = ? and `status` = ?", ids, 0, 1).Find(&resp).Error
if err != nil {
return nil, err
}
err = db.Find(&resp).Error
return resp, err
return
}
func (t *FsProductTemplateV2Model) FindAllByIdsWithoutStatus(ctx context.Context, ids []int64, fields ...string) (resp []FsProductTemplateV2, err error) {
if len(ids) == 0 {
@ -185,27 +179,3 @@ func (t *FsProductTemplateV2Model) FindAllByProductIdsTemplateTag(ctx context.Co
err = db.Find(&resp).Error
return resp, err
}
// 获取开启云渲染的模板列表
func (t *FsProductTemplateV2Model) FindAllCloudRenderTemplateByProductIdsTemplateTag(ctx context.Context, productIds []int64, templateTag string, sort string, fields ...string) (resp []FsProductTemplateV2, err error) {
if len(productIds) == 0 {
return
}
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`product_id` in (?) and `template_tag` = ? and `is_del` = ? and `status` = ? and `element_model_id` > ? ", productIds, templateTag, 0, 1, 0)
if sort != "" {
db = db.Order(sort)
}
if len(fields) != 0 {
db = db.Select(fields[0])
}
err = db.Find(&resp).Error
return resp, err
}
func (t *FsProductTemplateV2Model) FindAllByFittingIds(ctx context.Context, fittingIds []int64, fields ...string) (resp []FsProductTemplateV2, err error) {
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`model_id` in(?) and `status` = ? and `is_del` = ? ", fittingIds, 1, 0)
if len(fields) != 0 {
db = db.Select(fields[0])
}
err = db.Find(&resp).Error
return resp, err
}

View File

@ -11,7 +11,7 @@ type FsQrcode struct {
TagId *int64 `gorm:"index;default:0;" json:"tag_id"` // 用户id
ScanTimes *int64 `gorm:"default:0;" json:"scan_times"` // 扫码次数
CreateAt *int64 `gorm:"default:0;" json:"create_at"` // 添加时间
Link *string `gorm:"default:'';" json:"link"` //
Link *string `gorm:"index;default:'';" json:"link"` // 跳转链接
SvgPath *string `gorm:"default:'';" json:"svg_path"` // svg地址
Status *int64 `gorm:"default:1;" json:"status"` // 状态1:正常 0下架
ProductId *int64 `gorm:"default:0;" json:"product_id"` // 0

View File

@ -35,26 +35,20 @@ type FsShoppingCartData struct {
// 购物车快照数据结构
type CartSnapshot struct {
Logo string `json:"logo"` //logo地址
LogoMaterialMetadata interface{} `json:"logo_material_metadata"` //logo素材信息
CombineImage string `json:"combine_image"` //刀版图地址
RenderImage string `json:"render_image"` //渲染结果图
TemplateInfo TemplateInfo `json:"template_info"` //模板数据
ModelInfo ModelInfo `json:"model_info"` //模型的数据
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
SizeInfo SizeInfo `json:"size_info"` //尺寸基本信息
ProductInfo ProductInfo `json:"product_info"` //产品基本信息(只记录不要使用)
UserDiyInformation UserDiyInformation `json:"user_diy_information"` //用户diy数据
LightInfo LightInfo `json:"light_info"` //灯光数据
Logo string `json:"logo"` //logo地址
CombineImage string `json:"combine_image"` //刀版图地址
RenderImage string `json:"render_image"` //渲染结果图
TemplateInfo TemplateInfo `json:"template_info"` //模板数据
ModelInfo ModelInfo `json:"model_info"` //模型的数据
FittingInfo FittingInfo `json:"fitting_info"` //配件信息
SizeInfo SizeInfo `json:"size_info"` //尺寸基本信息
ProductInfo ProductInfo `json:"product_info"` //产品基本信息(只记录不要使用)
UserDiyInformation UserDiyInformation `json:"user_diy_information"` //用户diy数据
LightInfo LightInfo `json:"light_info"` //灯光数据
}
type ProductInfo struct {
ProductName string `json:"product_name"` //产品名
ProductSn string `json:"product_sn"` //产品sn
ProductWebsiteUnit ProductWebsiteUnit `json:"product_website_unit"` //产品前台网站单位
}
type ProductWebsiteUnit struct {
Singular string `json:"singular"`
Complex string `json:"complex"`
ProductName string `json:"product_name"`
ProductSn string `json:"product_sn"`
}
type ModelInfo struct {
ModelJson interface{} `json:"model_json"` //模型设计json数据
@ -65,7 +59,6 @@ type FittingInfo struct {
}
type TemplateInfo struct {
SwitchInfo interface{} `json:"switch_info"`
TemplateJson interface{} `json:"template_json"` //模板设计json数据
TemplateTag string `json:"template_tag"` //模板标签
SelectColorIndex int64 `json:"select_color_index"` //颜色选择索引
@ -113,11 +106,8 @@ func (s *FsShoppingCartModel) Create(ctx context.Context, data *FsShoppingCart)
}
// 删除
func (s *FsShoppingCartModel) Delete(ctx context.Context, userId int64, ids []int64) error {
if len(ids) == 0 {
return nil
}
return s.db.WithContext(ctx).Model(&FsShoppingCart{}).Where("user_id = ? and id in (?)", userId, ids).Delete(&FsShoppingCart{}).Error
func (s *FsShoppingCartModel) Delete(ctx context.Context, userId, id int64) error {
return s.db.WithContext(ctx).Model(&FsShoppingCart{}).Where("user_id = ? and id = ?", userId, id).Delete(&FsShoppingCart{}).Error
}
// 更新

View File

@ -6,12 +6,11 @@ import (
// fs_standard_logo 标准logo
type FsStandardLogo struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
Name *string `gorm:"default:'';" json:"name"` //
Image *string `gorm:"default:'';" json:"image"` //
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
Status *int64 `gorm:"default:1;" json:"status"` // 状态 1正常 0删除
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
Name *string `gorm:"default:'';" json:"name"` //
Image *string `gorm:"default:'';" json:"image"` //
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
Status *int64 `gorm:"default:1;" json:"status"` // 状态 1正常 0删除
}
type FsStandardLogoModel struct {
db *gorm.DB

View File

@ -1,9 +1,3 @@
package gmodel
import "context"
// TODO: 使用model的属性做你想做的
func (t *FsToolLogsModel) FindAll(ctx context.Context) (resp []FsToolLogs, err error) {
err = t.db.WithContext(ctx).Model(&FsToolLogs{}).Find(&resp).Error
return resp, err
}

View File

@ -1,22 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_user_debug 用户debug
type FsUserDebug struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // 用户 ID
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // 时间
GuestId *int64 `gorm:"default:0;" json:"guest_id"` //
}
type FsUserDebugModel struct {
db *gorm.DB
name string
}
func NewFsUserDebugModel(db *gorm.DB) *FsUserDebugModel {
return &FsUserDebugModel{db: db, name: "fs_user_debug"}
}

View File

@ -8,9 +8,7 @@ import (
"fmt"
"fusenapi/utils/fssql"
"fusenapi/utils/handlers"
"log"
"github.com/tidwall/gjson"
"gorm.io/gorm"
)
@ -52,31 +50,7 @@ func (m *FsUserInfoModel) MergeMetadata(userId int64, meta any) error {
return fssql.MetadataModulePATCH(m.db, "profile", FsUserInfo{}, meta, "user_id = ?", userId)
}
func (m *FsUserInfoModel) getDefaultProfile(ctx context.Context, tname string) (map[string]any, error) {
var baseinfo map[string]any
condUser := "user_id = 0 and guest_id = 0"
rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", tname, condUser)
err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error
if err != nil {
return nil, err
}
v, ok := baseinfo["query"].(string)
if !ok {
return nil, fmt.Errorf("default userinfo profile is not exists")
}
var info map[string]any
err = json.Unmarshal([]byte(v), &info)
if err != nil {
return nil, err
}
return info, nil
}
var versionML = "2"
func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId int64, guestId int64) (map[string]any, error) {
func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId int64) (map[string]any, error) {
var baseinfo map[string]any
tname := fssql.GetGormTableName(m.db, FsUserInfo{})
@ -87,22 +61,15 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in
pkey = "." + pkey
}
var condUser string
if userId == 0 {
condUser = fmt.Sprintf("user_id = 0 and guest_id = %d", guestId)
} else {
condUser = fmt.Sprintf("user_id = %d", userId)
}
rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$%s') as query from %s where %s and module = 'profile' order by ctime DESC limit 1", pkey, tname, condUser)
err := m.db.WithContext(ctx).Raw(rawsql).Take(&baseinfo).Error
rawsql := fmt.Sprintf("select JSON_EXTRACT(metadata,'$%s') as query from %s where user_id = ? and module = 'profile' order by ctime DESC limit 1", pkey, tname)
err := m.db.Raw(rawsql, userId).Take(&baseinfo).Error
if err != nil {
return nil, err
}
v, ok := baseinfo["query"].(string)
if !ok {
return m.getDefaultProfile(ctx, tname)
return nil, nil
}
var info map[string]any
@ -110,35 +77,11 @@ func (m *FsUserInfoModel) GetProfile(ctx context.Context, pkey string, userId in
if err != nil {
return nil, err
}
if len(info) == 0 {
return m.getDefaultProfile(ctx, tname)
}
if logoSelected := gjson.Get(v, "logo_selected"); logoSelected.Exists() {
if ver := logoSelected.Get("template_tag_selected.version"); ver.Exists() && ver.String() == versionML {
log.Println(ver)
return info, nil
}
}
defaultUserInfo, err := m.getDefaultProfile(ctx, tname)
if err != nil {
return nil, err
}
info["logo_selected"] = defaultUserInfo["logo_selected"]
return info, nil
}
func (m *FsUserInfoModel) GetDefaultProfile(ctx context.Context) (map[string]any, error) {
tname := fssql.GetGormTableName(m.db, FsUserInfo{})
return m.getDefaultProfile(ctx, tname)
}
func (m *FsUserInfoModel) FindOneByUser(ctx context.Context, userId, guestId int64, module string) (resp *FsUserInfo, err error) {
func (m *FsUserInfoModel) FindOneByUser(ctx context.Context, userId, guestId int64) (resp *FsUserInfo, err error) {
if userId > 0 {
err = m.db.WithContext(ctx).Model(&FsUserInfo{}).Where("user_id = ? and module = ?", userId, module).Take(&resp).Error
err = m.db.WithContext(ctx).Model(&FsUserInfo{}).Where("user_id = ?", userId).Take(&resp).Error
} else {
err = m.db.WithContext(ctx).Model(&FsUserInfo{}).Where("user_id = ? and guest_id = ?", userId, guestId).Take(&resp).Error
}

View File

@ -15,7 +15,6 @@ type FsUserMaterial struct {
ResourceUrl *string `gorm:"default:'';" json:"resource_url"` //
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` // 上传时间
LogoId *int64 `gorm:"index;default:0;" json:"logo_id"` // logo库ID
}
type FsUserMaterialModel struct {
db *gorm.DB

View File

@ -1,24 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// fs_zip_code 邮编表
type FsZipCode struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
ZipCode *string `gorm:"default:'';" json:"zip_code"` // 邮编
Manager *int64 `gorm:"default:0;" json:"manager"` // 负责人
Status *int64 `gorm:"default:0;" json:"status"` // 状态 1正常0关闭
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
}
type FsZipCodeModel struct {
db *gorm.DB
name string
}
func NewFsZipCodeModel(db *gorm.DB) *FsZipCodeModel {
return &FsZipCodeModel{db: db, name: "fs_zip_code"}
}

View File

@ -1,24 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// ldap_apis api表
type LdapApis struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
Name *string `gorm:"default:'';" json:"name"` //
Method *string `gorm:"default:'';" json:"method"` //
Path *string `gorm:"default:'';" json:"path"` //
Category *string `gorm:"default:'';" json:"category"` //
Remark *string `gorm:"default:'';" json:"remark"` //
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
}
type LdapApisModel struct {
db *gorm.DB
name string
}
func NewLdapApisModel(db *gorm.DB) *LdapApisModel { return &LdapApisModel{db: db, name: "ldap_apis"} }

View File

@ -1,72 +0,0 @@
package gmodel
import (
"context"
"time"
"gorm.io/gorm"
)
// TODO: 使用model的属性做你想做的
type FindPageReq struct {
Fields string //筛选的字段
Sort string //排序
Page int //当前页
Limit int //每页数量
}
// FindAll 全部查询
func (s *LdapApisModel) FindAll(ctx context.Context, gorm *gorm.DB) (resp []LdapApis, err error) {
var db = gorm
if gorm == nil {
db = s.db.WithContext(ctx).Model(&LdapApis{})
} else {
db = db.WithContext(ctx).Model(&LdapApis{})
}
err = db.Find(&resp).Error
return resp, err
}
// FindPage 分页查询
func (s *LdapApisModel) FindPage(ctx context.Context, req FindPageReq) (resp []LdapApis, total int64, err error) {
db := s.db.WithContext(ctx).Model(&LdapApis{})
if req.Fields != "" {
db = db.Select(req.Fields)
}
if req.Sort != "" {
db = db.Order(req.Sort)
}
//查询数量
if err = db.Limit(1).Count(&total).Error; err != nil {
return nil, 0, err
}
offset := (req.Page - 1) * req.Limit
err = db.Offset(offset).Limit(req.Limit).Find(&resp).Error
return resp, total, err
}
func (s *LdapApisModel) FindOneById(ctx context.Context, id int64) (resp LdapApis, err error) {
db := s.db.WithContext(ctx).Model(&LdapApis{}).Where("id = ?", id)
err = db.Take(&resp).Error
return resp, err
}
// InsertOne 单个插入
func (s *LdapApisModel) InsertOne(ctx context.Context, insertData LdapApis) error {
db := s.db.WithContext(ctx).Model(&LdapApis{})
var nowTime = time.Now().UTC()
insertData.Ctime = &nowTime
insertData.Utime = &nowTime
result := db.Create(&insertData)
return result.Error
}
// UpdateOne 单个更新
func (s *LdapApisModel) UpdateOne(ctx context.Context, model LdapApis, updateData map[string]interface{}) error {
db := s.db.WithContext(ctx).Model(&model)
updateData["utime"] = time.Now().UTC()
result := db.Updates(updateData)
return result.Error
}

View File

@ -1,28 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// ldap_group 权限组表
type LdapGroup struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
Type *string `gorm:"default:'';" json:"type"` //
Name *string `gorm:"default:'';" json:"name"` //
Keyword *string `gorm:"default:'';" json:"keyword"` //
Remark *string `gorm:"default:'';" json:"remark"` //
Status *int64 `gorm:"default:1;" json:"status"` // 1正常, 2禁用
Sort *int64 `gorm:"default:999;" json:"sort"` // 分组排序(排序越大权限越低, 不能查看比自己序号小的角色, 不能编辑同序号用户权限, 排序为1表示超级管理员)
Metadata *[]byte `gorm:"default:'';" json:"metadata"` //
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
}
type LdapGroupModel struct {
db *gorm.DB
name string
}
func NewLdapGroupModel(db *gorm.DB) *LdapGroupModel {
return &LdapGroupModel{db: db, name: "ldap_group"}
}

View File

@ -1,65 +0,0 @@
package gmodel
import (
"context"
"time"
"gorm.io/gorm"
)
// TODO: 使用model的属性做你想做的
// FindAll 全部查询
func (s *LdapGroupModel) FindAll(ctx context.Context, gorm *gorm.DB) (resp []LdapGroup, err error) {
var db = gorm
if gorm == nil {
db = s.db.WithContext(ctx).Model(&LdapGroup{})
} else {
db = db.WithContext(ctx).Model(&LdapGroup{})
}
err = db.Find(&resp).Error
return resp, err
}
// FindPage 分页查询
func (s *LdapGroupModel) FindPage(ctx context.Context, req FindPageReq) (resp []LdapGroup, total int64, err error) {
db := s.db.WithContext(ctx).Model(&LdapGroup{}).Where("type != ?", "people")
if req.Fields != "" {
db = db.Select(req.Fields)
}
if req.Sort != "" {
db = db.Order(req.Sort)
}
//查询数量
if err = db.Limit(1).Count(&total).Error; err != nil {
return nil, 0, err
}
offset := (req.Page - 1) * req.Limit
err = db.Offset(offset).Limit(req.Limit).Find(&resp).Error
return resp, total, err
}
func (s *LdapGroupModel) FindOneById(ctx context.Context, id int64) (resp LdapGroup, err error) {
db := s.db.WithContext(ctx).Model(&LdapGroup{}).Where("id = ?", id)
err = db.Take(&resp).Error
return resp, err
}
// InsertOne 单个插入
func (s *LdapGroupModel) InsertOne(ctx context.Context, insertData LdapGroup) error {
db := s.db.WithContext(ctx).Model(&LdapGroup{})
var nowTime = time.Now().UTC()
insertData.Ctime = &nowTime
insertData.Utime = &nowTime
result := db.Create(&insertData)
return result.Error
}
// UpdateOne 单个更新
func (s *LdapGroupModel) UpdateOne(ctx context.Context, model LdapGroup, updateData map[string]interface{}) error {
db := s.db.WithContext(ctx).Model(&model)
updateData["utime"] = time.Now().UTC()
result := db.Updates(updateData)
return result.Error
}

View File

@ -1,28 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// ldap_menus 菜单表
type LdapMenus struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
Name *string `gorm:"default:'';" json:"name"` //
Title *string `gorm:"default:'';" json:"title"` //
Icon *string `gorm:"default:'';" json:"icon"` //
Path *string `gorm:"default:'';" json:"path"` //
Sort *int64 `gorm:"default:999;" json:"sort"` // 菜单顺序(1-999)
Status *int64 `gorm:"default:1;" json:"status"` // 菜单状态(正常/禁用, 默认正常)
ParentId *int64 `gorm:"default:0;" json:"parent_id"` // 父菜单编号(编号为0时表示根菜单)
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
}
type LdapMenusModel struct {
db *gorm.DB
name string
}
func NewLdapMenusModel(db *gorm.DB) *LdapMenusModel {
return &LdapMenusModel{db: db, name: "ldap_menus"}
}

View File

@ -1,63 +0,0 @@
package gmodel
import "context"
// TODO: 使用model的属性做你想做的
func (m *LdapMenusModel) Create(ctx context.Context, data *LdapMenus) error {
return m.db.WithContext(ctx).Model(&LdapMenus{}).Create(&data).Error
}
func (m *LdapMenusModel) FindOne(ctx context.Context, id int64) (resp *LdapMenus, err error) {
err = m.db.WithContext(ctx).Model(&LdapMenus{}).Where("id= ? and status = ?", id, 1).Take(&resp).Error
return resp, err
}
func (m *LdapMenusModel) FindByPath(ctx context.Context, path string) (resp *LdapMenus, err error) {
err = m.db.WithContext(ctx).Model(&LdapMenus{}).Where("path= ? and status = ?", path, 1).Take(&resp).Error
return resp, err
}
func (m *LdapMenusModel) Update(ctx context.Context, id int64, data *LdapMenus) error {
return m.db.WithContext(ctx).Model(&LdapMenus{}).Where("id = ?", id).Updates(&data).Error
}
type GetMenuListByParamReq struct {
Ids []int64
Name string
Title string
Path string
Status *int64
ParentId *int64
Sort string
Page int
Limit int
}
func (m *LdapMenusModel) GetMenuListByParam(ctx context.Context, req GetMenuListByParamReq) (resp []LdapMenus, total int64, err error) {
db := m.db.WithContext(ctx).Model(&LdapMenus{})
if len(req.Ids) > 0 {
db = db.Where("id in(?)", req.Ids)
}
if req.Name != "" {
db = db.Where("name like ?", "%"+req.Name+"%")
}
if req.Title != "" {
db = db.Where("title like ?", "%"+req.Title+"%")
}
if req.Name != "" {
db = db.Where("path like ?", "%"+req.Path+"%")
}
if req.Status != nil {
db = db.Where("status = ?", req.Status)
}
if req.ParentId != nil {
db = db.Where("parent_id = ?", req.ParentId)
}
if req.Sort != "" {
db = db.Order(req.Sort)
}
if err = db.Count(&total).Error; err != nil {
return nil, 0, err
}
offset := (req.Page - 1) * req.Limit
err = db.Offset(offset).Limit(req.Limit).Find(&resp).Error
return resp, total, err
}

View File

@ -1,20 +0,0 @@
package gmodel
import (
"gorm.io/gorm"
"time"
)
// ldap_user ldap_用户id递增表
type LdapUser struct {
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` //
UserDn *string `gorm:"index;default:'';" json:"user_dn"` //
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
}
type LdapUserModel struct {
db *gorm.DB
name string
}
func NewLdapUserModel(db *gorm.DB) *LdapUserModel { return &LdapUserModel{db: db, name: "ldap_user"} }

View File

@ -1,27 +0,0 @@
package gmodel
import "context"
// TODO: 使用model的属性做你想做的
func (u *LdapUserModel) Create(ctx context.Context, data *LdapUser) error {
return u.db.WithContext(ctx).Model(&LdapUser{}).Create(&data).Error
}
func (u *LdapUserModel) Update(ctx context.Context, userDN string, data *LdapUser) error {
return u.db.WithContext(ctx).Model(&LdapUser{}).Where("user_dn = ?", userDN).Updates(&data).Error
}
func (u *LdapUserModel) UpdateById(ctx context.Context, id int64, data *LdapUser) error {
return u.db.WithContext(ctx).Model(&LdapUser{}).Where("id = ?", id).Updates(&data).Error
}
func (u *LdapUserModel) Delete(ctx context.Context, id int64) error {
return u.db.WithContext(ctx).Model(&LdapUser{}).Where("id = ?", id).Delete(&LdapUser{}).Error
}
func (u *LdapUserModel) GetAllByIds(ctx context.Context, ids []int64) (resp []LdapUser, err error) {
if len(ids) == 0 {
return
}
err = u.db.WithContext(ctx).Model(&LdapUser{}).Where("id in (?)", ids).Find(&resp).Error
return resp, err
}

View File

@ -4,229 +4,227 @@ import "gorm.io/gorm"
// AllModelsGen 所有Model集合,修改单行,只要不改字段名,不会根据新的内容修改,需要修改的话手动删除
type AllModelsGen struct {
CasbinRule *CasbinRuleModel // casbin_rule
FsAddress *FsAddressModel // fs_address 用户地址表
FsAuthAssignment *FsAuthAssignmentModel // fs_auth_assignment 用户角色和权限信息
FsAuthItem *FsAuthItemModel // fs_auth_item 用户角色和权限信息
FsAuthItemChild *FsAuthItemChildModel // fs_auth_item_child 角色和权限关系表
FsAuthRule *FsAuthRuleModel // fs_auth_rule 规则表
FsBackendUser *FsBackendUserModel // fs_backend_user 管理员表
FsCanteenProduct *FsCanteenProductModel // fs_canteen_product 餐厅类别产品对应表
FsCanteenType *FsCanteenTypeModel // fs_canteen_type 餐厅类型表
FsCard *FsCardModel // fs_card 卡号表
FsCardGroup *FsCardGroupModel // fs_card_group 卡号分组表
FsCart *FsCartModel // fs_cart 购物车
FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表
FsCloudDeliverEveryTmpOld *FsCloudDeliverEveryTmpOldModel // fs_cloud_deliver_every_tmp_old
FsCloudDeliverTmpOld *FsCloudDeliverTmpOldModel // fs_cloud_deliver_tmp_old
FsCloudOld *FsCloudOldModel // fs_cloud_old 云仓表
FsCloudPickUpDetailOld *FsCloudPickUpDetailOldModel // fs_cloud_pick_up_detail_old 云仓提货单-详情
FsCloudPickUpOld *FsCloudPickUpOldModel // fs_cloud_pick_up_old 云仓提货单
FsCloudReceiveEveryOld *FsCloudReceiveEveryOldModel // fs_cloud_receive_every_old
FsCloudReceiveOld *FsCloudReceiveOldModel // fs_cloud_receive_old 云仓接收工厂总单
FsCloudRenderLog *FsCloudRenderLogModel // fs_cloud_render_log 云渲染日志表
FsCloudStorage *FsCloudStorageModel // fs_cloud_storage 仓库的基本信息, 只做映射
FsCloudStorageStock *FsCloudStorageStockModel // fs_cloud_storage_stock
FsCloudUserApplyBackOld *FsCloudUserApplyBackOldModel // fs_cloud_user_apply_back_old 该表废弃
FsContact *FsContactModel // fs_contact 该表暂未使用
FsContactService *FsContactServiceModel // fs_contact_service
FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用)
FsDeliver *FsDeliverModel // fs_deliver 发货表 云仓 直发 通用(已废弃)
FsDeliverEvery *FsDeliverEveryModel // fs_deliver_every 发货详细表(已废弃)
FsDepartment *FsDepartmentModel // fs_department 部门表
FsEmailLogs *FsEmailLogsModel // fs_email_logs 邮件日志表
FsEmailTemplate *FsEmailTemplateModel // fs_email_template 邮件模板表(暂未使用)
FsFactory *FsFactoryModel // fs_factory 该表废弃
FsFactoryDeliver *FsFactoryDeliverModel // fs_factory_deliver 工厂发货主表(废弃)
FsFactoryDeliverEvery *FsFactoryDeliverEveryModel // fs_factory_deliver_every 该表废弃
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
FsFaq *FsFaqModel // fs_faq 常见问题
FsFeishuWebhookLog *FsFeishuWebhookLogModel // fs_feishu_webhook_log 飞书webhook记录表
FsFont *FsFontModel // fs_font 字体配置
FsGerent *FsGerentModel // fs_gerent 管理员表
FsGuest *FsGuestModel // fs_guest 游客表
FsLog *FsLogModel // fs_log 日志表
FsLogoCartoon *FsLogoCartoonModel // fs_logo_cartoon logo底图表
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
FsMenu *FsMenuModel // fs_menu 后台菜单
FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表
FsMessageLog *FsMessageLogModel // fs_message_log 消息记录表
FsMigration *FsMigrationModel // fs_migration 版本库
FsOrder *FsOrderModel // fs_order 订单表
FsOrderAffiliateOld *FsOrderAffiliateOldModel // fs_order_affiliate_old 订单附属表-流程控制时间等
FsOrderCombineImageRecord *FsOrderCombineImageRecordModel // fs_order_combine_image_record 刀版图记录表
FsOrderDetailOld *FsOrderDetailOldModel // fs_order_detail_old 订单详细表
FsOrderDetailTemplateOld *FsOrderDetailTemplateOldModel // fs_order_detail_template_old 订单模板详细表
FsOrderOld *FsOrderOldModel // fs_order_old
FsOrderRemarkOld *FsOrderRemarkOldModel // fs_order_remark_old 订单备注表
FsOrderTrade *FsOrderTradeModel // fs_order_trade 订单交易表
FsOrderTradeEvent *FsOrderTradeEventModel // fs_order_trade_event 订单交易事件表
FsPreprocessLogo *FsPreprocessLogoModel // fs_preprocess_logo logo数据表
FsProduct *FsProductModel // fs_product 产品表
FsProductCollection *FsProductCollectionModel // fs_product_collection 产品收藏表
FsProductCopy1 *FsProductCopy1Model // fs_product_copy1 产品表
FsProductDesign *FsProductDesignModel // fs_product_design 产品设计表
FsProductDesignGather *FsProductDesignGatherModel // fs_product_design_gather
FsProductHistoryTemplate *FsProductHistoryTemplateModel // fs_product_history_template 模板历史表
FsProductModel3d *FsProductModel3dModel // fs_product_model3d 产品模型表
FsProductModel3dLight *FsProductModel3dLightModel // fs_product_model3d_light 模型-灯光组表
FsProductOption *FsProductOptionModel // fs_product_option 产品选项表(已废弃)
FsProductPrice *FsProductPriceModel // fs_product_price 阶梯价格表
FsProductRenderDesign *FsProductRenderDesignModel // fs_product_render_design
FsProductScene *FsProductSceneModel // fs_product_scene 产品场景表
FsProductSize *FsProductSizeModel // fs_product_size 产品尺寸表
FsProductTagProp *FsProductTagPropModel // fs_product_tag_prop 产品标签相关属性表
FsProductTemplate *FsProductTemplateModel // fs_product_template 产品模板表(已废弃)
FsProductTemplateBasemap *FsProductTemplateBasemapModel // fs_product_template_basemap 模板底图表
FsProductTemplateElement *FsProductTemplateElementModel // fs_product_template_element 云渲染配置表
FsProductTemplateTags *FsProductTemplateTagsModel // fs_product_template_tags 模板标签表
FsProductTemplateV2 *FsProductTemplateV2Model // fs_product_template_v2 产品-模型- 模板表
FsProductV2Tmp *FsProductV2TmpModel // fs_product_v2_tmp 产品表
FsQrcode *FsQrcodeModel // fs_qrcode
FsQrcodeLog *FsQrcodeLogModel // fs_qrcode_log 二维码扫描日志
FsQrcodeSet *FsQrcodeSetModel // fs_qrcode_set 二维码边框配置表
FsQrcodeUser *FsQrcodeUserModel // fs_qrcode_user 二维码-用户名表
FsQuotation *FsQuotationModel // fs_quotation 报价单信息表
FsQuotationPrice *FsQuotationPriceModel // fs_quotation_price 报价单价格表
FsQuotationProduct *FsQuotationProductModel // fs_quotation_product 报价单产品表
FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板
FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表
FsQuotationSizeLayout *FsQuotationSizeLayoutModel // fs_quotation_size_layout 产品尺寸排版表
FsRefundReason *FsRefundReasonModel // fs_refund_reason
FsResource *FsResourceModel // fs_resource 资源表
FsShoppingCart *FsShoppingCartModel // fs_shopping_cart 新版购物车表
FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo
FsTags *FsTagsModel // fs_tags 产品分类表
FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表
FsToolTemplate *FsToolTemplateModel // fs_tool_template 设计工具模板(废弃)
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
FsTrade *FsTradeModel // fs_trade
FsUser *FsUserModel // fs_user 用户表
FsUserDebug *FsUserDebugModel // fs_user_debug 用户debug
FsUserInfo *FsUserInfoModel // fs_user_info 用户信息表
FsUserMaterial *FsUserMaterialModel // fs_user_material 用户素材表
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
FsZipCode *FsZipCodeModel // fs_zip_code 邮编表
LdapApis *LdapApisModel // ldap_apis api表
LdapGroup *LdapGroupModel // ldap_group 权限组表
LdapMenus *LdapMenusModel // ldap_menus 菜单表
LdapUser *LdapUserModel // ldap_user ldap_用户id递增表
CasbinRule *CasbinRuleModel // casbin_rule 后台--权限规则表
FsAddress *FsAddressModel // fs_address 用户地址表
FsAdminApi *FsAdminApiModel // fs_admin_api 后台--接口表
FsAdminDepartment *FsAdminDepartmentModel // fs_admin_department 后台--部门表
FsAdminMenu *FsAdminMenuModel // fs_admin_menu 后台--菜单表
FsAdminRole *FsAdminRoleModel // fs_admin_role 后台--角色表
FsAdminRoleApi *FsAdminRoleApiModel // fs_admin_role_api 后台--角色接口表
FsAdminUser *FsAdminUserModel // fs_admin_user 后台--管理员表
FsAuthAssignment *FsAuthAssignmentModel // fs_auth_assignment 用户角色和权限信息
FsAuthItem *FsAuthItemModel // fs_auth_item 用户角色和权限信息
FsAuthItemChild *FsAuthItemChildModel // fs_auth_item_child 角色和权限关系表
FsAuthRule *FsAuthRuleModel // fs_auth_rule 规则表
FsBackendUser *FsBackendUserModel // fs_backend_user 管理员表
FsCanteenProduct *FsCanteenProductModel // fs_canteen_product 餐厅类别产品对应表
FsCanteenType *FsCanteenTypeModel // fs_canteen_type 餐厅类型表
FsCard *FsCardModel // fs_card 卡号表
FsCardGroup *FsCardGroupModel // fs_card_group 卡号分组表
FsCart *FsCartModel // fs_cart 购物车
FsChangeCode *FsChangeCodeModel // fs_change_code 忘记密码code表
FsCloudDeliverEveryTmpOld *FsCloudDeliverEveryTmpOldModel // fs_cloud_deliver_every_tmp_old
FsCloudDeliverTmpOld *FsCloudDeliverTmpOldModel // fs_cloud_deliver_tmp_old
FsCloudOld *FsCloudOldModel // fs_cloud_old 云仓表
FsCloudPickUpDetailOld *FsCloudPickUpDetailOldModel // fs_cloud_pick_up_detail_old 云仓提货单-详情
FsCloudPickUpOld *FsCloudPickUpOldModel // fs_cloud_pick_up_old 云仓提货单
FsCloudReceiveEveryOld *FsCloudReceiveEveryOldModel // fs_cloud_receive_every_old
FsCloudReceiveOld *FsCloudReceiveOldModel // fs_cloud_receive_old 云仓接收工厂总单
FsCloudRenderLogOld *FsCloudRenderLogOldModel // fs_cloud_render_log_old 云渲染日志表
FsCloudStorage *FsCloudStorageModel // fs_cloud_storage 仓库的基本信息, 只做映射
FsCloudStorageStock *FsCloudStorageStockModel // fs_cloud_storage_stock
FsCloudUserApplyBackOld *FsCloudUserApplyBackOldModel // fs_cloud_user_apply_back_old 该表废弃
FsContact *FsContactModel // fs_contact 该表暂未使用
FsContactService *FsContactServiceModel // fs_contact_service
FsCoupon *FsCouponModel // fs_coupon 代金券(暂未使用)
FsDeliver *FsDeliverModel // fs_deliver 发货表 云仓 直发 通用(已废弃)
FsDeliverEvery *FsDeliverEveryModel // fs_deliver_every 发货详细表(已废弃)
FsDepartment *FsDepartmentModel // fs_department 部门表
FsEmailLogs *FsEmailLogsModel // fs_email_logs 邮件日志表
FsEmailTemplate *FsEmailTemplateModel // fs_email_template 邮件模板表(暂未使用)
FsFactory *FsFactoryModel // fs_factory 该表废弃
FsFactoryDeliver *FsFactoryDeliverModel // fs_factory_deliver 工厂发货主表(废弃)
FsFactoryDeliverEvery *FsFactoryDeliverEveryModel // fs_factory_deliver_every 该表废弃
FsFactoryProduct *FsFactoryProductModel // fs_factory_product 工厂生产表(废弃)
FsFactoryShipTmp *FsFactoryShipTmpModel // fs_factory_ship_tmp
FsFaq *FsFaqModel // fs_faq 常见问题
FsFont *FsFontModel // fs_font 字体配置
FsGerent *FsGerentModel // fs_gerent 管理员表
FsGuest *FsGuestModel // fs_guest 游客表
FsLog *FsLogModel // fs_log 日志表
FsLogoCartoon *FsLogoCartoonModel // fs_logo_cartoon logo底图表
FsMapLibrary *FsMapLibraryModel // fs_map_library 贴图库
FsMenu *FsMenuModel // fs_menu 后台菜单
FsMerchantCategory *FsMerchantCategoryModel // fs_merchant_category 商户类型表
FsMigration *FsMigrationModel // fs_migration 版本库
FsOrder *FsOrderModel // fs_order 订单表
FsOrderAffiliateOld *FsOrderAffiliateOldModel // fs_order_affiliate_old 订单附属表-流程控制时间等
FsOrderDetailOld *FsOrderDetailOldModel // fs_order_detail_old 订单详细表
FsOrderDetailTemplateOld *FsOrderDetailTemplateOldModel // fs_order_detail_template_old 订单模板详细表
FsOrderOld *FsOrderOldModel // fs_order_old
FsOrderRemarkOld *FsOrderRemarkOldModel // fs_order_remark_old 订单备注表
FsOrderTrade *FsOrderTradeModel // fs_order_trade 订单交易表
FsOrderTradeEvent *FsOrderTradeEventModel // fs_order_trade_event 订单交易事件表
FsPay *FsPayModel // fs_pay 支付记录
FsPayEvent *FsPayEventModel // fs_pay_event 支付回调事件日志
FsProduct *FsProductModel // fs_product 产品表
FsProductCollection *FsProductCollectionModel // fs_product_collection 产品收藏表
FsProductCopy1 *FsProductCopy1Model // fs_product_copy1 产品表
FsProductDesign *FsProductDesignModel // fs_product_design 产品设计表
FsProductDesignGather *FsProductDesignGatherModel // fs_product_design_gather
FsProductModel3d *FsProductModel3dModel // fs_product_model3d 产品模型表
FsProductModel3dLight *FsProductModel3dLightModel // fs_product_model3d_light 模型-灯光组表
FsProductOption *FsProductOptionModel // fs_product_option 产品选项表(已废弃)
FsProductPrice *FsProductPriceModel // fs_product_price 阶梯价格表
FsProductRenderDesign *FsProductRenderDesignModel // fs_product_render_design
FsProductScene *FsProductSceneModel // fs_product_scene 产品场景表
FsProductSize *FsProductSizeModel // fs_product_size 产品尺寸表
FsProductTagProp *FsProductTagPropModel // fs_product_tag_prop 产品标签相关属性表
FsProductTemplate *FsProductTemplateModel // fs_product_template 产品模板表(已废弃)
FsProductTemplateBasemap *FsProductTemplateBasemapModel // fs_product_template_basemap 模板底图表
FsProductTemplateElement *FsProductTemplateElementModel // fs_product_template_element 云渲染配置表
FsProductTemplateElement22 *FsProductTemplateElement22Model // fs_product_template_element_22
FsProductTemplateTags *FsProductTemplateTagsModel // fs_product_template_tags 模板标签表
FsProductTemplateV2 *FsProductTemplateV2Model // fs_product_template_v2 产品-模型-模板表
FsProductV2Tmp *FsProductV2TmpModel // fs_product_v2_tmp 产品表
FsQrcode *FsQrcodeModel // fs_qrcode
FsQrcodeLog *FsQrcodeLogModel // fs_qrcode_log 二维码扫描日志
FsQrcodeSet *FsQrcodeSetModel // fs_qrcode_set 二维码边框配置表
FsQrcodeUser *FsQrcodeUserModel // fs_qrcode_user 二维码-用户名表
FsQuotation *FsQuotationModel // fs_quotation 报价单信息表
FsQuotationPrice *FsQuotationPriceModel // fs_quotation_price 报价单价格表
FsQuotationProduct *FsQuotationProductModel // fs_quotation_product 报价单产品表
FsQuotationRemarkTemplate *FsQuotationRemarkTemplateModel // fs_quotation_remark_template 报价单备注模板
FsQuotationSaler *FsQuotationSalerModel // fs_quotation_saler 报价单业务员表
FsQuotationSizeLayout *FsQuotationSizeLayoutModel // fs_quotation_size_layout 产品尺寸排版表
FsRefundReason *FsRefundReasonModel // fs_refund_reason
FsResource *FsResourceModel // fs_resource 资源表
FsShoppingCart *FsShoppingCartModel // fs_shopping_cart 新版购物车表
FsStandardLogo *FsStandardLogoModel // fs_standard_logo 标准logo
FsTags *FsTagsModel // fs_tags 产品分类表
FsToolLogs *FsToolLogsModel // fs_tool_logs 3d设计工具日志表
FsToolTemplate *FsToolTemplateModel // fs_tool_template 设计工具模板(废弃)
FsToolUser *FsToolUserModel // fs_tool_user 3d设计工具用户表
FsTrade *FsTradeModel // fs_trade
FsUser *FsUserModel // fs_user 用户表
FsUserDesign *FsUserDesignModel // fs_user_design 废弃表
FsUserInfo *FsUserInfoModel // fs_user_info 用户信息表
FsUserMaterial *FsUserMaterialModel // fs_user_material 用户素材表
FsUserStock *FsUserStockModel // fs_user_stock 用户云仓库存
FsWebSet *FsWebSetModel // fs_web_set 网站配置表
}
func NewAllModels(gdb *gorm.DB) *AllModelsGen {
models := &AllModelsGen{
CasbinRule: NewCasbinRuleModel(gdb),
FsAddress: NewFsAddressModel(gdb),
FsAuthAssignment: NewFsAuthAssignmentModel(gdb),
FsAuthItem: NewFsAuthItemModel(gdb),
FsAuthItemChild: NewFsAuthItemChildModel(gdb),
FsAuthRule: NewFsAuthRuleModel(gdb),
FsBackendUser: NewFsBackendUserModel(gdb),
FsCanteenProduct: NewFsCanteenProductModel(gdb),
FsCanteenType: NewFsCanteenTypeModel(gdb),
FsCard: NewFsCardModel(gdb),
FsCardGroup: NewFsCardGroupModel(gdb),
FsCart: NewFsCartModel(gdb),
FsChangeCode: NewFsChangeCodeModel(gdb),
FsCloudDeliverEveryTmpOld: NewFsCloudDeliverEveryTmpOldModel(gdb),
FsCloudDeliverTmpOld: NewFsCloudDeliverTmpOldModel(gdb),
FsCloudOld: NewFsCloudOldModel(gdb),
FsCloudPickUpDetailOld: NewFsCloudPickUpDetailOldModel(gdb),
FsCloudPickUpOld: NewFsCloudPickUpOldModel(gdb),
FsCloudReceiveEveryOld: NewFsCloudReceiveEveryOldModel(gdb),
FsCloudReceiveOld: NewFsCloudReceiveOldModel(gdb),
FsCloudRenderLog: NewFsCloudRenderLogModel(gdb),
FsCloudStorage: NewFsCloudStorageModel(gdb),
FsCloudStorageStock: NewFsCloudStorageStockModel(gdb),
FsCloudUserApplyBackOld: NewFsCloudUserApplyBackOldModel(gdb),
FsContact: NewFsContactModel(gdb),
FsContactService: NewFsContactServiceModel(gdb),
FsCoupon: NewFsCouponModel(gdb),
FsDeliver: NewFsDeliverModel(gdb),
FsDeliverEvery: NewFsDeliverEveryModel(gdb),
FsDepartment: NewFsDepartmentModel(gdb),
FsEmailLogs: NewFsEmailLogsModel(gdb),
FsEmailTemplate: NewFsEmailTemplateModel(gdb),
FsFactory: NewFsFactoryModel(gdb),
FsFactoryDeliver: NewFsFactoryDeliverModel(gdb),
FsFactoryDeliverEvery: NewFsFactoryDeliverEveryModel(gdb),
FsFactoryProduct: NewFsFactoryProductModel(gdb),
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
FsFaq: NewFsFaqModel(gdb),
FsFeishuWebhookLog: NewFsFeishuWebhookLogModel(gdb),
FsFont: NewFsFontModel(gdb),
FsGerent: NewFsGerentModel(gdb),
FsGuest: NewFsGuestModel(gdb),
FsLog: NewFsLogModel(gdb),
FsLogoCartoon: NewFsLogoCartoonModel(gdb),
FsMapLibrary: NewFsMapLibraryModel(gdb),
FsMenu: NewFsMenuModel(gdb),
FsMerchantCategory: NewFsMerchantCategoryModel(gdb),
FsMessageLog: NewFsMessageLogModel(gdb),
FsMigration: NewFsMigrationModel(gdb),
FsOrder: NewFsOrderModel(gdb),
FsOrderAffiliateOld: NewFsOrderAffiliateOldModel(gdb),
FsOrderCombineImageRecord: NewFsOrderCombineImageRecordModel(gdb),
FsOrderDetailOld: NewFsOrderDetailOldModel(gdb),
FsOrderDetailTemplateOld: NewFsOrderDetailTemplateOldModel(gdb),
FsOrderOld: NewFsOrderOldModel(gdb),
FsOrderRemarkOld: NewFsOrderRemarkOldModel(gdb),
FsOrderTrade: NewFsOrderTradeModel(gdb),
FsOrderTradeEvent: NewFsOrderTradeEventModel(gdb),
FsPreprocessLogo: NewFsPreprocessLogoModel(gdb),
FsProduct: NewFsProductModel(gdb),
FsProductCollection: NewFsProductCollectionModel(gdb),
FsProductCopy1: NewFsProductCopy1Model(gdb),
FsProductDesign: NewFsProductDesignModel(gdb),
FsProductDesignGather: NewFsProductDesignGatherModel(gdb),
FsProductHistoryTemplate: NewFsProductHistoryTemplateModel(gdb),
FsProductModel3d: NewFsProductModel3dModel(gdb),
FsProductModel3dLight: NewFsProductModel3dLightModel(gdb),
FsProductOption: NewFsProductOptionModel(gdb),
FsProductPrice: NewFsProductPriceModel(gdb),
FsProductRenderDesign: NewFsProductRenderDesignModel(gdb),
FsProductScene: NewFsProductSceneModel(gdb),
FsProductSize: NewFsProductSizeModel(gdb),
FsProductTagProp: NewFsProductTagPropModel(gdb),
FsProductTemplate: NewFsProductTemplateModel(gdb),
FsProductTemplateBasemap: NewFsProductTemplateBasemapModel(gdb),
FsProductTemplateElement: NewFsProductTemplateElementModel(gdb),
FsProductTemplateTags: NewFsProductTemplateTagsModel(gdb),
FsProductTemplateV2: NewFsProductTemplateV2Model(gdb),
FsProductV2Tmp: NewFsProductV2TmpModel(gdb),
FsQrcode: NewFsQrcodeModel(gdb),
FsQrcodeLog: NewFsQrcodeLogModel(gdb),
FsQrcodeSet: NewFsQrcodeSetModel(gdb),
FsQrcodeUser: NewFsQrcodeUserModel(gdb),
FsQuotation: NewFsQuotationModel(gdb),
FsQuotationPrice: NewFsQuotationPriceModel(gdb),
FsQuotationProduct: NewFsQuotationProductModel(gdb),
FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb),
FsQuotationSaler: NewFsQuotationSalerModel(gdb),
FsQuotationSizeLayout: NewFsQuotationSizeLayoutModel(gdb),
FsRefundReason: NewFsRefundReasonModel(gdb),
FsResource: NewFsResourceModel(gdb),
FsShoppingCart: NewFsShoppingCartModel(gdb),
FsStandardLogo: NewFsStandardLogoModel(gdb),
FsTags: NewFsTagsModel(gdb),
FsToolLogs: NewFsToolLogsModel(gdb),
FsToolTemplate: NewFsToolTemplateModel(gdb),
FsToolUser: NewFsToolUserModel(gdb),
FsTrade: NewFsTradeModel(gdb),
FsUser: NewFsUserModel(gdb),
FsUserDebug: NewFsUserDebugModel(gdb),
FsUserInfo: NewFsUserInfoModel(gdb),
FsUserMaterial: NewFsUserMaterialModel(gdb),
FsUserStock: NewFsUserStockModel(gdb),
FsWebSet: NewFsWebSetModel(gdb),
FsZipCode: NewFsZipCodeModel(gdb),
LdapApis: NewLdapApisModel(gdb),
LdapGroup: NewLdapGroupModel(gdb),
LdapMenus: NewLdapMenusModel(gdb),
LdapUser: NewLdapUserModel(gdb),
CasbinRule: NewCasbinRuleModel(gdb),
FsAddress: NewFsAddressModel(gdb),
FsAdminApi: NewFsAdminApiModel(gdb),
FsAdminDepartment: NewFsAdminDepartmentModel(gdb),
FsAdminMenu: NewFsAdminMenuModel(gdb),
FsAdminRole: NewFsAdminRoleModel(gdb),
FsAdminRoleApi: NewFsAdminRoleApiModel(gdb),
FsAdminUser: NewFsAdminUserModel(gdb),
FsAuthAssignment: NewFsAuthAssignmentModel(gdb),
FsAuthItem: NewFsAuthItemModel(gdb),
FsAuthItemChild: NewFsAuthItemChildModel(gdb),
FsAuthRule: NewFsAuthRuleModel(gdb),
FsBackendUser: NewFsBackendUserModel(gdb),
FsCanteenProduct: NewFsCanteenProductModel(gdb),
FsCanteenType: NewFsCanteenTypeModel(gdb),
FsCard: NewFsCardModel(gdb),
FsCardGroup: NewFsCardGroupModel(gdb),
FsCart: NewFsCartModel(gdb),
FsChangeCode: NewFsChangeCodeModel(gdb),
FsCloudDeliverEveryTmpOld: NewFsCloudDeliverEveryTmpOldModel(gdb),
FsCloudDeliverTmpOld: NewFsCloudDeliverTmpOldModel(gdb),
FsCloudOld: NewFsCloudOldModel(gdb),
FsCloudPickUpDetailOld: NewFsCloudPickUpDetailOldModel(gdb),
FsCloudPickUpOld: NewFsCloudPickUpOldModel(gdb),
FsCloudReceiveEveryOld: NewFsCloudReceiveEveryOldModel(gdb),
FsCloudReceiveOld: NewFsCloudReceiveOldModel(gdb),
FsCloudRenderLogOld: NewFsCloudRenderLogOldModel(gdb),
FsCloudStorage: NewFsCloudStorageModel(gdb),
FsCloudStorageStock: NewFsCloudStorageStockModel(gdb),
FsCloudUserApplyBackOld: NewFsCloudUserApplyBackOldModel(gdb),
FsContact: NewFsContactModel(gdb),
FsContactService: NewFsContactServiceModel(gdb),
FsCoupon: NewFsCouponModel(gdb),
FsDeliver: NewFsDeliverModel(gdb),
FsDeliverEvery: NewFsDeliverEveryModel(gdb),
FsDepartment: NewFsDepartmentModel(gdb),
FsEmailLogs: NewFsEmailLogsModel(gdb),
FsEmailTemplate: NewFsEmailTemplateModel(gdb),
FsFactory: NewFsFactoryModel(gdb),
FsFactoryDeliver: NewFsFactoryDeliverModel(gdb),
FsFactoryDeliverEvery: NewFsFactoryDeliverEveryModel(gdb),
FsFactoryProduct: NewFsFactoryProductModel(gdb),
FsFactoryShipTmp: NewFsFactoryShipTmpModel(gdb),
FsFaq: NewFsFaqModel(gdb),
FsFont: NewFsFontModel(gdb),
FsGerent: NewFsGerentModel(gdb),
FsGuest: NewFsGuestModel(gdb),
FsLog: NewFsLogModel(gdb),
FsLogoCartoon: NewFsLogoCartoonModel(gdb),
FsMapLibrary: NewFsMapLibraryModel(gdb),
FsMenu: NewFsMenuModel(gdb),
FsMerchantCategory: NewFsMerchantCategoryModel(gdb),
FsMigration: NewFsMigrationModel(gdb),
FsOrder: NewFsOrderModel(gdb),
FsOrderAffiliateOld: NewFsOrderAffiliateOldModel(gdb),
FsOrderDetailOld: NewFsOrderDetailOldModel(gdb),
FsOrderDetailTemplateOld: NewFsOrderDetailTemplateOldModel(gdb),
FsOrderOld: NewFsOrderOldModel(gdb),
FsOrderRemarkOld: NewFsOrderRemarkOldModel(gdb),
FsOrderTrade: NewFsOrderTradeModel(gdb),
FsOrderTradeEvent: NewFsOrderTradeEventModel(gdb),
FsPay: NewFsPayModel(gdb),
FsPayEvent: NewFsPayEventModel(gdb),
FsProduct: NewFsProductModel(gdb),
FsProductCollection: NewFsProductCollectionModel(gdb),
FsProductCopy1: NewFsProductCopy1Model(gdb),
FsProductDesign: NewFsProductDesignModel(gdb),
FsProductDesignGather: NewFsProductDesignGatherModel(gdb),
FsProductModel3d: NewFsProductModel3dModel(gdb),
FsProductModel3dLight: NewFsProductModel3dLightModel(gdb),
FsProductOption: NewFsProductOptionModel(gdb),
FsProductPrice: NewFsProductPriceModel(gdb),
FsProductRenderDesign: NewFsProductRenderDesignModel(gdb),
FsProductScene: NewFsProductSceneModel(gdb),
FsProductSize: NewFsProductSizeModel(gdb),
FsProductTagProp: NewFsProductTagPropModel(gdb),
FsProductTemplate: NewFsProductTemplateModel(gdb),
FsProductTemplateBasemap: NewFsProductTemplateBasemapModel(gdb),
FsProductTemplateElement: NewFsProductTemplateElementModel(gdb),
FsProductTemplateElement22: NewFsProductTemplateElement22Model(gdb),
FsProductTemplateTags: NewFsProductTemplateTagsModel(gdb),
FsProductTemplateV2: NewFsProductTemplateV2Model(gdb),
FsProductV2Tmp: NewFsProductV2TmpModel(gdb),
FsQrcode: NewFsQrcodeModel(gdb),
FsQrcodeLog: NewFsQrcodeLogModel(gdb),
FsQrcodeSet: NewFsQrcodeSetModel(gdb),
FsQrcodeUser: NewFsQrcodeUserModel(gdb),
FsQuotation: NewFsQuotationModel(gdb),
FsQuotationPrice: NewFsQuotationPriceModel(gdb),
FsQuotationProduct: NewFsQuotationProductModel(gdb),
FsQuotationRemarkTemplate: NewFsQuotationRemarkTemplateModel(gdb),
FsQuotationSaler: NewFsQuotationSalerModel(gdb),
FsQuotationSizeLayout: NewFsQuotationSizeLayoutModel(gdb),
FsRefundReason: NewFsRefundReasonModel(gdb),
FsResource: NewFsResourceModel(gdb),
FsShoppingCart: NewFsShoppingCartModel(gdb),
FsStandardLogo: NewFsStandardLogoModel(gdb),
FsTags: NewFsTagsModel(gdb),
FsToolLogs: NewFsToolLogsModel(gdb),
FsToolTemplate: NewFsToolTemplateModel(gdb),
FsToolUser: NewFsToolUserModel(gdb),
FsTrade: NewFsTradeModel(gdb),
FsUser: NewFsUserModel(gdb),
FsUserDesign: NewFsUserDesignModel(gdb),
FsUserInfo: NewFsUserInfoModel(gdb),
FsUserMaterial: NewFsUserMaterialModel(gdb),
FsUserStock: NewFsUserStockModel(gdb),
FsWebSet: NewFsWebSetModel(gdb),
}
return models
}

View File

@ -100,7 +100,7 @@ func main() {
indexHtmlPath := vueBuild + "/index.html"
mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if strings.HasPrefix(r.URL.Path, "/api/") {
r.ParseMultipartForm(500 << 20)
r.ParseMultipartForm(100 << 20)
// 对/api开头的请求进行反向代理
proxy := httputil.NewSingleHostReverseProxy(apiURL)
proxy.ServeHTTP(w, r)
@ -179,14 +179,14 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac
client := &http.Client{
Transport: &http.Transport{
DialContext: (&net.Dialer{
Timeout: 1500 * time.Second,
KeepAlive: 120 * time.Second,
Timeout: 300 * time.Second,
KeepAlive: 60 * time.Second,
}).DialContext,
ForceAttemptHTTP2: true,
MaxIdleConns: 200,
MaxIdleConnsPerHost: 200,
IdleConnTimeout: 600 * time.Second,
TLSHandshakeTimeout: 600 * time.Second,
MaxIdleConns: 100,
MaxIdleConnsPerHost: 100,
IdleConnTimeout: 300 * time.Second,
TLSHandshakeTimeout: 300 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}

View File

@ -13,9 +13,6 @@ Auth:
AccessExpire: 2592000
RefreshAfter: 1592000
Debug:
Password: "fusen-test-pwd"
OAuth:
google:
appid: "1064842923358-e94msq2glj6qr4lrva9ts3hqjjt53q8h.apps.googleusercontent.com"

View File

@ -16,11 +16,6 @@ type Config struct {
MainAddress string
WebsocketAddr string
Debug struct {
Password string
}
// Password: "fusen-test-pwd"
OAuth struct {
Google struct {
Appid string

View File

@ -27,11 +27,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/auth/accept-cookie",
Handler: AcceptCookieHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/auth/debug/token/create",
Handler: UserDebugTokenHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/auth/oauth2/login/google",

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/auth/internal/logic"
"fusenapi/server/auth/internal/svc"
"fusenapi/server/auth/internal/types"
)
func UserDebugTokenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestUserDebug
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewUserDebugTokenLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.UserDebugToken(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -36,7 +36,7 @@ func (l *DebugAuthDeleteLogic) DebugAuthDelete(req *types.RequestAuthDelete, use
err := l.svcCtx.AllModels.FsUser.DebugAuthDelete(l.ctx, req.Email)
if err != nil {
return resp.SetStatus(basic.CodeDbSqlErr, err)
return resp.SetStatus(basic.CodeDbSqlErr, err.Error())
}
return resp.SetStatus(basic.CodeOK)

View File

@ -1,63 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"time"
"context"
"fusenapi/server/auth/internal/svc"
"fusenapi/server/auth/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type UserDebugTokenLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUserDebugTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserDebugTokenLogic {
return &UserDebugTokenLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *UserDebugTokenLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *UserDebugTokenLogic) UserDebugToken(req *types.RequestUserDebug, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if req.Password != l.svcCtx.Config.Debug.Password {
return resp.SetStatusAddMessage(basic.CodeApiErr, "密码错误")
}
var accessExpire int64 = 3600
if req.Exp != nil {
accessExpire = *req.Exp
}
debug := &auth.Debug{
IsCache: req.IsCache,
IsAllTemplateTag: req.IsAllTemplateTag,
}
dtoken, err := auth.GenerateBaseJwtTokenUint64(auth.DefaultDebugJwtSecret, accessExpire, time.Now().UTC().Unix(), debug)
if err != nil {
return resp.SetStatusWithMessage(basic.CodeApiErr, "GenerateBaseJwtTokenUint64错误")
}
return resp.SetStatus(basic.CodeOK, map[string]any{
"debug_token": dtoken,
})
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *UserDebugTokenLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -88,7 +88,7 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
user, err := l.svcCtx.AllModels.FsUser.RegisterByGoogleOAuth(l.ctx, token)
if err != nil {
logx.Error(err, token.TraceId)
return resp.SetStatus(basic.CodeDbSqlErr, err)
return resp.SetStatus(basic.CodeDbSqlErr, err.Error())
}
err = FinishRegister(l.svcCtx, user, token)
@ -117,7 +117,7 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
rt, err := l.svcCtx.ResetTokenManger.Decrypt(req.Token) // ResetToken
if err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeOAuthResetTokenDecryptErr, err)
return resp.SetStatus(basic.CodeOAuthResetTokenDecryptErr, err.Error())
}
if time.Since(rt.CreateAt) > 30*time.Minute {
@ -126,7 +126,7 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
// TODO: 存储
if rt.OperateType != auth.OpTypeResetToken {
return resp.SetStatus(basic.CodeOAuthTypeErr, fmt.Errorf("error OperateType: rt.OperateType != auth.OpTypeResetToken"))
return resp.SetStatus(basic.CodeOAuthTypeErr, "error OperateType: rt.OperateType != auth.OpTypeResetToken")
}
err = l.svcCtx.AllModels.FsUser.Transaction(l.ctx, func(tx *gorm.DB) error {
@ -142,14 +142,14 @@ func (l *UserEmailConfirmationLogic) UserEmailConfirmation(req *types.RequestEma
})
if err != nil {
return resp.SetStatus(basic.CodeDbSqlErr, err)
return resp.SetStatus(basic.CodeDbSqlErr, err.Error())
}
event := wevent.NewWebsocketEventSuccess(wevent.UserResetToken, rt.TraceId)
err = wevent.CommonNotify(l.svcCtx.Config.MainAddress, rt.Wid, event)
if err != nil {
logx.Error(err, rt.TraceId)
return resp.SetStatus(basic.CodeResetPasswordErr, err)
return resp.SetStatus(basic.CodeResetPasswordErr, err.Error())
}
return resp.SetStatus(basic.CodeOK)

View File

@ -64,13 +64,13 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
token, err := googleOauthConfig.Exchange(l.ctx, req.Code)
if err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeApiErr, err)
return resp.SetStatus(basic.CodeApiErr, err.Error())
}
r, err := requests.Get("https://www.googleapis.com/oauth2/v2/userinfo?access_token=" + token.AccessToken).Execute()
if err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeOAuthGoogleApiErr, err)
return resp.SetStatus(basic.CodeOAuthGoogleApiErr, err.Error())
}
gresult := r.Json()

View File

@ -45,10 +45,10 @@ func (l *UserRegisterLogic) UserRegister(req *types.RequestUserRegister, userinf
return resp.SetStatusWithMessage(basic.CodeOAuthEmailErr, "email len must < 50")
}
_, err := l.svcCtx.AllModels.FsUser.FindUserByEmail(l.ctx, req.Email)
if err == nil {
return resp.SetStatus(basic.CodeEmailExistsErr)
}
// _, err := l.svcCtx.AllModels.FsUser.FindUserByEmail(l.ctx, req.Email)
// if err == nil {
// return resp.SetStatus(basic.CodeEmailExistsErr)
// }
if !TimeLimit.Is(req.Email) {
return resp.SetStatus(basic.CodeEmailTimeShortErr)

View File

@ -39,19 +39,19 @@ func (l *UserResetPasswordLogic) UserResetPassword(req *types.RequestUserResetPa
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if len(req.NewPassword) > 64 {
return resp.SetStatusWithMessage(basic.CodePasswordErr, "password len must < 64")
if len(req.NewPassword) > 30 {
return resp.SetStatusWithMessage(basic.CodePasswordErr, "password len must < 30")
}
rt, err := l.svcCtx.ResetTokenManger.Decrypt(req.ResetToken) // ResetToken
if err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeOAuthResetTokenDecryptErr, err)
return resp.SetStatus(basic.CodeOAuthResetTokenDecryptErr, err.Error())
}
// TODO: 存储
if rt.OperateType != auth.OpTypeResetToken {
return resp.SetStatus(basic.CodeOAuthTypeErr, fmt.Errorf("error OperateType: rt.OperateType != auth.OpTypeResetToken"))
return resp.SetStatus(basic.CodeOAuthTypeErr, "error OperateType: rt.OperateType != auth.OpTypeResetToken")
}
if time.Since(rt.CreateAt) > 30*time.Minute {

View File

@ -56,7 +56,7 @@ func (l *UserResetTokenLogic) UserResetToken(req *types.RequestUserResetToken, u
resetToken, err := l.svcCtx.ResetTokenManger.Encrypt(token)
if err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeOAuthResetTokenEncryptErr, err)
return resp.SetStatus(basic.CodeOAuthResetTokenEncryptErr, err.Error())
}
userName := *user.FirstName + " " + *user.LastName

View File

@ -26,55 +26,48 @@ func TestEmailSend(t *testing.T) {
// 设置发件人和收件人信息
from := "support@fusenpack.com"
to := []string{"474420502@qq.com"}
// to := []string{"qq474420502@gmail.com"}
// to := []string{"outlook_7D27A8300A1B3F01@outlook.com"}
// 设置smtp服务器地址,端口和认证信息
smtpServer := "smtp.gmail.com"
auth := smtp.PlainAuth("", "support@fusenpack.com", "wfbjpdgvaozjvwah", smtpServer)
var buf bytes.Buffer
tpls.ExecuteTemplate(&buf, "test.tpl", map[string]any{
"CompanyName": "FusenPack",
})
msg := []byte(`Subject: Password Reset Request for Your Account;
MIME-version: 1.0;
Content-Type: text/html; charset="UTF-8";
From: "Fusen";
// msg := []byte(`Subject: Password Reset Request for Your Account;
// MIME-version: 1.0;
// Content-Type: text/html; charset="UTF-8";
// From: "Fusen";
// <html>
// <head>
// <title>Password Reset for Your {{.CompanyName}} Account</title>
// </head>
// <body>
<html>
<head>
<title>Password Reset for Your {{.CompanyName}} Account</title>
</head>
<body>
// <p>Dear {{.UserName}},</p>
<p>Dear {{.UserName}},</p>
// <p>We have received your request to reset the password for your {{.CompanyName}} account.</p>
<p>We have received your request to reset the password for your {{.CompanyName}} account.</p>
// <p>To proceed with the password reset, please click the button below to open the Reset Password page:</p>
<p>To proceed with the password reset, please click the button below to open the Reset Password page:</p>
// <div style="margin: 1em 0;">
// <a href="{{.ConfirmationLink}}" target="_blank"
// style="background-color: #008CBA; color: #FFFFFF; text-decoration: none; padding: 10px 15px; border-radius: 3px; display:inline-block;">
// Reset Password
// </a>
// </div>
<div style="margin: 1em 0;">
<a href="{{.ConfirmationLink}}" target="_blank"
style="background-color: #008CBA; color: #FFFFFF; text-decoration: none; padding: 10px 15px; border-radius: 3px; display:inline-block;">
Reset Password
</a>
</div>
// <p>Please note that this password reset confirmation link will expire in 60 minutes. If you have any further questions, feel free to reach out to us.</p>
<p>Please note that this password reset confirmation link will expire in 60 minutes. If you have any further questions, feel free to reach out to us.</p>
// <p>Regards,</p>
<p>Regards,</p>
// <p>{{.SenderName}}<br>
// {{.SenderTitle}}<br>
// {{.CompanyName}}</p>
<p>{{.SenderName}}<br>
{{.SenderTitle}}<br>
{{.CompanyName}}</p>
// </body>
// </html>`)
</body>
</html>`)
msg := buf.Bytes()
// 发送邮件
err := smtp.SendMail(smtpServer+":587", auth, from, to, msg)
if err != nil {

View File

@ -5,13 +5,6 @@ import (
"fusenapi/utils/basic"
)
type RequestUserDebug struct {
Password string `json:"password"` // 密码,内部使用都是明文
Exp *int64 `json:"exp"` // 过期时间, 不发默认一天
IsCache int64 `json:"is_cache"` // 是否缓存
IsAllTemplateTag int64 `json:"is_all_template_tag"` // 是开启全部模板
}
type RequestAuthDelete struct {
Email string `json:"email"`
}
@ -97,10 +90,10 @@ type File struct {
}
type Meta struct {
TotalCount int64 `json:"total_count"`
PageCount int64 `json:"page_count"`
CurrentPage int `json:"current_page"`
PerPage int `json:"per_page"`
TotalCount int64 `json:"totalCount"`
PageCount int64 `json:"pageCount"`
CurrentPage int `json:"currentPage"`
PerPage int `json:"perPage"`
}
// Set 设置Response的Code和Message值

View File

@ -61,6 +61,7 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
now := time.Now().UTC().Unix()
//开启事务
err = l.svcCtx.MysqlConn.Transaction(func(tx *gorm.DB) error {
canteenProductModel = gmodel.NewFsCanteenProductModel(tx)
sort := int64(0)
//新的变更记录
mapUpdateCanteenPid := make(map[int64]struct{})
@ -72,12 +73,12 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
}
if v.Id > 0 { //更新
mapUpdateCanteenPid[v.Id] = struct{}{}
err = tx.WithContext(l.ctx).Model(&gmodel.FsCanteenProduct{}).Where("id = ?", v.Id).Updates(&gmodel.FsCanteenProduct{
err = canteenProductModel.UpdateById(l.ctx, v.Id, &gmodel.FsCanteenProduct{
SizeId: &v.SizeId,
Sid: &v.SId,
Sort: &sort,
ProductId: sizeInfo.ProductId,
}).Error
})
if err != nil {
return err
}
@ -85,7 +86,7 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
}
//新增
addStatus := int64(1)
err = tx.WithContext(l.ctx).Model(&gmodel.FsCanteenProduct{}).Create(&gmodel.FsCanteenProduct{
err = canteenProductModel.Create(l.ctx, &gmodel.FsCanteenProduct{
SizeId: &v.SizeId,
Sid: &v.SId,
Sort: &sort,
@ -93,7 +94,7 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
Ctime: &now,
CanteenType: &req.Id,
ProductId: sizeInfo.ProductId,
}).Error
})
if err != nil {
return err
}
@ -109,9 +110,9 @@ func (l *SaveCanteenTypeProductLogic) SaveCanteenTypeProduct(req *types.SaveCant
return nil
}
delStatus := int64(0)
if err = tx.WithContext(l.ctx).Model(&gmodel.FsCanteenProduct{}).Where("id in (?)", diffCanteenProductId).Updates(&gmodel.FsCanteenProduct{
if err = canteenProductModel.UpdateByIdArr(l.ctx, diffCanteenProductId, &gmodel.FsCanteenProduct{
Status: &delStatus,
}).Error; err != nil {
}); err != nil {
return err
}
return nil

View File

@ -27,6 +27,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/collection/get_collect_product_list",
Handler: GetCollectProductListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/collection/test_ai",
Handler: TestAiHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/collection/test_pdf",
Handler: TestPdfHandler(serverCtx),
},
},
)
}

View File

@ -6,27 +6,27 @@ import (
"fusenapi/utils/basic"
"fusenapi/server/websocket/internal/logic"
"fusenapi/server/websocket/internal/svc"
"fusenapi/server/websocket/internal/types"
"fusenapi/server/collection/internal/logic"
"fusenapi/server/collection/internal/svc"
"fusenapi/server/collection/internal/types"
)
func GetStatHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func TestAiHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetStatReq
var req types.TestAiReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewGetStatLogic(r.Context(), svcCtx)
l := logic.NewTestAiLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.GetStat(&req, userinfo)
resp := l.TestAi(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@ -6,27 +6,27 @@ import (
"fusenapi/utils/basic"
"fusenapi/server/ldap-admin/internal/logic"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
"fusenapi/server/collection/internal/logic"
"fusenapi/server/collection/internal/svc"
"fusenapi/server/collection/internal/types"
)
func GetApisHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func TestPdfHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetApisReq
var req types.TestPdfReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewGetApisLogic(r.Context(), svcCtx)
l := logic.NewTestPdfLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.GetApis(&req, userinfo)
resp := l.TestPdf(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,50 @@
package logic
import (
"context"
"fusenapi/server/collection/internal/svc"
"fusenapi/server/collection/internal/types"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/pdf"
"github.com/zeromicro/go-zero/core/logx"
)
type TestPdfLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewTestPdfLogic(ctx context.Context, svcCtx *svc.ServiceContext) *TestPdfLogic {
return &TestPdfLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *TestPdfLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *TestPdfLogic) TestPdf(req *types.TestPdfReq, userinfo *auth.UserInfo) (resp *basic.Response) {
return resp.SetStatusWithMessage(basic.CodeOK, "你干嘛,哎哟")
switch req.Type {
case "url":
case "html":
default:
return resp.SetStatusWithMessage(basic.CodeRequestParamsErr, "invalid type")
}
res, err := pdf.HtmlToPdfBase64(req.Content, req.Type)
if err != nil {
return resp.SetStatusWithMessage(basic.CodeServiceErr, err.Error())
}
return resp.SetStatus(basic.CodeOK, res)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *TestPdfLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -40,6 +40,15 @@ type GetCollectProductListRspItem struct {
IsDeleted int64 `json:"is_deleted"`
}
type TestAiReq struct {
Num int `form:"num"`
}
type TestPdfReq struct {
Content string `json:"content"`
Type string `json:"type"`
}
type Request struct {
}

View File

@ -72,11 +72,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/user/logo-templatetag-set",
Handler: UserLogoTemplateTagSetHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/user/logo-data-set",
Handler: UserLogoDataSetHandler(serverCtx),
},
},
)
}

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/home-user-auth/internal/logic"
"fusenapi/server/home-user-auth/internal/svc"
"fusenapi/server/home-user-auth/internal/types"
)
func UserLogoDataSetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.UserLogoDataSetReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewUserLogoDataSetLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.UserLogoDataSet(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -75,15 +75,15 @@ func (l *UserInfoSetLogic) UserInfoSet(req *types.UserInfoSetReq, userinfo *auth
BuilderDB := fsUserInfoModel.BuilderDB(l.ctx, nil).Model(&gmodel.FsUserInfo{})
BuilderDB1 := fsUserInfoModel.BuilderDB(l.ctx, nil).Model(&gmodel.FsUserInfo{})
if req.Module == "merchant_category" {
BuilderDB1 = BuilderDB1.Where("module = ?", "profile")
BuilderDB1.Where("module = ?", "profile")
} else {
BuilderDB1 = BuilderDB1.Where("module = ?", req.Module)
BuilderDB1.Where("module = ?", req.Module)
}
//.Where("user_id=?", userId).Where("guest_id=?", guestId)
if userId > 0 {
BuilderDB1 = BuilderDB1.Where("user_id=?", userId)
BuilderDB1.Where("user_id=?", userId)
} else {
BuilderDB1 = BuilderDB1.Where("guest_id=?", guestId)
BuilderDB1.Where("guest_id=?", guestId)
}
userInfo, err = fsUserInfoModel.FindOne(BuilderDB1, nil)
if err != nil {

View File

@ -1,165 +0,0 @@
package logic
import (
"errors"
"fmt"
"fusenapi/model/gmodel"
"fusenapi/service/repositories"
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"fusenapi/utils/s3url_to_s3id"
"time"
"context"
"fusenapi/server/home-user-auth/internal/svc"
"fusenapi/server/home-user-auth/internal/types"
"github.com/zeromicro/go-zero/core/logc"
"github.com/zeromicro/go-zero/core/logx"
"gorm.io/gorm"
)
type UserLogoDataSetLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUserLogoDataSetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserLogoDataSetLogic {
return &UserLogoDataSetLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *UserLogoDataSetLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *UserLogoDataSetLogic) UserLogoDataSet(req *types.UserLogoDataSetReq, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if userinfo.IsOnlooker() {
// 如果是,返回未授权的错误码
return resp.SetStatus(basic.CodeUnAuth)
}
var userId int64
var guestId int64
// 检查用户是否是游客
if userinfo.IsGuest() {
// 如果是使用游客ID和游客键名格式
guestId = userinfo.GuestId
} else {
// 否则使用用户ID和用户键名格式
userId = userinfo.UserId
}
var logoData = gmodel.FsPreprocessLogo{}
result := l.svcCtx.MysqlConn.Model(&gmodel.FsPreprocessLogo{}).Where("id = ?", req.LogoDataId).Take(&logoData)
err := result.Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
logc.Errorf(l.ctx, "UserLogoDataSet logoData find err%+v", err)
basic.CodeApiErr.Message = "logo data not find"
return resp.SetStatus(basic.CodeApiErr)
}
return resp.SetStatus(basic.CodeApiErr)
}
var materialInfoOld gmodel.FsUserMaterial
var FsUserMaterialModel = l.svcCtx.MysqlConn.Model(&gmodel.FsUserMaterial{})
if userinfo.IsGuest() {
// 如果是使用游客ID和游客键名格式
guestId = userinfo.GuestId
FsUserMaterialModel = FsUserMaterialModel.Where("guest_id = ?", guestId)
} else {
// 否则使用用户ID和用户键名格式
userId = userinfo.UserId
FsUserMaterialModel = FsUserMaterialModel.Where("user_id = ?", userId)
}
result1 := FsUserMaterialModel.Where("logo_id = ?", req.LogoDataId).Take(&materialInfoOld)
err = result1.Error
if err != nil {
if !errors.Is(err, gorm.ErrRecordNotFound) {
logc.Errorf(l.ctx, "FsUserMaterial logoData find err%+v", err)
return resp.SetStatus(basic.CodeApiErr)
}
} else {
// 返回成功的响应和上传URL
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
"id": materialInfoOld.Id,
"module": materialInfoOld.Module,
"user_id": materialInfoOld.UserId,
"guest_id": materialInfoOld.GuestId,
"resource_id": materialInfoOld.ResourceId,
"resource_url": materialInfoOld.ResourceUrl,
"ctime": materialInfoOld.Ctime,
"resource_info": nil,
"metadata": nil,
})
}
var userMaterialMetadata []byte
if logoData.Metadata == nil {
var resultStr string
resLogoStandard, err := l.svcCtx.Repositories.ImageHandle.LogoInfoSet(l.ctx, &repositories.LogoInfoSetReq{
LogoUrl: *logoData.ResourceUrl,
Version: l.svcCtx.Config.BLMService.Version,
Debug: userinfo.Debug,
})
if err != nil {
logx.Error(err)
basic.CodeServiceErr.Message = fmt.Sprintf("算法请求--LOGO信息--错误:%+v", err)
return resp.SetStatus(basic.CodeServiceErr, fmt.Sprintf("算法请求--LOGO信息--错误:%+v", err))
}
resultStr = resLogoStandard.Res
userMaterialMetadata = []byte(resultStr)
} else {
userMaterialMetadata = *logoData.Metadata
}
// 新增素材--预备logo
var module = "logo-prepare"
var nowTime = time.Now().UTC()
var resourceId = s3url_to_s3id.GetS3ResourceIdFormUrl(*logoData.ResourceUrl)
// 新增素材记录
materialInfo := gmodel.FsUserMaterial{
Module: &module,
UserId: &userId,
GuestId: &guestId,
ResourceId: &resourceId,
ResourceUrl: logoData.ResourceUrl,
Metadata: &userMaterialMetadata,
Ctime: &nowTime,
LogoId: &req.LogoDataId,
}
resCreate := l.svcCtx.MysqlConn.Create(&materialInfo)
err = resCreate.Error
if err != nil {
logc.Errorf(l.ctx, "UserLogoDataSet logoData find err%+v", err)
return resp.SetStatus(basic.CodeApiErr)
}
// 返回成功的响应和上传URL
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
"id": materialInfo.Id,
"module": materialInfo.Module,
"user_id": materialInfo.UserId,
"guest_id": materialInfo.GuestId,
"resource_id": materialInfo.ResourceId,
"resource_url": materialInfo.ResourceUrl,
"metadata": materialInfo.Metadata,
"ctime": materialInfo.Ctime,
"resource_info": nil,
})
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *UserLogoDataSetLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -144,7 +144,6 @@ func (l *UserLogoListLogic) UserLogoList(req *types.UserLogoListReq, userinfo *a
metadataMap["merchant_category_info"] = nil
v.MetaDataMap = metadataMap
}
v.Metadata = nil
if v.ResourceInfo != nil {
if v.ResourceInfo.Metadata != nil {

View File

@ -96,10 +96,6 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
logc.Errorf(l.ctx, "FsUserMaterial FindOne err%+v", err)
return resp.SetStatus(basic.CodeLogoSetCategory, "logo not find")
}
var materialModule string
if *userMaterialInfo.Module == "logo-prepare" {
materialModule = "logo"
}
err = l.svcCtx.MysqlConn.WithContext(l.ctx).Transaction(func(tx *gorm.DB) error {
var metadataMapOldUserMaterial map[string]interface{}
@ -110,34 +106,22 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
return err
}
}
var logoCategoryId int64
// 更新merchant_category
if req.SetLogoCategory == 1 || materialModule != "" {
var updateSelect []string
updateSelect = append(updateSelect, "utime")
if req.SetLogoCategory == 1 {
var metadataChildUserMaterial = make(map[string]interface{}, 1)
metadataChildUserMaterial["merchant_category"] = req.CategoryId
metadataMapUserMaterial, err := metadata.SetMetadata(metadataChildUserMaterial, metadataMapOldUserMaterial)
if err != nil {
logc.Errorf(l.ctx, "userMaterialInfo Metadata SetMetadata err%+v", err)
return err
}
metadataBUserMaterial, err := json.Marshal(metadataMapUserMaterial)
if err != nil {
logc.Errorf(l.ctx, "userMaterialInfo Metadata err%+v", err)
return err
}
userMaterialInfo.Metadata = &metadataBUserMaterial
updateSelect = append(updateSelect, "metadata")
if req.SetLogoCategory == 1 {
var metadataChildUserMaterial = make(map[string]interface{}, 1)
metadataChildUserMaterial["merchant_category"] = req.CategoryId
metadataMapUserMaterial, err := metadata.SetMetadata(metadataChildUserMaterial, metadataMapOldUserMaterial)
if err != nil {
logc.Errorf(l.ctx, "userMaterialInfo Metadata SetMetadata err%+v", err)
return err
}
if materialModule != "" {
userMaterialInfo.Module = &materialModule
updateSelect = append(updateSelect, "module")
metadataBUserMaterial, err := json.Marshal(metadataMapUserMaterial)
if err != nil {
logc.Errorf(l.ctx, "userMaterialInfo Metadata err%+v", err)
return err
}
resUpdates := tx.Model(&gmodel.FsUserMaterial{}).Select(updateSelect).Where("id = ?", req.LogoSelectedId).Updates(&userMaterialInfo)
userMaterialInfo.Metadata = &metadataBUserMaterial
resUpdates := tx.Select("metadata").Where("id = ?", req.LogoSelectedId).Updates(&userMaterialInfo)
err = resUpdates.Error
if err != nil {
if err != gorm.ErrRecordNotFound {
@ -145,7 +129,7 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
return err
}
}
logoCategoryId = req.CategoryId
}
var module = "profile"
if req.SetLogoSelected == 1 {
@ -186,13 +170,6 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
logc.Errorf(l.ctx, "userMaterialInfo Metadata template_tag_id err%+v", err)
return err
}
var userMaterialTemplateTagSelectedVersion string
userMaterialVersionData, userMaterialVersionEx := metadataMapOldUserMaterial["version"]
if userMaterialVersionEx {
userMaterialTemplateTagSelectedVersion = userMaterialVersionData.(string)
}
userMaterialTemplateIdTagIds := userMaterialTemplateIdTagIdData.([]interface{})
userMaterialTemplateIdTagId := userMaterialTemplateIdTagIds[0].(string)
@ -200,22 +177,16 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
userMaterialTemplateTag := userMaterialTemplateTagData.(map[string]interface{})
userMaterialTemplateTagIndex := userMaterialTemplateTag[userMaterialTemplateIdTagId]
templateTagSelected := make(map[string]interface{}, 4)
templateTagSelected["version"] = userMaterialTemplateTagSelectedVersion
templateTagSelected := make(map[string]interface{}, 3)
templateTagSelected["color"] = userMaterialTemplateTagIndex
templateTagSelected["template_tag"] = userMaterialTemplateIdTagId
templateTagSelected["selected_index"] = 0
var logoSelectedMap = map[string]interface{}{
metadataChildUserInfo["logo_selected"] = map[string]interface{}{
"logo_selected_id": req.LogoSelectedId,
"logo_url": userMaterialInfo.ResourceUrl,
"template_tag_selected": templateTagSelected,
}
if logoCategoryId != 0 {
logoSelectedMap["merchant_category"] = logoCategoryId
}
metadataChildUserInfo["logo_selected"] = logoSelectedMap
metadataMapUserInfo, err := metadata.SetMetadata(metadataChildUserInfo, metadataMapOldUserInfo)
if err != nil {
@ -241,7 +212,7 @@ func (l *UserLogoSetLogic) UserLogoSet(req *types.UserLogoSetReq, userinfo *auth
} else {
// 更新
userInfo.Utime = &nowTime
resUpdates := tx.Model(&gmodel.FsUserInfo{}).Select("metadata", "utime").Where("id = ?", userInfo.Id).Updates(&userInfo)
resUpdates := tx.Model(&userInfo).Select("metadata").Where("id = ?", userInfo.Id).Updates(&userInfo)
err = resUpdates.Error
}

View File

@ -64,9 +64,9 @@ func (l *UserLogoTemplateTagSetLogic) UserLogoTemplateTagSet(req *types.UserLogo
var userInfo = &gmodel.FsUserInfo{}
BuilderDB := tx.Model(&gmodel.FsUserInfo{}).Where("module = ?", module)
if userId > 0 {
BuilderDB = BuilderDB.Where("user_id=?", userId)
BuilderDB.Where("user_id=?", userId)
} else {
BuilderDB = BuilderDB.Where("guest_id=?", guestId)
BuilderDB.Where("guest_id=?", guestId)
}
userInfoFirstRes := BuilderDB.First(userInfo)
err := userInfoFirstRes.Error
@ -112,12 +112,6 @@ func (l *UserLogoTemplateTagSetLogic) UserLogoTemplateTagSet(req *types.UserLogo
return err
}
var userMaterialTemplateTagSelectedVersion string
userMaterialVersionData, userMaterialVersionEx := metadataMapOldUserMaterial["version"]
if userMaterialVersionEx {
userMaterialTemplateTagSelectedVersion = userMaterialVersionData.(string)
}
userMaterialTemplateTag := userMaterialTemplateTagData.(map[string]interface{})
userMaterialTemplateTagIndex := userMaterialTemplateTag[req.TemplateTag]
@ -127,8 +121,7 @@ func (l *UserLogoTemplateTagSetLogic) UserLogoTemplateTagSet(req *types.UserLogo
return err
}
templateTagSelected := make(map[string]interface{}, 4)
templateTagSelected["version"] = userMaterialTemplateTagSelectedVersion
templateTagSelected := make(map[string]interface{}, 3)
templateTagSelected["color"] = userMaterialTemplateTagIndex
templateTagSelected["template_tag"] = req.TemplateTag
templateTagSelected["selected_index"] = req.TemplateTagColorIndex

View File

@ -5,10 +5,6 @@ import (
"fusenapi/utils/basic"
)
type UserLogoDataSetReq struct {
LogoDataId int64 `form:"logo_data_id"`
}
type UserLogoTemplateTagSetReq struct {
TemplateTag string `form:"template_tag"`
TemplateTagColorIndex int64 `form:"template_tag_color_index"`

View File

@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/info/internal/logic"
"fusenapi/server/info/internal/svc"
"fusenapi/server/info/internal/types"
)
func PreLogoSearchSuggestionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.PreLogoSearchSuggestionsRequest
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewPreLogoSearchSuggestionsLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.PreLogoSearchSuggestions(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}

View File

@ -22,11 +22,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/info/user/profile",
Handler: UserGetProfileHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/info/user/profile/default",
Handler: UserGetDefaultProfileHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/info/user/profile/base/update",
@ -67,16 +62,6 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/api/info/restaurant/list",
Handler: RestaurantListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/info/prelogo/search/suggestions",
Handler: PreLogoSearchSuggestionsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/info/prelogo/search",
Handler: PreLogoSearchHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/info/contact/us",

View File

@ -1,57 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/info/internal/svc"
"fusenapi/server/info/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type PreLogoSearchLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewPreLogoSearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PreLogoSearchLogic {
return &PreLogoSearchLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *PreLogoSearchLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *PreLogoSearchLogic) PreLogoSearch(req *types.PreLogoSearchRequest, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if userinfo.IsOnlooker() {
return resp.SetStatus(basic.CodeSearchAuthErr)
}
if len(req.ZipCode) < 4 {
return resp.SetStatus(basic.CodeSearchZipCodeErr)
}
result, err := l.svcCtx.AllModels.FsPreprocessLogo.PreLogoSearch(l.ctx, req.ZipCode, req.Keywords, 1)
if err != nil {
return resp.SetStatus(basic.CodeApiErr, err)
}
return resp.SetStatus(basic.CodeOK, map[string]any{
"result": result,
})
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *PreLogoSearchLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -1,53 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/info/internal/svc"
"fusenapi/server/info/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type PreLogoSearchSuggestionsLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewPreLogoSearchSuggestionsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *PreLogoSearchSuggestionsLogic {
return &PreLogoSearchSuggestionsLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *PreLogoSearchSuggestionsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *PreLogoSearchSuggestionsLogic) PreLogoSearchSuggestions(req *types.PreLogoSearchSuggestionsRequest, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
if userinfo.IsOnlooker() {
return resp.SetStatus(basic.CodeSearchAuthErr)
}
result, err := l.svcCtx.AllModels.FsPreprocessLogo.PreLogoSearchSuggestions(l.ctx, req.Keywords, 5)
if err != nil {
return resp.SetStatus(basic.CodeApiErr, err)
}
return resp.SetStatus(basic.CodeOK, map[string]any{
"result": result,
})
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *PreLogoSearchSuggestionsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -41,8 +41,8 @@ func (l *UpdateProfileBaseLogic) UpdateProfileBase(req *types.ProfileRequest, us
err := l.svcCtx.AllModels.FsUserInfo.MergeMetadata(userinfo.UserId, req)
if err != nil {
logx.Error(err) // 日志记录错误
return resp.SetStatus(basic.CodeDbSqlErr, err) // 返回数据库创建错误
logx.Error(err) // 日志记录错误
return resp.SetStatus(basic.CodeDbSqlErr, err.Error()) // 返回数据库创建错误
}
return resp.SetStatus(basic.CodeOK)

View File

@ -1,47 +0,0 @@
package logic
import (
"fusenapi/utils/auth"
"fusenapi/utils/basic"
"context"
"fusenapi/server/info/internal/svc"
"fusenapi/server/info/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type UserGetDefaultProfileLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUserGetDefaultProfileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserGetDefaultProfileLogic {
return &UserGetDefaultProfileLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 处理进入前逻辑w,r
// func (l *UserGetDefaultProfileLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
// }
func (l *UserGetDefaultProfileLogic) UserGetDefaultProfile(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) {
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
defaultProfile, err := l.svcCtx.AllModels.FsUserInfo.GetDefaultProfile(l.ctx)
if err != nil {
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
}
return resp.SetStatus(basic.CodeOK, defaultProfile)
}
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
// func (l *UserGetDefaultProfileLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
// // httpx.OkJsonCtx(r.Context(), w, resp)
// }

View File

@ -34,24 +34,13 @@ func (l *UserGetProfileLogic) UserGetProfile(req *types.QueryProfileRequest, use
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
// userinfo 传入值时, 一定不为null
profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId, userinfo.GuestId)
if err != nil {
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
if !userinfo.IsUser() {
return resp.SetStatus(basic.CodeUnAuth)
}
if userinfo.UserId != 0 {
user, err := l.svcCtx.AllModels.FsUser.FindUserById(context.TODO(), userinfo.UserId)
if err != nil {
logx.Error(err) // 日志记录错误
return resp.SetStatus(basic.CodeDbSqlErr, err) // 返回数据库创建错误
}
if bmap, ok := profileBase["base"].(map[string]any); ok {
bmap["email"] = *user.Email
}
} else {
if bmap, ok := profileBase["base"].(map[string]any); ok {
bmap["email"] = ""
}
profileBase, err := l.svcCtx.AllModels.FsUserInfo.GetProfile(l.ctx, req.TopKey, userinfo.UserId)
if err != nil {
return resp.SetStatusWithMessage(basic.CodeApiErr, err.Error())
}
return resp.SetStatus(basic.CodeOK, profileBase)

View File

@ -12,15 +12,6 @@ type ContactUsRequest struct {
Message string `json:"message"`
}
type PreLogoSearchSuggestionsRequest struct {
Keywords string `json:"keywords"` // 关键字
}
type PreLogoSearchRequest struct {
ZipCode string `json:"zip_code"` // 邮编
Keywords string `json:"keywords"` // 关键字
}
type UserInfoRequest struct {
Module []string `json:"module"`
}
@ -53,32 +44,32 @@ type AddressRequest struct {
}
type ProfileRequest struct {
ProfileBase *ProfileBase `json:"base,optional"` // 基础的个人消息, 姓名 公司等
SubscriptionStatus *SubscriptionStatus `json:"sub_status,optional"` // 订阅的通知状态
ProfileBase *ProfileBase `json:"base,optional,omitempty"` // 基础的个人消息, 姓名 公司等
SubscriptionStatus *SubscriptionStatus `json:"sub_status,optional,omitempty"` // 订阅的通知状态
}
type ProfileBase struct {
FirstName *string `json:"first_name,optional"` // 首名
LastName *string `json:"last_name,optional"` // 后名
Email *string `json:"email,optional"` // email
Mobile *string `json:"mobile,optional"` // 电话
Resetaurant *string `json:"resetaurant,optional"` // 不知道干什么
Company *string `json:"company,optional"` // 公司
FirstName *string `json:"first_name,optional,omitempty"` // 首名
LastName *string `json:"last_name,optional,omitempty"` // 后名
Email *string `json:"email,optional,omitempty"` // email
Mobile *string `json:"mobile,optional,omitempty"` // 电话
Resetaurant *string `json:"resetaurant,optional,omitempty"` // 不知道干什么
Company *string `json:"company,optional,omitempty"` // 公司
}
type SubscriptionStatus struct {
NotificationEmail NotificationEmail `json:"notification_email,optional"`
NotificationPhone NotificationPhone `json:"notification_phone,optional"`
NotificationEmail NotificationEmail `json:"notification_email,optional,omitempty"`
NotificationPhone NotificationPhone `json:"notification_phone,optional,omitempty"`
}
type NotificationEmail struct {
OrderUpdate bool `json:"order_update,optional"`
Newseleter bool `json:"newseleter,optional"`
OrderUpdate bool `json:"order_update,optional,omitempty"`
Newseleter bool `json:"newseleter,optional,omitempty"`
}
type NotificationPhone struct {
OrderUpdate bool `json:"order_update,optional"`
Newseleter bool `json:"newseleter,optional"`
OrderUpdate bool `json:"order_update,optional,omitempty"`
Newseleter bool `json:"newseleter,optional,omitempty"`
}
type QueryProfileRequest struct {

Some files were not shown because too many files have changed in this diff Show More