feat:新增订单发票,下单地址调整
This commit is contained in:
parent
0310a6bd21
commit
6ae2cce870
@ -1,6 +1,6 @@
|
|||||||
package constants
|
package constants
|
||||||
|
|
||||||
const INVOICE_TEMPLATE = `
|
const INVOICE_TEMPLATE_01 = `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
|
|
||||||
@ -192,29 +192,34 @@ const INVOICE_TEMPLATE = `
|
|||||||
<td class="header_td title" align="right">Invoice</td>
|
<td class="header_td title" align="right">Invoice</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
`
|
||||||
|
|
||||||
|
const INVOICE_TEMPLATE_02 = `
|
||||||
<!-- information -->
|
<!-- information -->
|
||||||
<table class="information_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
<table class="information_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="information_td bill" align="left">Bill To:</td>
|
<td class="information_td bill" align="left">Bill To:</td>
|
||||||
<td class="information_td right" align="right">Invoice No. #20220562040</td>
|
<td class="information_td right" align="right">Invoice No. #%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="information_td info" align="left">Timmy Turner</td>
|
<td class="information_td info" align="left">%v</td>
|
||||||
<td class="information_td right" align="right">Date: 2023/12/04</td>
|
<td class="information_td right" align="right">Date: %v</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="information_td info" align="left">North Street</td>
|
<td class="information_td info" align="left">%v</td>
|
||||||
<td class="information_td" align="right"></td>
|
<td class="information_td" align="right"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="information_td info" align="left">London, SE20 3JW</td>
|
<td class="information_td info" align="left">%v</td>
|
||||||
<td class="information_td" align="right"></td>
|
<td class="information_td" align="right"></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="information_td info" align="left">United Kingdom</td>
|
<td class="information_td info" align="left">%v</td>
|
||||||
<td class="information_td" align="right"></td>
|
<td class="information_td" align="right"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
`
|
||||||
|
const INVOICE_TEMPLATE_03 = `
|
||||||
<!-- bill -->
|
<!-- bill -->
|
||||||
<table class="bill_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
<table class="bill_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
@ -223,24 +228,24 @@ const INVOICE_TEMPLATE = `
|
|||||||
<td class="bill_td title" align="right">Quantity</td>
|
<td class="bill_td title" align="right">Quantity</td>
|
||||||
<td class="bill_td title" align="right">Total</td>
|
<td class="bill_td title" align="right">Total</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
%v
|
||||||
<td class="bill_td info" align="left">Plastic bowl</td>
|
|
||||||
<td class="bill_td info" align="right">$01.00</td>
|
|
||||||
<td class="bill_td info" align="right">20,000 Units</td>
|
|
||||||
<td class="bill_td info" align="right">$99.00</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="bill_td info" align="left">Paper bag with handlexxxxxxxxxxxxxxx second line</td>
|
|
||||||
<td class="bill_td info" align="right">$01.00</td>
|
|
||||||
<td class="bill_td info" align="right">20,000 Units</td>
|
|
||||||
<td class="bill_td info" align="right">$99.00</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
|
`
|
||||||
|
|
||||||
|
const INVOICE_TEMPLATE_0301 = `
|
||||||
|
<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 Units</td>
|
||||||
|
<td class="bill_td info" align="right">%v</td>
|
||||||
|
</tr>
|
||||||
|
`
|
||||||
|
const INVOICE_TEMPLATE_04 = `
|
||||||
<!-- total -->
|
<!-- total -->
|
||||||
<table class="total_warp" border="0" align="right" cellpadding="0" cellspacing="0" width="50%">
|
<table class="total_warp" border="0" align="right" cellpadding="0" cellspacing="0" width="50%">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="total_td" align="right">Subtotal</td>
|
<td class="total_td" align="right">Subtotal</td>
|
||||||
<td class="total_td info" align="right">$198.00</td>
|
<td class="total_td info" align="right">%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="total_td" align="right">Shipping Fee</td>
|
<td class="total_td" align="right">Shipping Fee</td>
|
||||||
@ -248,21 +253,23 @@ const INVOICE_TEMPLATE = `
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="total_td border-dashed" align="right">Tax</td>
|
<td class="total_td border-dashed" align="right">Tax</td>
|
||||||
<td class="total_td info border-dashed" align="right">$0.00</td>
|
<td class="total_td info border-dashed" align="right">%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="total_td" align="right">Total</td>
|
<td class="total_td" align="right">Total</td>
|
||||||
<td class="total_td info" align="right">$198.00</td>
|
<td class="total_td info" align="right">%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="total_td border-solid" align="right">Deposit Requested</td>
|
<td class="total_td border-solid" align="right">%v</td>
|
||||||
<td class="total_td info border-solid" align="right">$99.00</td>
|
<td class="total_td info border-solid" align="right">%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="total_td total" align="right">Deposit Due</td>
|
<td class="total_td total" align="right">%v</td>
|
||||||
<td class="total_td total" align="right">$99.00</td>
|
<td class="total_td total" align="right">%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
`
|
||||||
|
const INVOICE_TEMPLATE_05 = `
|
||||||
<!-- notes -->
|
<!-- notes -->
|
||||||
<table class="notes_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
<table class="notes_warp" border="0" align="center" cellpadding="0" cellspacing="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
@ -270,15 +277,18 @@ const INVOICE_TEMPLATE = `
|
|||||||
<td class="notes_td title" align="left">Notes:</td>
|
<td class="notes_td title" align="left">Notes:</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="notes_td" align="left">ICBC</td>
|
<td class="notes_td" align="left">%v</td>
|
||||||
<td class="notes_td notes" align="left" rowspan="2">Thank you for your business !</td>
|
<td class="notes_td notes" align="left" rowspan="2">Thank you for your business !</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="notes_td" align="left">Account No. :****4589</td>
|
<td class="notes_td" align="left">Account No. :%v</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
`
|
||||||
|
const INVOICE_TEMPLATE_06 = `
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
`
|
|
||||||
|
`
|
||||||
|
@ -92,7 +92,14 @@ var OrderStatusUserDIRECTMAIL []OrderStatusCode
|
|||||||
// 订单状态--用户可见--云仓
|
// 订单状态--用户可见--云仓
|
||||||
var OrderStatusUserCLOUDSTORE []OrderStatusCode
|
var OrderStatusUserCLOUDSTORE []OrderStatusCode
|
||||||
|
|
||||||
|
// 订单货币
|
||||||
|
var OrderCurrencyMessage map[Currency]string
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
// 订单货币
|
||||||
|
OrderCurrencyMessage = make(map[Currency]string, 1)
|
||||||
|
OrderCurrencyMessage[CURRENCYUSD] = "$"
|
||||||
|
|
||||||
// 订单状态名称
|
// 订单状态名称
|
||||||
OrderPayStatusMessage = make(map[OrderPayStatusCode]string)
|
OrderPayStatusMessage = make(map[OrderPayStatusCode]string)
|
||||||
OrderPayStatusMessage[ORDER_PAY_STATUS_UNPAIDDEPOSIT] = "Deposit Payment Unpaid"
|
OrderPayStatusMessage[ORDER_PAY_STATUS_UNPAIDDEPOSIT] = "Deposit Payment Unpaid"
|
||||||
|
@ -11,7 +11,7 @@ type FsAdminRole struct {
|
|||||||
RolePid *int64 `gorm:"default:0;" json:"role_pid"` // 上级角色
|
RolePid *int64 `gorm:"default:0;" json:"role_pid"` // 上级角色
|
||||||
RoleName *string `gorm:"unique_key;default:'';" json:"role_name"` //
|
RoleName *string `gorm:"unique_key;default:'';" json:"role_name"` //
|
||||||
DataAuthType *int64 `gorm:"default:1;" json:"data_auth_type"` // 数据权限类型
|
DataAuthType *int64 `gorm:"default:1;" json:"data_auth_type"` // 数据权限类型
|
||||||
DataAuth *string `gorm:"default:'';" json:"data_auth"` //
|
DataAuth *[]byte `gorm:"default:'';" json:"data_auth"` //
|
||||||
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
|
Status *int64 `gorm:"default:2;" json:"status"` // 状态:1=启用,2=停用
|
||||||
Remark *string `gorm:"default:'';" json:"remark"` //
|
Remark *string `gorm:"default:'';" json:"remark"` //
|
||||||
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
|
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序权重
|
||||||
|
@ -11,6 +11,7 @@ type FsDepartment struct {
|
|||||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态 1正常0停用
|
Status *int64 `gorm:"default:0;" json:"status"` // 状态 1正常0停用
|
||||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||||
ParentId *int64 `gorm:"default:0;" json:"parent_id"` // 父级id
|
ParentId *int64 `gorm:"default:0;" json:"parent_id"` // 父级id
|
||||||
|
Manager *int64 `gorm:"default:0;" json:"manager"` // 负责人
|
||||||
}
|
}
|
||||||
type FsDepartmentModel struct {
|
type FsDepartmentModel struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
@ -7,9 +7,9 @@ import (
|
|||||||
// fs_font 字体配置
|
// fs_font 字体配置
|
||||||
type FsFont struct {
|
type FsFont struct {
|
||||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // id
|
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对应字体名
|
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"` // 排序
|
Sort *int64 `gorm:"default:0;" json:"sort"` // 排序
|
||||||
}
|
}
|
||||||
type FsFontModel struct {
|
type FsFontModel struct {
|
||||||
|
@ -25,6 +25,9 @@ type FsOrder struct {
|
|||||||
PayStatusLink *[]byte `gorm:"default:'';" json:"pay_status_link"` //
|
PayStatusLink *[]byte `gorm:"default:'';" json:"pay_status_link"` //
|
||||||
ShoppingCartSnapshot *[]byte `gorm:"default:'';" json:"shopping_cart_snapshot"` //
|
ShoppingCartSnapshot *[]byte `gorm:"default:'';" json:"shopping_cart_snapshot"` //
|
||||||
ShoppingProductSnapshot *[]byte `gorm:"default:'';" json:"shopping_product_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 {
|
type FsOrderModel struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
@ -19,9 +19,14 @@ type OrderDetail struct {
|
|||||||
|
|
||||||
// 收货地址
|
// 收货地址
|
||||||
type OrderAddress struct {
|
type OrderAddress struct {
|
||||||
Address string `json:"address"` // 详细地址
|
Street string `json:"street"` // 详细地址
|
||||||
Mobile string `json:"mobile"` // 手机
|
City string `json:"city"` // 城市
|
||||||
Name string `json:"name"` // 姓名
|
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"` // 邮编号码
|
||||||
}
|
}
|
||||||
|
|
||||||
// 订单金额
|
// 订单金额
|
||||||
|
@ -25,6 +25,7 @@ type FsOrderTrade struct {
|
|||||||
Ctime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"ctime"` //
|
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"` //
|
Utime *time.Time `gorm:"default:'0000-00-00 00:00:00';" json:"utime"` //
|
||||||
PayTitle *string `gorm:"default:'';" json:"pay_title"` //
|
PayTitle *string `gorm:"default:'';" json:"pay_title"` //
|
||||||
|
ReceiptSn *string `gorm:"default:'';" json:"receipt_sn"` //
|
||||||
}
|
}
|
||||||
type FsOrderTradeModel struct {
|
type FsOrderTradeModel struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
@ -37,6 +37,7 @@ type FsProduct struct {
|
|||||||
SceneIds *string `gorm:"default:'';" json:"scene_ids"` //
|
SceneIds *string `gorm:"default:'';" json:"scene_ids"` //
|
||||||
IsCustomization *int64 `gorm:"default:0;" json:"is_customization"` // 是否可定制
|
IsCustomization *int64 `gorm:"default:0;" json:"is_customization"` // 是否可定制
|
||||||
Unit *string `gorm:"default:'';" json:"unit"` //
|
Unit *string `gorm:"default:'';" json:"unit"` //
|
||||||
|
SupplyChainManager *int64 `gorm:"default:0;" json:"supply_chain_manager"` // 供应链负责人
|
||||||
}
|
}
|
||||||
type FsProductModel struct {
|
type FsProductModel struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
|
@ -19,4 +19,13 @@ type Config struct {
|
|||||||
SuccessURL string
|
SuccessURL string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AWS struct {
|
||||||
|
S3 struct {
|
||||||
|
Credentials struct {
|
||||||
|
AccessKeyID string
|
||||||
|
Secret string
|
||||||
|
Token string
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
35
server/order/internal/handler/orderinvoicehandler.go
Normal file
35
server/order/internal/handler/orderinvoicehandler.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
package handler
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"reflect"
|
||||||
|
|
||||||
|
"fusenapi/utils/basic"
|
||||||
|
|
||||||
|
"fusenapi/server/order/internal/logic"
|
||||||
|
"fusenapi/server/order/internal/svc"
|
||||||
|
"fusenapi/server/order/internal/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func OrderInvoiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
|
var req types.OrderInvoiceReq
|
||||||
|
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建一个业务逻辑层实例
|
||||||
|
l := logic.NewOrderInvoiceLogic(r.Context(), svcCtx)
|
||||||
|
|
||||||
|
rl := reflect.ValueOf(l)
|
||||||
|
basic.BeforeLogic(w, r, rl)
|
||||||
|
|
||||||
|
resp := l.OrderInvoice(&req, userinfo)
|
||||||
|
|
||||||
|
if !basic.AfterLogic(w, r, rl, resp) {
|
||||||
|
basic.NormalAfterLogic(w, r, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
Path: "/api/order/close",
|
Path: "/api/order/close",
|
||||||
Handler: CloseOrderHandler(serverCtx),
|
Handler: CloseOrderHandler(serverCtx),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Method: http.MethodGet,
|
||||||
|
Path: "/api/order/invoice",
|
||||||
|
Handler: OrderInvoiceHandler(serverCtx),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodGet,
|
Method: http.MethodGet,
|
||||||
Path: "/api/order/list",
|
Path: "/api/order/list",
|
||||||
|
@ -43,16 +43,28 @@ func (l *CreatePrePaymentByDepositLogic) CreatePrePaymentByDeposit(req *types.Cr
|
|||||||
if req.DeliveryAddress == nil {
|
if req.DeliveryAddress == nil {
|
||||||
return resp.SetStatus(basic.CodeErrOrderCreatePrePaymentParam)
|
return resp.SetStatus(basic.CodeErrOrderCreatePrePaymentParam)
|
||||||
} else {
|
} else {
|
||||||
if req.DeliveryAddress.Address == "" || req.DeliveryAddress.Mobile == "" || req.DeliveryAddress.Name == "" {
|
if req.DeliveryAddress.Street == "" ||
|
||||||
|
req.DeliveryAddress.City == "" ||
|
||||||
|
req.DeliveryAddress.Mobile == "" ||
|
||||||
|
req.DeliveryAddress.State == "" ||
|
||||||
|
req.DeliveryAddress.Suite == "" ||
|
||||||
|
req.DeliveryAddress.ZipCode == "" ||
|
||||||
|
req.DeliveryAddress.LastName == "" ||
|
||||||
|
req.DeliveryAddress.FirstName == "" {
|
||||||
return resp.SetStatus(basic.CodeErrOrderCreatePrePaymentParam)
|
return resp.SetStatus(basic.CodeErrOrderCreatePrePaymentParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var orderAddress repositories.OrderAddress
|
var orderAddress repositories.OrderAddress
|
||||||
if req.DeliveryAddress != nil {
|
if req.DeliveryAddress != nil {
|
||||||
orderAddress.Address = req.DeliveryAddress.Address
|
orderAddress.Street = req.DeliveryAddress.Street
|
||||||
|
orderAddress.City = req.DeliveryAddress.City
|
||||||
|
orderAddress.FirstName = req.DeliveryAddress.FirstName
|
||||||
|
orderAddress.LastName = req.DeliveryAddress.LastName
|
||||||
orderAddress.Mobile = req.DeliveryAddress.Mobile
|
orderAddress.Mobile = req.DeliveryAddress.Mobile
|
||||||
orderAddress.Name = req.DeliveryAddress.Name
|
orderAddress.State = req.DeliveryAddress.State
|
||||||
|
orderAddress.Suite = req.DeliveryAddress.Suite
|
||||||
|
orderAddress.ZipCode = req.DeliveryAddress.ZipCode
|
||||||
}
|
}
|
||||||
res, err := l.svcCtx.Repositories.NewOrder.CreatePrePaymentByDeposit(l.ctx, &repositories.CreatePrePaymentByDepositReq{
|
res, err := l.svcCtx.Repositories.NewOrder.CreatePrePaymentByDeposit(l.ctx, &repositories.CreatePrePaymentByDepositReq{
|
||||||
UserId: userinfo.UserId,
|
UserId: userinfo.UserId,
|
||||||
|
57
server/order/internal/logic/orderinvoicelogic.go
Normal file
57
server/order/internal/logic/orderinvoicelogic.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fusenapi/service/repositories"
|
||||||
|
"fusenapi/utils/auth"
|
||||||
|
"fusenapi/utils/basic"
|
||||||
|
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"fusenapi/server/order/internal/svc"
|
||||||
|
"fusenapi/server/order/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
|
)
|
||||||
|
|
||||||
|
type OrderInvoiceLogic struct {
|
||||||
|
logx.Logger
|
||||||
|
ctx context.Context
|
||||||
|
svcCtx *svc.ServiceContext
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewOrderInvoiceLogic(ctx context.Context, svcCtx *svc.ServiceContext) *OrderInvoiceLogic {
|
||||||
|
return &OrderInvoiceLogic{
|
||||||
|
Logger: logx.WithContext(ctx),
|
||||||
|
ctx: ctx,
|
||||||
|
svcCtx: svcCtx,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理进入前逻辑w,r
|
||||||
|
// func (l *OrderInvoiceLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) {
|
||||||
|
// }
|
||||||
|
|
||||||
|
func (l *OrderInvoiceLogic) OrderInvoice(req *types.OrderInvoiceReq, userinfo *auth.UserInfo) (resp *basic.Response) {
|
||||||
|
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||||
|
// userinfo 传入值时, 一定不为null
|
||||||
|
if !userinfo.IsUser() {
|
||||||
|
// 如果是,返回未授权的错误码
|
||||||
|
return resp.SetStatus(basic.CodeUnAuth)
|
||||||
|
}
|
||||||
|
res, err := l.svcCtx.Repositories.NewOrder.Invoice(l.ctx, &repositories.InvoiceReq{
|
||||||
|
OrderSn: req.OrderSn,
|
||||||
|
UserId: userinfo.UserId,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return resp.SetStatus(&res.ErrorCode)
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp.SetStatus(basic.CodeOK, map[string]interface{}{
|
||||||
|
"invoice_urls": res.InvoiceUrls,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理逻辑后 w,r 如:重定向, resp 必须重新处理
|
||||||
|
// func (l *OrderInvoiceLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) {
|
||||||
|
// // httpx.OkJsonCtx(r.Context(), w, resp)
|
||||||
|
// }
|
@ -7,6 +7,9 @@ import (
|
|||||||
"fusenapi/initalize"
|
"fusenapi/initalize"
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,10 +23,14 @@ type ServiceContext struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewServiceContext(c config.Config) *ServiceContext {
|
func NewServiceContext(c config.Config) *ServiceContext {
|
||||||
|
configAWS := aws.Config{
|
||||||
|
Credentials: credentials.NewStaticCredentials(c.AWS.S3.Credentials.AccessKeyID, c.AWS.S3.Credentials.Secret, c.AWS.S3.Credentials.Token),
|
||||||
|
}
|
||||||
conn := initalize.InitMysql(c.SourceMysql)
|
conn := initalize.InitMysql(c.SourceMysql)
|
||||||
// delayQueue := initalize.InitDelayMessage()
|
// delayQueue := initalize.InitDelayMessage()
|
||||||
repositories := initalize.NewAllRepositories(&initalize.NewAllRepositorieData{
|
repositories := initalize.NewAllRepositories(&initalize.NewAllRepositorieData{
|
||||||
GormDB: conn,
|
GormDB: conn,
|
||||||
|
AwsSession: session.Must(session.NewSession(&configAWS)),
|
||||||
// DelayQueue: delayQueue,
|
// DelayQueue: delayQueue,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ import (
|
|||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type OrderInvoiceReq struct {
|
||||||
|
OrderSn string `form:"order_sn"`
|
||||||
|
}
|
||||||
|
|
||||||
type CloseOrderReq struct {
|
type CloseOrderReq struct {
|
||||||
OrderSn string `json:"order_sn"`
|
OrderSn string `json:"order_sn"`
|
||||||
}
|
}
|
||||||
@ -28,9 +32,14 @@ type CreatePrePaymentByDepositReq struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DeliveryAddress struct {
|
type DeliveryAddress struct {
|
||||||
Address string `json:"address,optional"`
|
Street string `json:"street,optional"` // 街道
|
||||||
Name string `json:"name,optional"`
|
City string `json:"city,optional"` // 城市
|
||||||
Mobile string `json:"mobile,optional"`
|
FirstName string `json:"first_name,optional"` // 姓
|
||||||
|
LastName string `json:"last_name,optional"` // 名
|
||||||
|
Mobile string `json:"mobile,optional"` // 手机
|
||||||
|
State string `json:"state,optional"` // 州
|
||||||
|
Suite string `json:"suite,optional"` // 房号
|
||||||
|
ZipCode string `json:"zip_code,optional"` // 邮编
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreatePrePaymentByBalanceReq struct {
|
type CreatePrePaymentByBalanceReq struct {
|
||||||
|
281
server/order/invoice.html
Normal file
281
server/order/invoice.html
Normal file
@ -0,0 +1,281 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<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: 20px 5% 20px 6%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header_td {
|
||||||
|
width: 50%;
|
||||||
|
font-family: Montserrat-SemiBold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header_td.logo {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header_logo {
|
||||||
|
max-height: 15px;
|
||||||
|
max-width: 100%;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header_td.title {
|
||||||
|
color: #212121;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 36px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.information_warp {
|
||||||
|
padding: 30px 5% 30px 6%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.information_td {
|
||||||
|
width: 50%;
|
||||||
|
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 {
|
||||||
|
color: #212121;
|
||||||
|
}
|
||||||
|
|
||||||
|
.information_td.info {
|
||||||
|
color: #666666;
|
||||||
|
line-height: 17px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bill_warp {
|
||||||
|
padding: 0 5% 0 6%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bill_td {
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bill_td:first-child {
|
||||||
|
width: 47.59%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bill_td.title {
|
||||||
|
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: 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 {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total_warp {
|
||||||
|
padding: 14px 5% 24px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total_td {
|
||||||
|
color: #212121;
|
||||||
|
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: 1px dashed #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total_td.border-solid {
|
||||||
|
border-bottom: 2px solid #333;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.total_td.total {
|
||||||
|
padding-top: 12px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-family: Montserrat-SemiBold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notes_warp {
|
||||||
|
padding: 0 5% 0 6%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notes_td {
|
||||||
|
font-size: 13px;
|
||||||
|
color: #666;
|
||||||
|
font-weight: 300;
|
||||||
|
width: 50%;
|
||||||
|
line-height: 21px;
|
||||||
|
font-family: Montserrat-Light;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notes_td.title {
|
||||||
|
color: #212121;
|
||||||
|
font-weight: 500;
|
||||||
|
font-family: Montserrat-Medium;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notes_td.notes {
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</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>
|
||||||
|
<!-- 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. #20220562040</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="information_td info" align="left">Timmy Turner</td>
|
||||||
|
<td class="information_td right" align="right">Date: 2023/12/04</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="information_td info" align="left">North Street</td>
|
||||||
|
<td class="information_td" align="right"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="information_td info" align="left">London, SE20 3JW</td>
|
||||||
|
<td class="information_td" align="right"></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="information_td info" align="left">United Kingdom</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%">
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="bill_td info" align="left">Plastic bowl</td>
|
||||||
|
<td class="bill_td info" align="right">$01.00</td>
|
||||||
|
<td class="bill_td info" align="right">20,000 Units</td>
|
||||||
|
<td class="bill_td info" align="right">$99.00</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="bill_td info" align="left">Paper bag with handlexxxxxxxxxxxxxxx second line</td>
|
||||||
|
<td class="bill_td info" align="right">$01.00</td>
|
||||||
|
<td class="bill_td info" align="right">20,000 Units</td>
|
||||||
|
<td class="bill_td info" align="right">$99.00</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</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">$198.00</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">$0.00</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="total_td" align="right">Total</td>
|
||||||
|
<td class="total_td info" align="right">$198.00</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="total_td border-solid" align="right">Deposit Requested</td>
|
||||||
|
<td class="total_td info border-solid" align="right">$99.00</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="total_td total" align="right">Deposit Due</td>
|
||||||
|
<td class="total_td total" align="right">$99.00</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">ICBC</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. :20000000001</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -43,10 +43,10 @@ func (l *LogoCombineLogic) LogoCombine(req *types.LogoCombineReq, userinfo *auth
|
|||||||
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
// 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data)
|
||||||
// userinfo 传入值时, 一定不为null
|
// userinfo 传入值时, 一定不为null
|
||||||
|
|
||||||
if userinfo.IsOnlooker() {
|
// if userinfo.IsOnlooker() {
|
||||||
// 如果是,返回未授权的错误码
|
// // 如果是,返回未授权的错误码
|
||||||
return resp.SetStatus(basic.CodeUnAuth)
|
// return resp.SetStatus(basic.CodeUnAuth)
|
||||||
}
|
// }
|
||||||
|
|
||||||
if req.TemplateId == 0 || req.TemplateTag == "" {
|
if req.TemplateId == 0 || req.TemplateTag == "" {
|
||||||
return resp.SetStatus(basic.CodeLogoCombineNoFoundErr, "模版或标签不存在")
|
return resp.SetStatus(basic.CodeLogoCombineNoFoundErr, "模版或标签不存在")
|
||||||
|
@ -24,7 +24,10 @@ service order {
|
|||||||
post /api/order/delete(DeleteOrderReq) returns (response);
|
post /api/order/delete(DeleteOrderReq) returns (response);
|
||||||
|
|
||||||
@handler CloseOrderHandler
|
@handler CloseOrderHandler
|
||||||
post /api/order/close(CloseOrderReq) returns (response);
|
post /api/order/close(CloseOrderReq) returns (response)
|
||||||
|
|
||||||
|
@handler OrderInvoiceHandler
|
||||||
|
get /api/order/invoice(OrderInvoiceReq) returns (response);
|
||||||
|
|
||||||
@handler OrderListHandler
|
@handler OrderListHandler
|
||||||
get /api/order/list(OrderListReq) returns (response);
|
get /api/order/list(OrderListReq) returns (response);
|
||||||
@ -34,6 +37,12 @@ service order {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type (
|
||||||
|
OrderInvoiceReq {
|
||||||
|
OrderSn string `form:"order_sn"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
CloseOrderReq {
|
CloseOrderReq {
|
||||||
OrderSn string `json:"order_sn"`
|
OrderSn string `json:"order_sn"`
|
||||||
@ -60,9 +69,14 @@ type CreatePrePaymentByDepositReq {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DeliveryAddress {
|
type DeliveryAddress {
|
||||||
Address string `json:"address,optional"`
|
Street string `json:"street,optional"` // 街道
|
||||||
Name string `json:"name,optional"`
|
City string `json:"city,optional"` // 城市
|
||||||
Mobile string `json:"mobile,optional"`
|
FirstName string `json:"first_name,optional"` // 姓
|
||||||
|
LastName string `json:"last_name,optional"` // 名
|
||||||
|
Mobile string `json:"mobile,optional"` // 手机
|
||||||
|
State string `json:"state,optional"` // 州
|
||||||
|
Suite string `json:"suite,optional"` // 房号
|
||||||
|
ZipCode string `json:"zip_code,optional"` // 邮编
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreatePrePaymentByBalanceReq {
|
type CreatePrePaymentByBalanceReq {
|
||||||
|
@ -8,9 +8,12 @@ import (
|
|||||||
"fusenapi/constants"
|
"fusenapi/constants"
|
||||||
"fusenapi/model/gmodel"
|
"fusenapi/model/gmodel"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
|
"fusenapi/utils/file"
|
||||||
"fusenapi/utils/handlers"
|
"fusenapi/utils/handlers"
|
||||||
|
"fusenapi/utils/hash"
|
||||||
"fusenapi/utils/order"
|
"fusenapi/utils/order"
|
||||||
"fusenapi/utils/pay"
|
"fusenapi/utils/pay"
|
||||||
|
"fusenapi/utils/pdf"
|
||||||
"fusenapi/utils/queue"
|
"fusenapi/utils/queue"
|
||||||
"math"
|
"math"
|
||||||
"time"
|
"time"
|
||||||
@ -25,6 +28,7 @@ func NewOrder(gormDB *gorm.DB, awsSession *session.Session, delayQueue *queue.De
|
|||||||
return &defaultOrder{
|
return &defaultOrder{
|
||||||
MysqlConn: gormDB,
|
MysqlConn: gormDB,
|
||||||
DelayQueue: delayQueue,
|
DelayQueue: delayQueue,
|
||||||
|
AwsSession: awsSession,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,6 +36,7 @@ type (
|
|||||||
defaultOrder struct {
|
defaultOrder struct {
|
||||||
MysqlConn *gorm.DB
|
MysqlConn *gorm.DB
|
||||||
DelayQueue *queue.DelayMessage
|
DelayQueue *queue.DelayMessage
|
||||||
|
AwsSession *session.Session
|
||||||
}
|
}
|
||||||
Order interface {
|
Order interface {
|
||||||
// 下单
|
// 下单
|
||||||
@ -44,6 +49,8 @@ type (
|
|||||||
List(ctx context.Context, in *ListReq) (res *ListRes, err error)
|
List(ctx context.Context, in *ListReq) (res *ListRes, err error)
|
||||||
// 详情
|
// 详情
|
||||||
Detail(ctx context.Context, in *DetailReq) (res *DetailRes, err error)
|
Detail(ctx context.Context, in *DetailReq) (res *DetailRes, err error)
|
||||||
|
// 发票
|
||||||
|
Invoice(ctx context.Context, in *InvoiceReq) (res *InvoiceRes, err error)
|
||||||
// 支付成功
|
// 支付成功
|
||||||
PaymentSuccessful(ctx context.Context, in *PaymentSuccessfulReq) (res *PaymentSuccessfulRes, err error)
|
PaymentSuccessful(ctx context.Context, in *PaymentSuccessfulReq) (res *PaymentSuccessfulRes, err error)
|
||||||
// 关闭
|
// 关闭
|
||||||
@ -65,9 +72,14 @@ type (
|
|||||||
}
|
}
|
||||||
|
|
||||||
OrderAddress struct {
|
OrderAddress struct {
|
||||||
Address string `json:"address"` // 详细地址
|
Street string `json:"street"` // 详细地址
|
||||||
Mobile string `json:"mobile"` // 手机
|
City string `json:"city"` // 城市
|
||||||
Name string `json:"name"` // 姓名
|
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"` // 邮编号码
|
||||||
}
|
}
|
||||||
OrderPay struct {
|
OrderPay struct {
|
||||||
ClientSecret string `json:"client_secret"` // 支付方--秘钥
|
ClientSecret string `json:"client_secret"` // 支付方--秘钥
|
||||||
@ -85,6 +97,16 @@ type (
|
|||||||
Amount int64 `json:"amount"` // 金额
|
Amount int64 `json:"amount"` // 金额
|
||||||
Label string `json:"label"` // 标签
|
Label string `json:"label"` // 标签
|
||||||
}
|
}
|
||||||
|
/* 发票 */
|
||||||
|
InvoiceReq struct {
|
||||||
|
UserId int64 `json:"user_id"`
|
||||||
|
OrderSn string `json:"order_sn"`
|
||||||
|
}
|
||||||
|
InvoiceRes struct {
|
||||||
|
ErrorCode basic.StatusResponse
|
||||||
|
InvoiceUrls []string `json:"invoice_urls"`
|
||||||
|
}
|
||||||
|
/* 发票 */
|
||||||
|
|
||||||
/* 删除订单 */
|
/* 删除订单 */
|
||||||
DeleteReq struct {
|
DeleteReq struct {
|
||||||
@ -210,6 +232,292 @@ type (
|
|||||||
/* 列表 */
|
/* 列表 */
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 订单发票
|
||||||
|
func (d *defaultOrder) Invoice(ctx context.Context, in *InvoiceReq) (res *InvoiceRes, err error) {
|
||||||
|
var errorCode basic.StatusResponse
|
||||||
|
var orderInfo gmodel.FsOrder
|
||||||
|
var receiptSnsResources []string
|
||||||
|
var receiptSnsDeposit string
|
||||||
|
var receiptSnsFinal string
|
||||||
|
var invoiceUrls []string
|
||||||
|
|
||||||
|
var orderTradeDeposit gmodel.FsOrderTrade
|
||||||
|
var orderTradeFinal gmodel.FsOrderTrade
|
||||||
|
model := d.MysqlConn.Where("is_del = ?", 0)
|
||||||
|
if in.UserId != 0 {
|
||||||
|
model = model.Where("user_id = ?", in.UserId)
|
||||||
|
}
|
||||||
|
if in.OrderSn != "" {
|
||||||
|
model = model.Where("order_sn = ?", in.OrderSn)
|
||||||
|
}
|
||||||
|
result := model.Take(&orderInfo)
|
||||||
|
if result.Error != nil {
|
||||||
|
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||||
|
errorCode = *basic.CodeErrOrderCreatePrePaymentInfoNoFound
|
||||||
|
} else {
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
}
|
||||||
|
logc.Errorf(ctx, "order invoice detail failed, err: %v", err)
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, result.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
if *orderInfo.PayStatus == int64(constants.ORDER_PAY_STATUS_PAIDDEPOSIT) || *orderInfo.PayStatus == int64(constants.ORDER_PAY_STATUS_PAIDDREMAINING) {
|
||||||
|
// 查询支付账单
|
||||||
|
var orderTradeList []gmodel.FsOrderTrade
|
||||||
|
|
||||||
|
model1 := d.MysqlConn
|
||||||
|
if in.OrderSn != "" {
|
||||||
|
model1 = model1.Where("order_sn = ?", in.OrderSn)
|
||||||
|
}
|
||||||
|
result1 := model1.Find(&orderTradeList)
|
||||||
|
if result1.Error != nil {
|
||||||
|
if errors.Is(result1.Error, gorm.ErrRecordNotFound) {
|
||||||
|
errorCode = *basic.CodeErrOrderCreatePrePaymentInfoNoFound
|
||||||
|
} else {
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
}
|
||||||
|
logc.Errorf(ctx, "order invoice trade failed, err: %v", err)
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, result1.Error
|
||||||
|
}
|
||||||
|
if len(orderTradeList) > 0 {
|
||||||
|
for _, orderTrade := range orderTradeList {
|
||||||
|
receiptSnsResources = append(receiptSnsResources, hash.JsonHashKey(*orderTrade.ReceiptSn))
|
||||||
|
if *orderTrade.PayStage == 1 {
|
||||||
|
receiptSnsDeposit = *orderTrade.ReceiptSn
|
||||||
|
orderTradeDeposit = orderTrade
|
||||||
|
}
|
||||||
|
if *orderTrade.PayStage == 2 {
|
||||||
|
receiptSnsFinal = *orderTrade.ReceiptSn
|
||||||
|
orderTradeFinal = orderTrade
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 查询支付账单
|
||||||
|
var resourceList []gmodel.FsResource
|
||||||
|
result2 := d.MysqlConn.Where("resource_id in ?", receiptSnsResources).Find(&resourceList)
|
||||||
|
if result2.Error != nil {
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
logc.Errorf(ctx, "order invoice esource failed, err: %v", err)
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, result1.Error
|
||||||
|
}
|
||||||
|
resourceListLen := len(resourceList)
|
||||||
|
for _, resource := range resourceList {
|
||||||
|
invoiceUrls = append(invoiceUrls, *resource.ResourceUrl)
|
||||||
|
}
|
||||||
|
if *orderInfo.PayStatus == int64(constants.ORDER_PAY_STATUS_PAIDDEPOSIT) {
|
||||||
|
if resourceListLen == 1 {
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
InvoiceUrls: invoiceUrls,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
if resourceListLen == 0 {
|
||||||
|
receiptSnsFinal = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if *orderInfo.PayStatus == int64(constants.ORDER_PAY_STATUS_PAIDDREMAINING) {
|
||||||
|
if resourceListLen == 2 {
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
InvoiceUrls: invoiceUrls,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
if resourceListLen == 1 {
|
||||||
|
receiptSnsDeposit = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errorCode = *basic.CodeErrOrderCreatePrePaymentInfoNoFound
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, errors.New("get order invoice failed, not found")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = errors.New("get order invoice failed, pay status is illegality")
|
||||||
|
errorCode = *basic.CodeErrOrderInvoiceStatusIllegality
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, err
|
||||||
|
}
|
||||||
|
|
||||||
|
ress, err := d.OrderDetailHandler(ctx, &orderInfo, 1)
|
||||||
|
if err != nil {
|
||||||
|
logc.Errorf(ctx, "order invoice detail handler failed, err: %v", err)
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, err
|
||||||
|
} else {
|
||||||
|
var model001 = constants.INVOICE_TEMPLATE_01
|
||||||
|
var model002 string
|
||||||
|
var model003 string
|
||||||
|
var model004 string
|
||||||
|
var model005 string
|
||||||
|
var model006 = constants.INVOICE_TEMPLATE_06
|
||||||
|
// 生成收据发票--首款
|
||||||
|
ctimeDate := orderInfo.Ctime.Format("2006/01/02")
|
||||||
|
var name string
|
||||||
|
var city string
|
||||||
|
var street string
|
||||||
|
var state string
|
||||||
|
if ress.OrderDetail.DeliveryAddress != nil {
|
||||||
|
name = fmt.Sprintf("%s %s", ress.OrderDetail.DeliveryAddress.FirstName, ress.OrderDetail.DeliveryAddress.LastName)
|
||||||
|
street = ress.OrderDetail.DeliveryAddress.Street
|
||||||
|
city = ress.OrderDetail.DeliveryAddress.City
|
||||||
|
state = ress.OrderDetail.DeliveryAddress.State
|
||||||
|
}
|
||||||
|
|
||||||
|
var products string
|
||||||
|
for _, orderProduct := range ress.OrderDetail.OrderProduct {
|
||||||
|
var model00301 = constants.INVOICE_TEMPLATE_0301
|
||||||
|
var price = fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(orderProduct.ItemPrice.Current.CurrentCurrency)], orderProduct.ItemPrice.Current.CurrentAmount.(string))
|
||||||
|
var priceTotal = fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(orderProduct.TotalPrice.Current.CurrentCurrency)], orderProduct.TotalPrice.Current.CurrentAmount.(string))
|
||||||
|
var productsInfo = fmt.Sprintf(model00301, orderProduct.ProductName, price, orderProduct.PurchaseQuantity.Current, priceTotal)
|
||||||
|
products = products + productsInfo
|
||||||
|
}
|
||||||
|
model003 = fmt.Sprintf(constants.INVOICE_TEMPLATE_03, "", products)
|
||||||
|
|
||||||
|
var subtotal = fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Subtotal.Current.CurrentAmount.(string))
|
||||||
|
var taxStr = "0.00"
|
||||||
|
if ress.OrderDetail.OrderAmount.Tax.Current.CurrentAmount != nil {
|
||||||
|
taxStr = ress.OrderDetail.OrderAmount.Tax.Current.CurrentAmount.(string)
|
||||||
|
}
|
||||||
|
var taxCurrency string = constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Tax.Current.CurrentCurrency)]
|
||||||
|
if taxCurrency == "" {
|
||||||
|
taxCurrency = constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Total.Current.CurrentCurrency)]
|
||||||
|
}
|
||||||
|
var tax = fmt.Sprintf("%s%s", taxCurrency, taxStr)
|
||||||
|
var total = fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Total.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Total.Current.CurrentAmount.(string))
|
||||||
|
|
||||||
|
if receiptSnsDeposit != "" {
|
||||||
|
v1 := receiptSnsDeposit
|
||||||
|
v2 := name
|
||||||
|
v3 := ctimeDate
|
||||||
|
v4 := street
|
||||||
|
v5 := city
|
||||||
|
v6 := state
|
||||||
|
model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, "", v1, v2, v3, v4, v5, v6)
|
||||||
|
|
||||||
|
v7 := "Deposit Requested"
|
||||||
|
v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.Deposit.PayAmount.Current.CurrentAmount.(string))
|
||||||
|
v9 := "Deposit Due"
|
||||||
|
v10 := v8
|
||||||
|
model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, "", subtotal, tax, total, v7, v8, v9, v10)
|
||||||
|
|
||||||
|
cardSn := "****" + *orderTradeDeposit.CardSn
|
||||||
|
model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, "", *orderTradeDeposit.CardBrand, cardSn)
|
||||||
|
|
||||||
|
var content = model001 + model002 + model003 + model004 + model005 + model006
|
||||||
|
|
||||||
|
base64, err := pdf.HtmlToPdfBase64(content, "html")
|
||||||
|
if err != nil {
|
||||||
|
logc.Errorf(ctx, "order invoice HtmlToPdfBase64 failed, err: %v", err)
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, err
|
||||||
|
}
|
||||||
|
// 根据hash 查询数据资源
|
||||||
|
var resourceId string = hash.JsonHashKey(receiptSnsDeposit)
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
var upload = file.Upload{
|
||||||
|
Ctx: ctx,
|
||||||
|
MysqlConn: d.MysqlConn,
|
||||||
|
AwsSession: d.AwsSession,
|
||||||
|
}
|
||||||
|
uploadRes, err := upload.UploadFileByBase64(&file.UploadBaseReq{
|
||||||
|
FileHash: resourceId,
|
||||||
|
FileData: "data:application/pdf;base64," + base64,
|
||||||
|
UploadBucket: 1,
|
||||||
|
ApiType: 2,
|
||||||
|
UserId: *orderInfo.UserId,
|
||||||
|
GuestId: 0,
|
||||||
|
Source: "order_invoice",
|
||||||
|
Refresh: 1,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
if err != nil {
|
||||||
|
logc.Errorf(ctx, "order invoice UploadFileByBase64 failed, err: %v", err)
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
invoiceUrls = append(invoiceUrls, uploadRes.ResourceUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成收据发票--尾款
|
||||||
|
if receiptSnsFinal != "" {
|
||||||
|
v1 := receiptSnsFinal
|
||||||
|
v2 := name
|
||||||
|
v3 := ctimeDate
|
||||||
|
v4 := street
|
||||||
|
v5 := city
|
||||||
|
v6 := state
|
||||||
|
model002 = fmt.Sprintf(constants.INVOICE_TEMPLATE_02, "", v1, v2, v3, v4, v5, v6)
|
||||||
|
|
||||||
|
v7 := "Balance Requested"
|
||||||
|
v8 := fmt.Sprintf("%s%s", constants.OrderCurrencyMessage[constants.Currency(ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentCurrency)], ress.OrderDetail.OrderAmount.RemainingBalance.PayAmount.Current.CurrentAmount.(string))
|
||||||
|
v9 := "Balance Due"
|
||||||
|
v10 := v8
|
||||||
|
model004 = fmt.Sprintf(constants.INVOICE_TEMPLATE_04, "", subtotal, tax, total, v7, v8, v9, v10)
|
||||||
|
|
||||||
|
cardSn := "****" + *orderTradeFinal.CardSn
|
||||||
|
model005 = fmt.Sprintf(constants.INVOICE_TEMPLATE_05, "", *orderTradeDeposit.CardBrand, cardSn)
|
||||||
|
var content = model001 + model002 + model003 + model004 + model005 + model006
|
||||||
|
base64, err := pdf.HtmlToPdfBase64(content, "html")
|
||||||
|
if err != nil {
|
||||||
|
logc.Errorf(ctx, "order invoice HtmlToPdfBase64 failed, err: %v", err)
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, err
|
||||||
|
}
|
||||||
|
// 根据hash 查询数据资源
|
||||||
|
var resourceId string = hash.JsonHashKey(receiptSnsDeposit)
|
||||||
|
|
||||||
|
// 上传文件
|
||||||
|
var upload = file.Upload{
|
||||||
|
Ctx: ctx,
|
||||||
|
MysqlConn: d.MysqlConn,
|
||||||
|
AwsSession: d.AwsSession,
|
||||||
|
}
|
||||||
|
uploadRes, err := upload.UploadFileByBase64(&file.UploadBaseReq{
|
||||||
|
FileHash: resourceId,
|
||||||
|
FileData: "data:application/pdf;base64," + base64,
|
||||||
|
UploadBucket: 1,
|
||||||
|
ApiType: 2,
|
||||||
|
UserId: *orderInfo.UserId,
|
||||||
|
GuestId: 0,
|
||||||
|
Source: "order_invoice",
|
||||||
|
Refresh: 1,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
if err != nil {
|
||||||
|
logc.Errorf(ctx, "order invoice UploadFileByBase64 failed, err: %v", err)
|
||||||
|
errorCode = *basic.CodeServiceErr
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
}, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
invoiceUrls = append(invoiceUrls, uploadRes.ResourceUrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &InvoiceRes{
|
||||||
|
ErrorCode: errorCode,
|
||||||
|
InvoiceUrls: invoiceUrls,
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 订单删除
|
// 订单删除
|
||||||
func (d *defaultOrder) Delete(ctx context.Context, in *DeleteReq) (res *DeleteRes, err error) {
|
func (d *defaultOrder) Delete(ctx context.Context, in *DeleteReq) (res *DeleteRes, err error) {
|
||||||
var errorCode basic.StatusResponse
|
var errorCode basic.StatusResponse
|
||||||
@ -626,6 +934,7 @@ func (d *defaultOrder) PaymentSuccessful(ctx context.Context, in *PaymentSuccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 新增交易信息
|
// 新增交易信息
|
||||||
|
receiptSn := order.GenerateReceiptNumber()
|
||||||
tx.Create(&gmodel.FsOrderTrade{
|
tx.Create(&gmodel.FsOrderTrade{
|
||||||
UserId: orderInfo.UserId,
|
UserId: orderInfo.UserId,
|
||||||
OrderSn: &orderSn,
|
OrderSn: &orderSn,
|
||||||
@ -642,6 +951,7 @@ func (d *defaultOrder) PaymentSuccessful(ctx context.Context, in *PaymentSuccess
|
|||||||
Ctime: &ntime,
|
Ctime: &ntime,
|
||||||
Utime: &ntime,
|
Utime: &ntime,
|
||||||
PayTitle: &payTitle,
|
PayTitle: &payTitle,
|
||||||
|
ReceiptSn: &receiptSn,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 更新数据库
|
// 更新数据库
|
||||||
@ -818,9 +1128,14 @@ func (d *defaultOrder) CreatePrePaymentByDeposit(ctx context.Context, in *Create
|
|||||||
|
|
||||||
if in.DeliveryMethod == constants.DELIVERYMETHODDIRECTMAIL && in.DeliveryAddress != nil {
|
if in.DeliveryMethod == constants.DELIVERYMETHODDIRECTMAIL && in.DeliveryAddress != nil {
|
||||||
orderAddress = &gmodel.OrderAddress{
|
orderAddress = &gmodel.OrderAddress{
|
||||||
Name: in.DeliveryAddress.Name,
|
Street: in.DeliveryAddress.Street,
|
||||||
Mobile: in.DeliveryAddress.Mobile,
|
City: in.DeliveryAddress.City,
|
||||||
Address: in.DeliveryAddress.Address,
|
FirstName: in.DeliveryAddress.FirstName,
|
||||||
|
LastName: in.DeliveryAddress.LastName,
|
||||||
|
Mobile: in.DeliveryAddress.Mobile,
|
||||||
|
State: in.DeliveryAddress.State,
|
||||||
|
Suite: in.DeliveryAddress.Suite,
|
||||||
|
ZipCode: in.DeliveryAddress.ZipCode,
|
||||||
}
|
}
|
||||||
orderAddressByte, err = json.Marshal(orderAddress)
|
orderAddressByte, err = json.Marshal(orderAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1101,8 +1416,14 @@ func (d *defaultOrder) Create(ctx context.Context, in *CreateReq) (res *CreateRe
|
|||||||
// 直邮
|
// 直邮
|
||||||
if in.DeliveryMethod == constants.DELIVERYMETHODDIRECTMAIL {
|
if in.DeliveryMethod == constants.DELIVERYMETHODDIRECTMAIL {
|
||||||
orderAddress = &gmodel.OrderAddress{
|
orderAddress = &gmodel.OrderAddress{
|
||||||
Mobile: in.DeliveryAddress.Mobile,
|
Street: in.DeliveryAddress.Street,
|
||||||
Name: in.DeliveryAddress.Name,
|
City: in.DeliveryAddress.City,
|
||||||
|
FirstName: in.DeliveryAddress.FirstName,
|
||||||
|
LastName: in.DeliveryAddress.LastName,
|
||||||
|
Mobile: in.DeliveryAddress.Mobile,
|
||||||
|
State: in.DeliveryAddress.State,
|
||||||
|
Suite: in.DeliveryAddress.Suite,
|
||||||
|
ZipCode: in.DeliveryAddress.ZipCode,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 预计交付时间
|
// 预计交付时间
|
||||||
|
@ -113,6 +113,7 @@ var (
|
|||||||
CodeErrOrderCreatePrePaymentPaid = &StatusResponse{5309, "create payment failed, order is paid"}
|
CodeErrOrderCreatePrePaymentPaid = &StatusResponse{5309, "create payment failed, order is paid"}
|
||||||
CodeErrOrderCreatePrePaymentTimeout = &StatusResponse{5310, "create payment failed, timeout"}
|
CodeErrOrderCreatePrePaymentTimeout = &StatusResponse{5310, "create payment failed, timeout"}
|
||||||
CodeErrOrderDeleteStatusIllegality = &StatusResponse{5311, "delete order failed, status is illegality"}
|
CodeErrOrderDeleteStatusIllegality = &StatusResponse{5311, "delete order failed, status is illegality"}
|
||||||
|
CodeErrOrderInvoiceStatusIllegality = &StatusResponse{5312, "get order invoice failed, pay status is illegality"}
|
||||||
)
|
)
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
|
@ -125,10 +125,15 @@ func GetPurchaseQuantity(req *gmodel.PurchaseQuantity) gmodel.PurchaseQuantity {
|
|||||||
func GenerateOrderNumber() string {
|
func GenerateOrderNumber() string {
|
||||||
t := time.Now()
|
t := time.Now()
|
||||||
orderNumber := fmt.Sprintf("%d%02d%02d%08d", t.Year(), t.Month(), t.Day(), t.UnixNano()%100000000)
|
orderNumber := fmt.Sprintf("%d%02d%02d%08d", t.Year(), t.Month(), t.Day(), t.UnixNano()%100000000)
|
||||||
fmt.Println(orderNumber)
|
|
||||||
return orderNumber
|
return orderNumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 生成收据编号
|
||||||
|
func GenerateReceiptNumber() string {
|
||||||
|
t := time.Now()
|
||||||
|
return fmt.Sprintf("%02d%02d%02d%08d", t.Year()%100, t.Month(), t.Day(), t.UnixNano()%100000000)
|
||||||
|
}
|
||||||
|
|
||||||
// 初始化订单状态--链路
|
// 初始化订单状态--链路
|
||||||
func GenerateOrderStatusLink(deliveryMethod int64, noTime time.Time, expectedTime time.Time) []gmodel.OrderStatus {
|
func GenerateOrderStatusLink(deliveryMethod int64, noTime time.Time, expectedTime time.Time) []gmodel.OrderStatus {
|
||||||
var list []gmodel.OrderStatus
|
var list []gmodel.OrderStatus
|
||||||
|
5
utils/order/order_invoice.go
Normal file
5
utils/order/order_invoice.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package order
|
||||||
|
|
||||||
|
func GetOrderInvoice() string {
|
||||||
|
return ""
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user