更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -13,22 +13,15 @@ import (
|
||||
beelog "github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
/* =============================================================
|
||||
* 日终对账:渠道账单导入 -> 与本地支付流水比对 -> 产出差异 -> 人工标记处理
|
||||
* 差异类型:long 长款(渠道有本地无)/ short 短款(本地有渠道无)/ status_mismatch 状态不一致
|
||||
* ============================================================= */
|
||||
|
||||
// BillRow 渠道账单明细行(导入用)
|
||||
type BillRow struct {
|
||||
ChannelTradeNo string // 渠道流水号
|
||||
OutTradeNo string // 渠道侧商户订单号(下单时传的 pay_no)
|
||||
Amount int64 // 渠道金额(分)
|
||||
Fee int64 // 渠道手续费(分)
|
||||
TradeState string // 渠道侧交易状态
|
||||
TradeTime *time.Time // 渠道交易时间
|
||||
ChannelTradeNo string
|
||||
OutTradeNo string
|
||||
Amount int64
|
||||
Fee int64
|
||||
TradeState string
|
||||
TradeTime *time.Time
|
||||
}
|
||||
|
||||
// ImportChannelBill 导入某渠道某日的账单明细(幂等:按 channel + channel_trade_no 更新或插入)
|
||||
func ImportChannelBill(ctx context.Context, channel, billDate string, rows []BillRow) (int, error) {
|
||||
day, err := time.ParseInLocation("2006-01-02", billDate, time.Local)
|
||||
if err != nil {
|
||||
@@ -72,10 +65,7 @@ func ImportChannelBill(ctx context.Context, channel, billDate string, rows []Bil
|
||||
return imported, nil
|
||||
}
|
||||
|
||||
// ParseChannelBillCSV 解析账单 CSV。
|
||||
// 约定列:channel_trade_no, out_trade_no, amount(元), fee(元), trade_state, trade_time
|
||||
// TODO(渠道): 各渠道账单文件列名/编码不同(微信为制表符分隔、支付宝为 GBK CSV),
|
||||
// 对接时按渠道导出文件写各自的解析器,统一转成 BillRow。
|
||||
func ParseChannelBillCSV(data []byte) ([]BillRow, error) {
|
||||
reader := csv.NewReader(strings.NewReader(string(data)))
|
||||
reader.TrimLeadingSpace = true
|
||||
@@ -121,7 +111,6 @@ func ParseChannelBillCSV(data []byte) ([]BillRow, error) {
|
||||
return rows, nil
|
||||
}
|
||||
|
||||
// ReconcileSummary 一次对账的执行结果
|
||||
type ReconcileSummary struct {
|
||||
BatchNo string `json:"batch_no"`
|
||||
Channel string `json:"channel"`
|
||||
@@ -133,9 +122,6 @@ type ReconcileSummary struct {
|
||||
MismatchCount int `json:"mismatch_count"`
|
||||
}
|
||||
|
||||
// RunReconcile 对某渠道某日的账单与本地支付流水做比对,产出差异(幂等:按唯一键更新已有差异)。
|
||||
// 匹配策略:渠道账单的商户订单号即本地下单时传的 pay_no,优先按 pay_no 匹配,其次按 out_trade_no;
|
||||
// 本地侧只统计支付成功日(paid_at)落在对账日内的支付单。
|
||||
func RunReconcile(ctx context.Context, channel, billDate string) (*ReconcileSummary, error) {
|
||||
day, err := time.ParseInLocation("2006-01-02", billDate, time.Local)
|
||||
if err != nil {
|
||||
@@ -222,7 +208,6 @@ func RunReconcile(ctx context.Context, channel, billDate string) (*ReconcileSumm
|
||||
return summary, nil
|
||||
}
|
||||
|
||||
// upsertDiff 写入/更新差异记录(幂等:唯一键 channel+bill_date+diff_type+channel_trade_no+local_trade_no)
|
||||
func upsertDiff(channel string, day time.Time, batchNo, localTradeNo, channelTradeNo, diffType string, localAmount, channelAmount *int64, remark string) error {
|
||||
exist := &models.PlatformPaymentReconcileDiff{}
|
||||
err := models.Orm.QueryTable(new(models.PlatformPaymentReconcileDiff)).
|
||||
@@ -274,7 +259,6 @@ func upsertDiff(channel string, day time.Time, batchNo, localTradeNo, channelTra
|
||||
return err
|
||||
}
|
||||
|
||||
// ReconcileListInput 差异列表查询条件
|
||||
type ReconcileListInput struct {
|
||||
Channel string
|
||||
BillDate string
|
||||
@@ -284,7 +268,6 @@ type ReconcileListInput struct {
|
||||
PageSize int
|
||||
}
|
||||
|
||||
// ListReconcileDiffs 对账差异分页
|
||||
func ListReconcileDiffs(in ReconcileListInput) ([]models.PlatformPaymentReconcileDiff, int64, error) {
|
||||
qs := models.Orm.QueryTable(new(models.PlatformPaymentReconcileDiff)).Filter("delete_time__isnull", true)
|
||||
if in.Channel != "" {
|
||||
@@ -316,16 +299,14 @@ func ListReconcileDiffs(in ReconcileListInput) ([]models.PlatformPaymentReconcil
|
||||
return rows, total, err
|
||||
}
|
||||
|
||||
// MarkDiffHandledInput 标记差异处理入参
|
||||
type MarkDiffHandledInput struct {
|
||||
ID uint64
|
||||
HandleStatus string // handled / handling / ignored
|
||||
HandleStatus string
|
||||
Remark string
|
||||
OperatorID string
|
||||
OperatorName string
|
||||
}
|
||||
|
||||
// MarkDiffHandled 标记对账差异处理状态
|
||||
func MarkDiffHandled(ctx context.Context, in MarkDiffHandledInput) (*models.PlatformPaymentReconcileDiff, error) {
|
||||
row := &models.PlatformPaymentReconcileDiff{}
|
||||
if err := models.Orm.QueryTable(new(models.PlatformPaymentReconcileDiff)).
|
||||
@@ -356,7 +337,6 @@ func MarkDiffHandled(ctx context.Context, in MarkDiffHandledInput) (*models.Plat
|
||||
return GetReconcileDiffByID(in.ID)
|
||||
}
|
||||
|
||||
// GetReconcileDiffByID 按 ID 查询差异记录
|
||||
func GetReconcileDiffByID(id uint64) (*models.PlatformPaymentReconcileDiff, error) {
|
||||
row := &models.PlatformPaymentReconcileDiff{}
|
||||
err := models.Orm.QueryTable(new(models.PlatformPaymentReconcileDiff)).
|
||||
|
||||
Reference in new issue
Block a user