订单新增先用后付
This commit is contained in:
parent
eb8d7ca118
commit
d18a5243f2
@ -5,7 +5,7 @@ import (
|
|||||||
"micro-bundle/internal/controller"
|
"micro-bundle/internal/controller"
|
||||||
_ "micro-bundle/internal/handler"
|
_ "micro-bundle/internal/handler"
|
||||||
"micro-bundle/pkg/app"
|
"micro-bundle/pkg/app"
|
||||||
"micro-bundle/pkg/cron"
|
// "micro-bundle/pkg/cron" // 定时任务已迁移至客户端 fonchain-fiee
|
||||||
"micro-bundle/pkg/db"
|
"micro-bundle/pkg/db"
|
||||||
"micro-bundle/pkg/tracing"
|
"micro-bundle/pkg/tracing"
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ func main() {
|
|||||||
if err = config.Load(); err != nil {
|
if err = config.Load(); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
cron.InitCronJob() // 定时任务
|
// cron.InitCronJob() // 定时任务(先用后付到期扫描已迁移至客户端 fonchain-fiee 的 cron 执行,通过 MarkOverdueOrders RPC 调用)
|
||||||
select {}
|
select {}
|
||||||
// dao.AddBundleExtendRecord(model.BundleExtensionRecords{
|
// dao.AddBundleExtendRecord(model.BundleExtensionRecords{
|
||||||
// UserId: 57,
|
// UserId: 57,
|
||||||
|
|||||||
@ -58,6 +58,16 @@ func (b *BundleProvider) GetInEffectOrderRecord(_ context.Context, req *bundle.G
|
|||||||
return logic.GetInEffectOrderRecord(req)
|
return logic.GetInEffectOrderRecord(req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CheckOrderEligibility 下单前置校验(先用后付)
|
||||||
|
func (b *BundleProvider) CheckOrderEligibility(_ context.Context, req *bundle.CheckOrderEligibilityRequest) (res *bundle.CheckOrderEligibilityResponse, err error) {
|
||||||
|
return logic.CheckOrderEligibility(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarkOverdueOrders 扫描到期订单(兜底接口,可由外部定时任务调用)
|
||||||
|
func (b *BundleProvider) MarkOverdueOrders(_ context.Context, req *bundle.MarkOverdueOrdersRequest) (res *bundle.MarkOverdueOrdersResponse, err error) {
|
||||||
|
return logic.MarkOverdueOrders(req)
|
||||||
|
}
|
||||||
|
|
||||||
// 增值套餐相关
|
// 增值套餐相关
|
||||||
func (b *BundleProvider) CreateValueAddBundle(_ context.Context, req *bundle.CreateValueAddBundleRequest) (res *bundle.CreateValueAddBundleResponse, err error) {
|
func (b *BundleProvider) CreateValueAddBundle(_ context.Context, req *bundle.CreateValueAddBundleRequest) (res *bundle.CreateValueAddBundleResponse, err error) {
|
||||||
if err = req.Validate(); err != nil {
|
if err = req.Validate(); err != nil {
|
||||||
|
|||||||
@ -23,6 +23,7 @@ func CreateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err err
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 测试注释
|
||||||
func UpdateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err error) {
|
func UpdateBundle(req *model.BundleProfile) (res *bundle.CommonResponse, err error) {
|
||||||
res = new(bundle.CommonResponse)
|
res = new(bundle.CommonResponse)
|
||||||
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("uuid = ? and language= ?", req.UUID, req.Language).Updates(req).Error
|
err = app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("uuid = ? and language= ?", req.UUID, req.Language).Updates(req).Error
|
||||||
@ -64,6 +65,10 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
|
|||||||
query = query.Where("language like ?", req.Language)
|
query = query.Where("language like ?", req.Language)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BundleType != 0 {
|
||||||
|
query = query.Where("bundle_type = ?", req.BundleType)
|
||||||
|
}
|
||||||
|
|
||||||
count := *query
|
count := *query
|
||||||
|
|
||||||
if req.PageSize != 0 && req.Page != 0 {
|
if req.PageSize != 0 && req.Page != 0 {
|
||||||
@ -88,6 +93,8 @@ func BundleList(req *bundle.BundleListRequest) (res *bundle.BundleListResponse,
|
|||||||
CompanySign: bundleProfile.CompanySign,
|
CompanySign: bundleProfile.CompanySign,
|
||||||
ContractDuration: int64(bundleProfile.ContractDuration),
|
ContractDuration: int64(bundleProfile.ContractDuration),
|
||||||
BundleCommonUid: bundleProfile.BundleCommonUid,
|
BundleCommonUid: bundleProfile.BundleCommonUid,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
|
PayLaterTime: int64(bundleProfile.PayLaterTime),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +134,8 @@ func BundleDetail(uuid string) (res *bundle.BundleProfile, err error) {
|
|||||||
CompanySign: bundleProfile.CompanySign,
|
CompanySign: bundleProfile.CompanySign,
|
||||||
ContractDuration: int64(bundleProfile.ContractDuration),
|
ContractDuration: int64(bundleProfile.ContractDuration),
|
||||||
BundleCommonUid: bundleProfile.BundleCommonUid,
|
BundleCommonUid: bundleProfile.BundleCommonUid,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
|
PayLaterTime: int64(bundleProfile.PayLaterTime),
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -150,6 +159,10 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
|||||||
baseQuery = baseQuery.Where("language like ?", req.Language)
|
baseQuery = baseQuery.Where("language like ?", req.Language)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BundleType != 0 {
|
||||||
|
baseQuery = baseQuery.Where("bundle_type = ?", req.BundleType)
|
||||||
|
}
|
||||||
|
|
||||||
var total int64
|
var total int64
|
||||||
if err = baseQuery.Count(&total).Error; err != nil {
|
if err = baseQuery.Count(&total).Error; err != nil {
|
||||||
return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐总数失败: ")
|
return res, commonErr.ReturnError(err, msg.ErrorGetBundleList, "获取套餐总数失败: ")
|
||||||
@ -224,6 +237,8 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
|||||||
BundleProfileLang: bundleProfileLang,
|
BundleProfileLang: bundleProfileLang,
|
||||||
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
||||||
FontColor: bundleProfile.FontColor,
|
FontColor: bundleProfile.FontColor,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
|
PayLaterTime: int64(bundleProfile.PayLaterTime),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,7 +393,7 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
|||||||
res.Bundles = make([]*bundle.BundleProfile, 0)
|
res.Bundles = make([]*bundle.BundleProfile, 0)
|
||||||
bundles := make([]*model.BundleProfile, 0)
|
bundles := make([]*model.BundleProfile, 0)
|
||||||
|
|
||||||
query := app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("shelf_status = ?", 1).Preload("BundleProfileLang")
|
query := app.ModuleClients.BundleDB.Model(&model.BundleProfile{}).Where("shelf_status = ?", model.BundleShelfStatusUp).Preload("BundleProfileLang")
|
||||||
//query = query.Where("shelf_status = ?", 1) //上架的
|
//query = query.Where("shelf_status = ?", 1) //上架的
|
||||||
|
|
||||||
if req.Name != "" {
|
if req.Name != "" {
|
||||||
@ -393,6 +408,10 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
|||||||
query = query.Where("language like ?", req.Language)
|
query = query.Where("language like ?", req.Language)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.BundleType != 0 {
|
||||||
|
query = query.Where("bundle_type = ?", req.BundleType)
|
||||||
|
}
|
||||||
|
|
||||||
count := *query
|
count := *query
|
||||||
|
|
||||||
// 排序:sort 升序,相同 sort 按 created_at 倒序
|
// 排序:sort 升序,相同 sort 按 created_at 倒序
|
||||||
@ -451,6 +470,8 @@ func BundleListH5V2(req *bundle.BundleListRequest) (res *bundle.BundleListRespon
|
|||||||
BundleProfileLang: bundleProfileLang,
|
BundleProfileLang: bundleProfileLang,
|
||||||
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
ShelfStatus: int64(bundleProfile.ShelfStatus),
|
||||||
FontColor: bundleProfile.FontColor,
|
FontColor: bundleProfile.FontColor,
|
||||||
|
BundleType: int64(bundleProfile.BundleType),
|
||||||
|
PayLaterTime: int64(bundleProfile.PayLaterTime),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
123
internal/dao/orderGateDao.go
Normal file
123
internal/dao/orderGateDao.go
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
package dao
|
||||||
|
|
||||||
|
import (
|
||||||
|
"micro-bundle/internal/model"
|
||||||
|
"micro-bundle/pkg/app"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// ExistsOverduePayLaterBundle 是否存在「套餐 + 先用后付 + 到期未付」订单
|
||||||
|
// 命中即应拦截后续套餐下单(增值仍允许「无限续杯」)。
|
||||||
|
func ExistsOverduePayLaterBundle(customerID string) (bool, error) {
|
||||||
|
if customerID == "" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
var cnt int64
|
||||||
|
err := app.ModuleClients.BundleDB.
|
||||||
|
Model(&model.BundleOrderRecords{}).
|
||||||
|
Where("customer_id = ? AND order_mode = ? AND (status = ? OR pay_later_status = ?)",
|
||||||
|
customerID,
|
||||||
|
model.OrderModePayLater,
|
||||||
|
model.BundleStatusOverdue,
|
||||||
|
model.PayLaterStatusOverdue,
|
||||||
|
).Count(&cnt).Error
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return cnt > 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExistsPendingPayLaterBundle 是否存在「套餐 + 先用后付 + 待付款(未逾期)」订单。
|
||||||
|
// 命中即提示用户去支付,避免同时存在多个先用后付未支付套餐订单。
|
||||||
|
func ExistsPendingPayLaterBundle(customerID string) (bool, error) {
|
||||||
|
if customerID == "" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
var cnt int64
|
||||||
|
err := app.ModuleClients.BundleDB.
|
||||||
|
Model(&model.BundleOrderRecords{}).
|
||||||
|
Where("customer_id = ? AND order_mode = ? AND pay_later_status = ? AND status = ?",
|
||||||
|
customerID,
|
||||||
|
model.OrderModePayLater,
|
||||||
|
model.PayLaterStatusPending,
|
||||||
|
model.BundleStatusSignedUnpaid,
|
||||||
|
).Count(&cnt).Error
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return cnt > 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExistsActiveBundle 是否存在有效期内的套餐订单(已签未付 / 已签已付)
|
||||||
|
// 用于保证:套餐有效期内只存在一笔订单。
|
||||||
|
func ExistsActiveBundle(customerID string) (bool, error) {
|
||||||
|
if customerID == "" {
|
||||||
|
return false, nil
|
||||||
|
}
|
||||||
|
now := time.Now().Format("2006-01-02 15:04:05")
|
||||||
|
var cnt int64
|
||||||
|
err := app.ModuleClients.BundleDB.
|
||||||
|
Model(&model.BundleOrderRecords{}).
|
||||||
|
Where("customer_id = ? AND status IN (?,?) AND (expiration_time = '' OR expiration_time IS NULL OR expiration_time >= ?)",
|
||||||
|
customerID,
|
||||||
|
model.BundleStatusSignedUnpaid,
|
||||||
|
model.BundleStatusPaid,
|
||||||
|
now,
|
||||||
|
).Count(&cnt).Error
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
return cnt > 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarkBundleOverdue 套餐先用后付到期扫描:将到期且未付的订单置为 Overdue
|
||||||
|
func MarkBundleOverdue(now time.Time) (int64, error) {
|
||||||
|
t := now.Format("2006-01-02 15:04:05")
|
||||||
|
r := app.ModuleClients.BundleDB.
|
||||||
|
Model(&model.BundleOrderRecords{}).
|
||||||
|
Where("order_mode = ? AND pay_later_status = ? AND due_time <> '' AND due_time <= ?",
|
||||||
|
model.OrderModePayLater, model.PayLaterStatusPending, t).
|
||||||
|
Updates(map[string]interface{}{
|
||||||
|
"pay_later_status": model.PayLaterStatusOverdue,
|
||||||
|
"status": model.BundleStatusOverdue,
|
||||||
|
})
|
||||||
|
return r.RowsAffected, r.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarkValueAddExpiredByDue 增值服务到期扫描:到期未付 → pay_later_status=逾期未付。
|
||||||
|
// 注意:余量是否作废由余量模块依据 pay_later_status 判定,订单侧不写入余量字段(is_expired)。
|
||||||
|
func MarkValueAddExpiredByDue(now time.Time) (int64, error) {
|
||||||
|
t := now.Format("2006-01-02 15:04:05")
|
||||||
|
r := app.ModuleClients.BundleDB.
|
||||||
|
Model(&model.BundleOrderValueAdd{}).
|
||||||
|
Where("order_mode = ? AND pay_later_status = ? AND due_time <> '' AND due_time <= ?",
|
||||||
|
model.OrderModePayLater, model.PayLaterStatusPending, t).
|
||||||
|
Updates(map[string]interface{}{
|
||||||
|
"pay_later_status": model.PayLaterStatusOverdue,
|
||||||
|
})
|
||||||
|
return r.RowsAffected, r.Error
|
||||||
|
}
|
||||||
|
|
||||||
|
// IsValueAddRecordUsable 判断增值订单余量是否可用
|
||||||
|
// 规则:IsExpired=true 直接不可用;先用后付 + 到期未付 直接不可用。
|
||||||
|
func IsValueAddRecordUsable(rec *model.BundleOrderValueAdd) bool {
|
||||||
|
if rec == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if rec.IsExpired {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if rec.OrderMode == model.OrderModePayLater {
|
||||||
|
if rec.PayLaterStatus == model.PayLaterStatusOverdue {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if rec.PayLaterStatus == model.PayLaterStatusPending && rec.DueTime != "" {
|
||||||
|
if t, err := time.ParseInLocation("2006-01-02 15:04:05", rec.DueTime, time.Local); err == nil {
|
||||||
|
if time.Now().After(t) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
@ -115,6 +115,10 @@ func UpdateOrderRecordByOrderNO(orderRecord *model.BundleOrderRecords) (res *bun
|
|||||||
valueAdd.CheckoutSessionId = orderRecord.CheckoutSessionId
|
valueAdd.CheckoutSessionId = orderRecord.CheckoutSessionId
|
||||||
valueAdd.CheckoutSessionUrl = orderRecord.CheckoutSessionUrl
|
valueAdd.CheckoutSessionUrl = orderRecord.CheckoutSessionUrl
|
||||||
}
|
}
|
||||||
|
// 先用后付:主订单支付成功 → 子订单先用后付状态置为已付
|
||||||
|
if orderRecord.Status == 2 {
|
||||||
|
valueAdd.PayLaterStatus = model.PayLaterStatusPaid
|
||||||
|
}
|
||||||
|
|
||||||
if orderRecord.Status == 2 {
|
if orderRecord.Status == 2 {
|
||||||
tempValues := make([]*model.BundleOrderValueAdd, 0)
|
tempValues := make([]*model.BundleOrderValueAdd, 0)
|
||||||
@ -148,6 +152,10 @@ func UpdateOrderRecordByOrderNO(orderRecord *model.BundleOrderRecords) (res *bun
|
|||||||
result := feeRounded.Add(addition)
|
result := feeRounded.Add(addition)
|
||||||
valueAdd.HandlingFee = result.String()
|
valueAdd.HandlingFee = result.String()
|
||||||
}
|
}
|
||||||
|
// 主订单若是先用后付,同步 pay_later_status=已付(若处于逾期未付,也复位)
|
||||||
|
if tempRecord.OrderMode == model.OrderModePayLater {
|
||||||
|
orderRecord.PayLaterStatus = model.PayLaterStatusPaid
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +243,14 @@ func OrderRecordsList(req *bundle.OrderRecordsRequest) (res *bundle.OrderRecords
|
|||||||
query = query.Where("`micro-account`.`user`.`tel_num` like ?", "%"+req.TelNum+"%")
|
query = query.Where("`micro-account`.`user`.`tel_num` like ?", "%"+req.TelNum+"%")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if req.OrderMode != 0 {
|
||||||
|
query = query.Where("`bundle_order_records`.order_mode = ?", req.OrderMode)
|
||||||
|
}
|
||||||
|
|
||||||
|
if req.PayLaterStatus != 0 {
|
||||||
|
query = query.Where("`bundle_order_records`.pay_later_status = ?", req.PayLaterStatus)
|
||||||
|
}
|
||||||
|
|
||||||
count := *query
|
count := *query
|
||||||
|
|
||||||
if req.PageSize != 0 && req.Page != 0 {
|
if req.PageSize != 0 && req.Page != 0 {
|
||||||
@ -282,6 +298,10 @@ func OrderRecordsList(req *bundle.OrderRecordsRequest) (res *bundle.OrderRecords
|
|||||||
ExpirationTime: record.ExpirationTime,
|
ExpirationTime: record.ExpirationTime,
|
||||||
PurchaseType: record.PurchaseType,
|
PurchaseType: record.PurchaseType,
|
||||||
RenewalOrderUUID: record.RenewalOrderUUID,
|
RenewalOrderUUID: record.RenewalOrderUUID,
|
||||||
|
OrderMode: record.OrderMode,
|
||||||
|
DueTime: record.DueTime,
|
||||||
|
PayLaterStatus: record.PayLaterStatus,
|
||||||
|
ContractTplType: record.ContractTplType,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,6 +407,10 @@ func OrderRecordDetail(req *bundle.OrderRecordsDetailRequest) (res *bundle.Order
|
|||||||
ReSignature: int32(orderRecord.ReSignature),
|
ReSignature: int32(orderRecord.ReSignature),
|
||||||
PurchaseType: orderRecord.PurchaseType,
|
PurchaseType: orderRecord.PurchaseType,
|
||||||
RenewalOrderUUID: orderRecord.RenewalOrderUUID,
|
RenewalOrderUUID: orderRecord.RenewalOrderUUID,
|
||||||
|
OrderMode: orderRecord.OrderMode,
|
||||||
|
DueTime: orderRecord.DueTime,
|
||||||
|
PayLaterStatus: orderRecord.PayLaterStatus,
|
||||||
|
ContractTplType: orderRecord.ContractTplType,
|
||||||
}
|
}
|
||||||
res.AddInfos = make([]*bundle.AddInfo, 0)
|
res.AddInfos = make([]*bundle.AddInfo, 0)
|
||||||
res.AddInfos = addInfos
|
res.AddInfos = addInfos
|
||||||
@ -432,27 +456,44 @@ func CreateOrderAddRecord(req *bundle.OrderAddRecord) (res *bundle.CommonRespons
|
|||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
orderNo := utils.GetOrderNo()
|
orderNo := utils.GetOrderNo()
|
||||||
|
// 增值订单默认先用后付(规则 2:增值服务订单只有先用后付类型)
|
||||||
|
addOrderMode := req.OrderMode
|
||||||
|
if addOrderMode == 0 {
|
||||||
|
addOrderMode = model.OrderModePayLater
|
||||||
|
}
|
||||||
|
addPayLaterStatus := req.PayLaterStatus
|
||||||
|
if addOrderMode == model.OrderModePayLater && addPayLaterStatus == 0 {
|
||||||
|
addPayLaterStatus = model.PayLaterStatusPending
|
||||||
|
}
|
||||||
|
addContractTplType := req.ContractTplType
|
||||||
|
if addOrderMode == model.OrderModePayLater && addContractTplType == 0 {
|
||||||
|
addContractTplType = model.ContractTplValueAddPayLater
|
||||||
|
}
|
||||||
var childOrders []*model.BundleOrderValueAdd
|
var childOrders []*model.BundleOrderValueAdd
|
||||||
for _, i := range req.AddPriceOptionsList {
|
for _, i := range req.AddPriceOptionsList {
|
||||||
childOrder := &model.BundleOrderValueAdd{
|
childOrder := &model.BundleOrderValueAdd{
|
||||||
UUID: app.ModuleClients.SfNode.Generate().Base64(),
|
UUID: app.ModuleClients.SfNode.Generate().Base64(),
|
||||||
OrderUUID: req.OrderUUID, // 修正: 这里应使用主订单UUID
|
OrderUUID: req.OrderUUID, // 修正: 这里应使用主订单UUID
|
||||||
CustomerID: req.CustomerID,
|
CustomerID: req.CustomerID,
|
||||||
CustomerNum: req.CustomerNum,
|
CustomerNum: req.CustomerNum,
|
||||||
CustomerName: req.CustomerName,
|
CustomerName: req.CustomerName,
|
||||||
ServiceType: i.ServiceType,
|
ServiceType: i.ServiceType,
|
||||||
CurrencyType: i.CurrencyType,
|
CurrencyType: i.CurrencyType,
|
||||||
Amount: float64(i.Amount),
|
Amount: float64(i.Amount),
|
||||||
OrderNo: orderNo,
|
OrderNo: orderNo,
|
||||||
Num: i.Num,
|
Num: i.Num,
|
||||||
Unit: i.Unit,
|
Unit: i.Unit,
|
||||||
ValueAddUUID: i.ValueUid,
|
ValueAddUUID: i.ValueUid,
|
||||||
Source: 2,
|
Source: 2,
|
||||||
PaymentStatus: 1,
|
PaymentStatus: 1,
|
||||||
SignContract: req.SignContract,
|
SignContract: req.SignContract,
|
||||||
Signature: req.Signature,
|
Signature: req.Signature,
|
||||||
SignedTime: req.SignedTime,
|
SignedTime: req.SignedTime,
|
||||||
Snapshot: req.Snapshot,
|
Snapshot: req.Snapshot,
|
||||||
|
OrderMode: addOrderMode,
|
||||||
|
DueTime: req.DueTime,
|
||||||
|
PayLaterStatus: addPayLaterStatus,
|
||||||
|
ContractTplType: addContractTplType,
|
||||||
}
|
}
|
||||||
childOrders = append(childOrders, childOrder)
|
childOrders = append(childOrders, childOrder)
|
||||||
|
|
||||||
@ -522,6 +563,12 @@ func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRec
|
|||||||
if req.BundlePayStart != "" && req.BundlePayEnd != "" {
|
if req.BundlePayStart != "" && req.BundlePayEnd != "" {
|
||||||
modelObj = modelObj.Where("bundle_order_records.pay_time between ? and ?", req.BundlePayStart, req.BundlePayEnd)
|
modelObj = modelObj.Where("bundle_order_records.pay_time between ? and ?", req.BundlePayStart, req.BundlePayEnd)
|
||||||
}
|
}
|
||||||
|
if req.OrderMode != 0 {
|
||||||
|
modelObj = modelObj.Where("bundle_order_records.order_mode = ?", req.OrderMode)
|
||||||
|
}
|
||||||
|
if req.PayLaterStatus != 0 {
|
||||||
|
modelObj = modelObj.Where("bundle_order_records.pay_later_status = ?", req.PayLaterStatus)
|
||||||
|
}
|
||||||
err = modelObj.Count(&count).Error
|
err = modelObj.Count(&count).Error
|
||||||
if req.PageSize != 0 && req.Page != 0 {
|
if req.PageSize != 0 && req.Page != 0 {
|
||||||
modelObj = modelObj.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
|
modelObj = modelObj.Limit(int(req.PageSize)).Offset(int(req.Page-1) * int(req.PageSize))
|
||||||
@ -551,6 +598,10 @@ func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRec
|
|||||||
InviterId: record.InviterID,
|
InviterId: record.InviterID,
|
||||||
PurchaseType: record.PurchaseType,
|
PurchaseType: record.PurchaseType,
|
||||||
RenewalOrderUUID: record.RenewalOrderUUID,
|
RenewalOrderUUID: record.RenewalOrderUUID,
|
||||||
|
OrderMode: record.OrderMode,
|
||||||
|
DueTime: record.DueTime,
|
||||||
|
PayLaterStatus: record.PayLaterStatus,
|
||||||
|
ContractTplType: record.ContractTplType,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 聚合子订单
|
// 聚合子订单
|
||||||
@ -582,6 +633,10 @@ func OrderRecordsListV2(req *bundle.OrderRecordsRequestV2) (res *bundle.OrderRec
|
|||||||
CheckoutSessionId: sub.CheckoutSessionId,
|
CheckoutSessionId: sub.CheckoutSessionId,
|
||||||
CustomerID: sub.CustomerID,
|
CustomerID: sub.CustomerID,
|
||||||
VideoNum: videoNum,
|
VideoNum: videoNum,
|
||||||
|
OrderMode: sub.OrderMode,
|
||||||
|
DueTime: sub.DueTime,
|
||||||
|
PayLaterStatus: sub.PayLaterStatus,
|
||||||
|
ContractTplType: sub.ContractTplType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1031,6 +1086,10 @@ func UpdateOrderRecordByOrderUuid(orderRecord *model.BundleOrderRecords) (res *b
|
|||||||
valueAdd.CheckoutSessionId = orderRecord.CheckoutSessionId
|
valueAdd.CheckoutSessionId = orderRecord.CheckoutSessionId
|
||||||
valueAdd.CheckoutSessionUrl = orderRecord.CheckoutSessionUrl
|
valueAdd.CheckoutSessionUrl = orderRecord.CheckoutSessionUrl
|
||||||
}
|
}
|
||||||
|
// 先用后付:主订单支付成功 → 子订单先用后付状态置为已付
|
||||||
|
if orderRecord.Status == 2 {
|
||||||
|
valueAdd.PayLaterStatus = model.PayLaterStatusPaid
|
||||||
|
}
|
||||||
|
|
||||||
if orderRecord.Status == 2 {
|
if orderRecord.Status == 2 {
|
||||||
tempValues := make([]*model.BundleOrderValueAdd, 0)
|
tempValues := make([]*model.BundleOrderValueAdd, 0)
|
||||||
@ -1064,6 +1123,10 @@ func UpdateOrderRecordByOrderUuid(orderRecord *model.BundleOrderRecords) (res *b
|
|||||||
result := feeRounded.Add(addition)
|
result := feeRounded.Add(addition)
|
||||||
valueAdd.HandlingFee = result.String()
|
valueAdd.HandlingFee = result.String()
|
||||||
}
|
}
|
||||||
|
// 主订单若是先用后付,同步 pay_later_status=已付(若处于逾期未付,也复位)
|
||||||
|
if tempRecord.OrderMode == model.OrderModePayLater {
|
||||||
|
orderRecord.PayLaterStatus = model.PayLaterStatusPaid
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,17 +68,19 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
|||||||
}
|
}
|
||||||
//套餐主表数据
|
//套餐主表数据
|
||||||
bundleProfile := &model.BundleProfile{
|
bundleProfile := &model.BundleProfile{
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
Sort: req.Sort,
|
Sort: req.Sort,
|
||||||
Content: req.Content,
|
Content: req.Content,
|
||||||
Price: req.Price,
|
Price: req.Price,
|
||||||
PriceType: req.PriceType,
|
PriceType: req.PriceType,
|
||||||
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/contract/saas/template-25122501.pdf",
|
Contract: "https://e-cdn.fontree.cn/fonchain-main/prod/file/contract/saas/template-25122501.pdf",
|
||||||
ImgOption: int8(req.ImgOption),
|
ImgOption: int8(req.ImgOption),
|
||||||
BgImg1: req.BgImg1,
|
BgImg1: req.BgImg1,
|
||||||
BgImg2: req.BgImg2,
|
BgImg2: req.BgImg2,
|
||||||
ShelfStatus: 2, //默认初始状态为2-下架
|
ShelfStatus: model.BundleShelfStatusDown, //默认初始状态为2-下架
|
||||||
FontColor: req.FontColor,
|
FontColor: req.FontColor,
|
||||||
|
BundleType: req.BundleType,
|
||||||
|
PayLaterTime: req.PayLaterTime,
|
||||||
}
|
}
|
||||||
bundleLang := &model.BundleProfileLang{
|
bundleLang := &model.BundleProfileLang{
|
||||||
Name: req.Name,
|
Name: req.Name,
|
||||||
@ -202,6 +204,8 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
|||||||
serviceName = "账号数"
|
serviceName = "账号数"
|
||||||
case msg.AvailableTimeService:
|
case msg.AvailableTimeService:
|
||||||
serviceName = "可用时长"
|
serviceName = "可用时长"
|
||||||
|
case msg.CompetitiveService:
|
||||||
|
serviceName = "竞品数"
|
||||||
}
|
}
|
||||||
return res, fmt.Errorf("服务类型%s的额度不兼容:套餐权益额度为%d,附加权益额度为%d",
|
return res, fmt.Errorf("服务类型%s的额度不兼容:套餐权益额度为%d,附加权益额度为%d",
|
||||||
serviceName, benefitsQuota.QuotaValue, optionalQuota.QuotaValue)
|
serviceName, benefitsQuota.QuotaValue, optionalQuota.QuotaValue)
|
||||||
@ -288,15 +292,17 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
|||||||
}
|
}
|
||||||
if req.Language == msg.ZH_CN {
|
if req.Language == msg.ZH_CN {
|
||||||
updateBundle := map[string]interface{}{
|
updateBundle := map[string]interface{}{
|
||||||
"name": req.Name,
|
"name": req.Name,
|
||||||
"sort": req.Sort,
|
"sort": req.Sort,
|
||||||
"content": req.Content,
|
"content": req.Content,
|
||||||
"price": req.Price,
|
"price": req.Price,
|
||||||
"price_type": req.PriceType,
|
"price_type": req.PriceType,
|
||||||
"img_option": req.ImgOption,
|
"img_option": req.ImgOption,
|
||||||
"bg_img1": req.BgImg1,
|
"bg_img1": req.BgImg1,
|
||||||
"bg_img2": req.BgImg2,
|
"bg_img2": req.BgImg2,
|
||||||
"font_color": req.FontColor,
|
"font_color": req.FontColor,
|
||||||
|
"bundle_type": req.BundleType,
|
||||||
|
"pay_later_time": req.PayLaterTime,
|
||||||
}
|
}
|
||||||
if err = dao.TxUpdateBundle(tx, req.Uuid, updateBundle); err != nil {
|
if err = dao.TxUpdateBundle(tx, req.Uuid, updateBundle); err != nil {
|
||||||
return res, errors.New("更新套餐信息失败")
|
return res, errors.New("更新套餐信息失败")
|
||||||
@ -333,6 +339,7 @@ func BundleListV2(req *bundle.BundleListRequest) (res *bundle.BundleListResponse
|
|||||||
func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponseV2, err error) {
|
func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailResponseV2, err error) {
|
||||||
res = new(bundle.BundleDetailResponseV2)
|
res = new(bundle.BundleDetailResponseV2)
|
||||||
bundleProfile := &bundle.BundleProfile{}
|
bundleProfile := &bundle.BundleProfile{}
|
||||||
|
var bundleProfileLang *bundle.BundleProfileLang
|
||||||
|
|
||||||
if req.Uuid == "" {
|
if req.Uuid == "" {
|
||||||
return res, errors.New("缺少套餐UUID")
|
return res, errors.New("缺少套餐UUID")
|
||||||
@ -341,22 +348,55 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return res, errors.New("获取套餐信息失败")
|
return res, errors.New("获取套餐信息失败")
|
||||||
}
|
}
|
||||||
|
if req.Language != "" {
|
||||||
|
for _, lang := range detail.BundleProfileLang {
|
||||||
|
if lang.Language == req.Language {
|
||||||
|
bundleProfileLang = &bundle.BundleProfileLang{
|
||||||
|
Uuid: lang.UUID,
|
||||||
|
Name: lang.Name,
|
||||||
|
Price: lang.Price,
|
||||||
|
PriceType: lang.PriceType,
|
||||||
|
Content: lang.Content,
|
||||||
|
PayLaterTime: lang.PayLaterTime,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//默认返回中文数据
|
||||||
|
for _, lang := range detail.BundleProfileLang {
|
||||||
|
if lang.Language == msg.ZH_CN {
|
||||||
|
bundleProfileLang = &bundle.BundleProfileLang{
|
||||||
|
Uuid: lang.UUID,
|
||||||
|
Name: lang.Name,
|
||||||
|
Price: lang.Price,
|
||||||
|
PriceType: lang.PriceType,
|
||||||
|
Content: lang.Content,
|
||||||
|
PayLaterTime: lang.PayLaterTime,
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if detail != nil {
|
if detail != nil {
|
||||||
bundleProfile = &bundle.BundleProfile{
|
bundleProfile = &bundle.BundleProfile{
|
||||||
Uuid: detail.UUID,
|
Uuid: detail.UUID,
|
||||||
Name: detail.Name,
|
Name: bundleProfileLang.Name,
|
||||||
Content: detail.Content,
|
Content: bundleProfileLang.Content,
|
||||||
Price: detail.Price,
|
Price: bundleProfileLang.Price,
|
||||||
PriceType: detail.PriceType,
|
PriceType: bundleProfileLang.PriceType,
|
||||||
ImgOption: int32(detail.ImgOption),
|
ImgOption: int32(detail.ImgOption),
|
||||||
BgImg1: detail.BgImg1,
|
BgImg1: detail.BgImg1,
|
||||||
BgImg2: detail.BgImg2,
|
BgImg2: detail.BgImg2,
|
||||||
FontColor: detail.FontColor,
|
Language: req.Language,
|
||||||
Sort: detail.Sort,
|
FontColor: detail.FontColor,
|
||||||
ShelfStatus: detail.ShelfStatus,
|
Sort: detail.Sort,
|
||||||
CreatedAt: detail.CreatedAt.Format("2006-01-02 15:04:05"),
|
ShelfStatus: detail.ShelfStatus,
|
||||||
UpdatedAt: detail.UpdatedAt.Format("2006-01-02 15:04:05"),
|
CreatedAt: detail.CreatedAt.Format("2006-01-02 15:04:05"),
|
||||||
Contract: detail.Contract,
|
UpdatedAt: detail.UpdatedAt.Format("2006-01-02 15:04:05"),
|
||||||
|
Contract: detail.Contract,
|
||||||
|
BundleType: int64(detail.BundleType),
|
||||||
|
PayLaterTime: int64(bundleProfileLang.PayLaterTime),
|
||||||
}
|
}
|
||||||
if len(detail.BundleToValueAddService) > 0 {
|
if len(detail.BundleToValueAddService) > 0 {
|
||||||
var valueUuids []string
|
var valueUuids []string
|
||||||
@ -421,20 +461,22 @@ func BundleDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleDetailRe
|
|||||||
bundleProfileLangs := make([]*bundle.BundleProfileLang, 0, len(detail.BundleProfileLang))
|
bundleProfileLangs := make([]*bundle.BundleProfileLang, 0, len(detail.BundleProfileLang))
|
||||||
for _, lang := range detail.BundleProfileLang {
|
for _, lang := range detail.BundleProfileLang {
|
||||||
bundleProfileLangs = append(bundleProfileLangs, &bundle.BundleProfileLang{
|
bundleProfileLangs = append(bundleProfileLangs, &bundle.BundleProfileLang{
|
||||||
Uuid: lang.UUID,
|
Uuid: lang.UUID,
|
||||||
Name: lang.Name,
|
Name: lang.Name,
|
||||||
Price: lang.Price,
|
Price: lang.Price,
|
||||||
PriceType: lang.PriceType,
|
PriceType: lang.PriceType,
|
||||||
Content: lang.Content,
|
Content: lang.Content,
|
||||||
Language: lang.Language,
|
Language: lang.Language,
|
||||||
ImgOption: int32(detail.ImgOption),
|
PayLaterTime: int64(lang.PayLaterTime),
|
||||||
BgImg1: detail.BgImg1,
|
ImgOption: int32(detail.ImgOption),
|
||||||
BgImg2: detail.BgImg2,
|
BgImg1: detail.BgImg1,
|
||||||
FontColor: detail.FontColor,
|
BgImg2: detail.BgImg2,
|
||||||
Sort: detail.Sort,
|
FontColor: detail.FontColor,
|
||||||
ShelfStatus: detail.ShelfStatus,
|
Sort: detail.Sort,
|
||||||
CreatedAt: time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
ShelfStatus: detail.ShelfStatus,
|
||||||
UpdatedAt: time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
|
BundleType: int64(detail.BundleType),
|
||||||
|
CreatedAt: time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||||
|
UpdatedAt: time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05"),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
bundleProfile.BundleProfileLang = bundleProfileLangs
|
bundleProfile.BundleProfileLang = bundleProfileLangs
|
||||||
@ -469,6 +511,8 @@ func BundleLangDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleProf
|
|||||||
res.Sort = detail.Sort
|
res.Sort = detail.Sort
|
||||||
res.ShelfStatus = detail.ShelfStatus
|
res.ShelfStatus = detail.ShelfStatus
|
||||||
res.Contract = detail.Contract
|
res.Contract = detail.Contract
|
||||||
|
res.BundleType = int64(detail.BundleType)
|
||||||
|
res.PayLaterTime = int64(detail.PayLaterTime)
|
||||||
if len(detail.BundleToValueAddService) > 0 {
|
if len(detail.BundleToValueAddService) > 0 {
|
||||||
var serviceLangInfos []*bundle.ServiceLangInfo
|
var serviceLangInfos []*bundle.ServiceLangInfo
|
||||||
for _, service := range detail.BundleToValueAddService {
|
for _, service := range detail.BundleToValueAddService {
|
||||||
@ -486,6 +530,7 @@ func BundleLangDetailV2(req *bundle.BundleDetailRequest) (res *bundle.BundleProf
|
|||||||
res.PriceType = lang.PriceType
|
res.PriceType = lang.PriceType
|
||||||
res.Content = lang.Content
|
res.Content = lang.Content
|
||||||
res.Language = lang.Language
|
res.Language = lang.Language
|
||||||
|
res.PayLaterTime = int64(lang.PayLaterTime)
|
||||||
res.CreatedAt = time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05")
|
res.CreatedAt = time.Unix(lang.CreatedAt, 0).Format("2006-01-02 15:04:05")
|
||||||
res.UpdatedAt = time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05")
|
res.UpdatedAt = time.Unix(int64(lang.UpdatedAt), 0).Format("2006-01-02 15:04:05")
|
||||||
}
|
}
|
||||||
|
|||||||
89
internal/logic/orderGateLogic.go
Normal file
89
internal/logic/orderGateLogic.go
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
package logic
|
||||||
|
|
||||||
|
import (
|
||||||
|
"micro-bundle/internal/dao"
|
||||||
|
"micro-bundle/internal/model"
|
||||||
|
"micro-bundle/pb/bundle"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
// CheckOrderEligibility 下单前置校验(先用后付)。
|
||||||
|
// 规则:
|
||||||
|
// 4. 套餐订单 + 先用后付 + 到期未付:禁止所有套餐下单
|
||||||
|
// 5. 套餐到期未付不影响增值下单(无限续杯)
|
||||||
|
// 3. 套餐有效期内只允许存在一笔
|
||||||
|
func CheckOrderEligibility(req *bundle.CheckOrderEligibilityRequest) (*bundle.CheckOrderEligibilityResponse, error) {
|
||||||
|
res := &bundle.CheckOrderEligibilityResponse{Allow: true}
|
||||||
|
if req == nil || req.CustomerID == "" {
|
||||||
|
res.Allow = false
|
||||||
|
res.Reason = "INVALID_PARAM"
|
||||||
|
res.Msg = "customerID 必填"
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 套餐下单校验(增值订单不受这些限制:无限续杯)
|
||||||
|
if req.OrderKind == model.OrderKindBundle {
|
||||||
|
// 1. 先用后付套餐逾期未付 → 不可再下单任何套餐(普通/先用后付)。
|
||||||
|
overdue, err := dao.ExistsOverduePayLaterBundle(req.CustomerID)
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
if overdue {
|
||||||
|
res.Allow = false
|
||||||
|
res.Reason = model.OrderGateReasonPayLaterBundleOverdue
|
||||||
|
res.Msg = "您有过期的先用后付订单,无法再次体验"
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 已存在先用后付且未支付(待付款)的套餐订单 → 提示去支付。
|
||||||
|
pending, err := dao.ExistsPendingPayLaterBundle(req.CustomerID)
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
if pending {
|
||||||
|
res.Allow = false
|
||||||
|
res.Reason = model.OrderGateReasonPayLaterBundlePending
|
||||||
|
res.Msg = "当前已存在未支付订单,请去我的页面支付"
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 有效期内已存在套餐订单 → 保证套餐有效期内只存在一笔。
|
||||||
|
exists, err := dao.ExistsActiveBundle(req.CustomerID)
|
||||||
|
if err != nil {
|
||||||
|
return res, err
|
||||||
|
}
|
||||||
|
if exists {
|
||||||
|
res.Allow = false
|
||||||
|
res.Reason = model.OrderGateReasonBundleActiveExists
|
||||||
|
res.Msg = "有效期内已存在套餐订单"
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// MarkOverdueOrders 扫描到期订单(套餐 → 冻结;增值 → 余量作废)
|
||||||
|
func MarkOverdueOrders(req *bundle.MarkOverdueOrdersRequest) (*bundle.MarkOverdueOrdersResponse, error) {
|
||||||
|
res := &bundle.MarkOverdueOrdersResponse{}
|
||||||
|
now := time.Now()
|
||||||
|
if req != nil && req.Now != "" {
|
||||||
|
if t, err := time.ParseInLocation("2006-01-02 15:04:05", req.Now, time.Local); err == nil {
|
||||||
|
now = t
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if n, err := dao.MarkBundleOverdue(now); err != nil {
|
||||||
|
res.Msg = err.Error()
|
||||||
|
return res, err
|
||||||
|
} else {
|
||||||
|
res.BundleOverdueCount = int32(n)
|
||||||
|
}
|
||||||
|
if n, err := dao.MarkValueAddExpiredByDue(now); err != nil {
|
||||||
|
res.Msg = err.Error()
|
||||||
|
return res, err
|
||||||
|
} else {
|
||||||
|
res.ValueAddExpiredCount = int32(n)
|
||||||
|
}
|
||||||
|
res.Msg = "ok"
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
@ -16,6 +16,17 @@ import (
|
|||||||
|
|
||||||
func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonResponse, err error) {
|
func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonResponse, err error) {
|
||||||
res = new(bundle.CommonResponse)
|
res = new(bundle.CommonResponse)
|
||||||
|
// 先用后付下单前置校验
|
||||||
|
if eligibility, e := CheckOrderEligibility(&bundle.CheckOrderEligibilityRequest{
|
||||||
|
CustomerID: req.CustomerID,
|
||||||
|
OrderKind: model.OrderKindBundle,
|
||||||
|
OrderMode: req.OrderMode,
|
||||||
|
}); e != nil {
|
||||||
|
return nil, e
|
||||||
|
} else if !eligibility.Allow {
|
||||||
|
res.Msg = eligibility.Msg
|
||||||
|
return res, errors.New(eligibility.Reason)
|
||||||
|
}
|
||||||
//orderUUID := app.ModuleClients.SfNode.Generate().Base64()
|
//orderUUID := app.ModuleClients.SfNode.Generate().Base64()
|
||||||
uuidV4, err := uuid.NewV4()
|
uuidV4, err := uuid.NewV4()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -29,32 +40,52 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
|
|||||||
}
|
}
|
||||||
var addRecords []model.BundleOrderValueAdd
|
var addRecords []model.BundleOrderValueAdd
|
||||||
for _, i := range req.AddRecords {
|
for _, i := range req.AddRecords {
|
||||||
|
addOrderMode := i.OrderMode
|
||||||
|
if addOrderMode == 0 {
|
||||||
|
addOrderMode = model.OrderModePayLater // 增值订单默认先用后付
|
||||||
|
}
|
||||||
|
addPayLaterStatus := i.PayLaterStatus
|
||||||
|
if addOrderMode == model.OrderModePayLater && addPayLaterStatus == 0 && i.PaymentStatus != 2 {
|
||||||
|
addPayLaterStatus = model.PayLaterStatusPending
|
||||||
|
}
|
||||||
addRecords = append(addRecords, model.BundleOrderValueAdd{
|
addRecords = append(addRecords, model.BundleOrderValueAdd{
|
||||||
UUID: app.ModuleClients.SfNode.Generate().Base64(),
|
UUID: app.ModuleClients.SfNode.Generate().Base64(),
|
||||||
OrderNo: orderNo,
|
OrderNo: orderNo,
|
||||||
OrderUUID: orderUUID,
|
OrderUUID: orderUUID,
|
||||||
CustomerID: req.CustomerID,
|
CustomerID: req.CustomerID,
|
||||||
CustomerNum: req.CustomerNum,
|
CustomerNum: req.CustomerNum,
|
||||||
CustomerName: req.CustomerName,
|
CustomerName: req.CustomerName,
|
||||||
ServiceType: i.ServiceType,
|
ServiceType: i.ServiceType,
|
||||||
CurrencyType: i.CurrencyType,
|
CurrencyType: i.CurrencyType,
|
||||||
Amount: float64(i.Amount),
|
Amount: float64(i.Amount),
|
||||||
Num: i.Num,
|
Num: i.Num,
|
||||||
Unit: i.Unit,
|
Unit: i.Unit,
|
||||||
ValueAddUUID: i.ValueUid,
|
ValueAddUUID: i.ValueUid,
|
||||||
Source: int(i.Source),
|
Source: int(i.Source),
|
||||||
PaymentStatus: int(i.PaymentStatus),
|
PaymentStatus: int(i.PaymentStatus),
|
||||||
SignContract: req.SignContract,
|
SignContract: req.SignContract,
|
||||||
Signature: req.Signature,
|
Signature: req.Signature,
|
||||||
SignedTime: req.SignedTime,
|
SignedTime: req.SignedTime,
|
||||||
Snapshot: req.Snapshot,
|
Snapshot: req.Snapshot,
|
||||||
HandlingFee: i.HandlingFee,
|
HandlingFee: i.HandlingFee,
|
||||||
EquityType: i.EquityType,
|
EquityType: i.EquityType,
|
||||||
QuotaType: i.QuotaType,
|
QuotaType: i.QuotaType,
|
||||||
QuotaValue: i.QuotaValue,
|
QuotaValue: i.QuotaValue,
|
||||||
IsExpired: i.IsExpired,
|
IsExpired: i.IsExpired,
|
||||||
|
OrderMode: addOrderMode,
|
||||||
|
DueTime: i.DueTime,
|
||||||
|
PayLaterStatus: addPayLaterStatus,
|
||||||
|
ContractTplType: i.ContractTplType,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
orderMode := req.OrderMode
|
||||||
|
if orderMode == 0 {
|
||||||
|
orderMode = model.OrderModeNormal
|
||||||
|
}
|
||||||
|
payLaterStatus := req.PayLaterStatus
|
||||||
|
if orderMode == model.OrderModePayLater && payLaterStatus == 0 && req.Status != model.BundleStatusPaid {
|
||||||
|
payLaterStatus = model.PayLaterStatusPending
|
||||||
|
}
|
||||||
orderRecord := &model.BundleOrderRecords{
|
orderRecord := &model.BundleOrderRecords{
|
||||||
UUID: orderUUID,
|
UUID: orderUUID,
|
||||||
OrderNo: orderNo,
|
OrderNo: orderNo,
|
||||||
@ -82,6 +113,10 @@ func CreateOrderRecord(req *bundle.OrderCreateRecord) (res *bundle.CommonRespons
|
|||||||
InviterID: req.InviterId,
|
InviterID: req.InviterId,
|
||||||
PurchaseType: req.PurchaseType,
|
PurchaseType: req.PurchaseType,
|
||||||
RenewalOrderUUID: req.RenewalOrderUUID,
|
RenewalOrderUUID: req.RenewalOrderUUID,
|
||||||
|
OrderMode: orderMode,
|
||||||
|
DueTime: req.DueTime,
|
||||||
|
PayLaterStatus: payLaterStatus,
|
||||||
|
ContractTplType: req.ContractTplType,
|
||||||
}
|
}
|
||||||
res, err = dao.CreateOrderRecord(orderRecord)
|
res, err = dao.CreateOrderRecord(orderRecord)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -8,6 +8,16 @@ import (
|
|||||||
"gorm.io/plugin/soft_delete"
|
"gorm.io/plugin/soft_delete"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BundleTypeBasic = 1 // 基础套餐
|
||||||
|
BundleTypePostpaid = 2 // 先用后付套餐
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
BundleShelfStatusUp = 1 // 上架
|
||||||
|
BundleShelfStatusDown = 2 // 下架
|
||||||
|
)
|
||||||
|
|
||||||
type BundleProfile struct {
|
type BundleProfile struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`
|
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`
|
||||||
@ -27,20 +37,23 @@ type BundleProfile struct {
|
|||||||
FontColor string `json:"fontColor" gorm:"column:font_color;type:varchar(32);comment:字体颜色"`
|
FontColor string `json:"fontColor" gorm:"column:font_color;type:varchar(32);comment:字体颜色"`
|
||||||
BgImg1 string `json:"bgImg1" gorm:"column:bg_img1;type:varchar(1024);comment:背景图-首页"`
|
BgImg1 string `json:"bgImg1" gorm:"column:bg_img1;type:varchar(1024);comment:背景图-首页"`
|
||||||
BgImg2 string `json:"bgImg2" gorm:"column:bg_img2;type:varchar(1024);comment:背景图-我的"`
|
BgImg2 string `json:"bgImg2" gorm:"column:bg_img2;type:varchar(1024);comment:背景图-我的"`
|
||||||
|
BundleType int64 `json:"bundleType" gorm:"column:bundle_type;type:int;default:1;comment:套餐类型 1:基础套餐 2:先用后付套餐"`
|
||||||
|
PayLaterTime int64 `json:"payLaterTime" gorm:"column:pay_later_time;type:int;default:1;comment:先用后付套餐的后付时间,单位为天"`
|
||||||
BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:BundleUuid;references:UUID" json:"bundleToValueAddService"`
|
BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:BundleUuid;references:UUID" json:"bundleToValueAddService"`
|
||||||
BundleProfileLang []BundleProfileLang `gorm:"foreignKey:UUID;references:UUID" json:"bundleProfileLang"`
|
BundleProfileLang []BundleProfileLang `gorm:"foreignKey:UUID;references:UUID" json:"bundleProfileLang"`
|
||||||
}
|
}
|
||||||
type BundleProfileLang struct {
|
type BundleProfileLang struct {
|
||||||
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
||||||
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`
|
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:套餐UUID"`
|
||||||
Name string `json:"name" gorm:"column:name;type:varchar(2048);comment:套餐名称"`
|
Name string `json:"name" gorm:"column:name;type:varchar(2048);comment:套餐名称"`
|
||||||
Price float32 `json:"price" gorm:"column:price;type:decimal(12,2);comment:套餐价格"`
|
Price float32 `json:"price" gorm:"column:price;type:decimal(12,2);comment:套餐价格"`
|
||||||
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:套餐类型 1:人民币 2:美元"`
|
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:套餐类型 1:人民币 2:美元"`
|
||||||
Content string `json:"content" gorm:"column:content;type:text;comment:套餐内容"`
|
Content string `json:"content" gorm:"column:content;type:text;comment:套餐内容"`
|
||||||
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
|
PayLaterTime int64 `json:"payLaterTime" gorm:"column:pay_later_time;type:int;default:1;comment:先用后付套餐的后付时间,单位为天"`
|
||||||
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
|
||||||
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
|
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
||||||
DeletedAt soft_delete.DeletedAt
|
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
|
||||||
|
DeletedAt soft_delete.DeletedAt
|
||||||
}
|
}
|
||||||
type BundleToValueAddService struct {
|
type BundleToValueAddService struct {
|
||||||
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
||||||
@ -175,11 +188,12 @@ type UserBundleBalancePo struct {
|
|||||||
|
|
||||||
type BundleBalance struct {
|
type BundleBalance struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
UserId int `gorm:"column:user_id;not null"`
|
UserId int `gorm:"column:user_id;not null"`
|
||||||
Month string `gorm:"column:month;type:varchar(32);not null;index:idx_month"`
|
Month string `gorm:"column:month;type:varchar(32);not null;index:idx_month"`
|
||||||
OrderUUID string `gorm:"column:order_uuid;type:varchar(1024);not null;index:idx_order_uuid"`
|
OrderUUID string `gorm:"column:order_uuid;type:varchar(1024);not null;index:idx_order_uuid"`
|
||||||
ExpiredAt time.Time `gorm:"column:expired_at;type:datetime;comment:套餐过期时间;index:idx_expired_at"`
|
ExpiredAt time.Time `gorm:"column:expired_at;type:datetime;comment:套餐过期时间;index:idx_expired_at"`
|
||||||
StartAt time.Time `gorm:"column:start_at;type:datetime;comment:套餐开始时间;index:idx_start_at"`
|
StartAt time.Time `gorm:"column:start_at;type:datetime;comment:套餐开始时间;index:idx_start_at"`
|
||||||
|
BundleType int `gorm:"column:bundle_type;type:int;default:1;comment:套餐类型 1:基础套餐 2:先用后付套餐"`
|
||||||
|
|
||||||
// 套餐与增值账号
|
// 套餐与增值账号
|
||||||
BundleAccountNumber int `gorm:"column:bundle_account_number;not null;comment:套餐账号总数"`
|
BundleAccountNumber int `gorm:"column:bundle_account_number;not null;comment:套餐账号总数"`
|
||||||
@ -347,6 +361,7 @@ func (*BundleActivate) TableName() string {
|
|||||||
|
|
||||||
type BundleBalanceUsePo struct {
|
type BundleBalanceUsePo struct {
|
||||||
UserId int
|
UserId int
|
||||||
|
OrderUUID string
|
||||||
AccountNumber int
|
AccountNumber int
|
||||||
VideoNumber int
|
VideoNumber int
|
||||||
ImageNumber int
|
ImageNumber int
|
||||||
|
|||||||
@ -48,6 +48,10 @@ type BundleOrderRecords struct {
|
|||||||
InviterID uint64 `gorm:"column:inviter_id;type:bigint;comment:邀请人ID" json:"inviterID"`
|
InviterID uint64 `gorm:"column:inviter_id;type:bigint;comment:邀请人ID" json:"inviterID"`
|
||||||
PurchaseType uint64 `gorm:"column:purchase_type;type:bigint;comment:购买类型 1:新购 2:续费" json:"purchaseType"`
|
PurchaseType uint64 `gorm:"column:purchase_type;type:bigint;comment:购买类型 1:新购 2:续费" json:"purchaseType"`
|
||||||
RenewalOrderUUID string `gorm:"column:renewal_order_uuid;type:varchar(1024);comment:续费订单UUID" json:"renewalOrderUUID"`
|
RenewalOrderUUID string `gorm:"column:renewal_order_uuid;type:varchar(1024);comment:续费订单UUID" json:"renewalOrderUUID"`
|
||||||
|
OrderMode int32 `gorm:"column:order_mode;type:int;default:1;comment:订单模式 1:普通 2:先用后付;index:idx_customer_order_mode,priority:2" json:"orderMode"`
|
||||||
|
DueTime string `gorm:"column:due_time;type:varchar(64);comment:先用后付到期应付时间" json:"dueTime"`
|
||||||
|
PayLaterStatus int32 `gorm:"column:pay_later_status;type:int;default:0;comment:先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付;index:idx_paylater_status" json:"payLaterStatus"`
|
||||||
|
ContractTplType int32 `gorm:"column:contract_tpl_type;type:int;default:0;comment:合同模板类型 1:套餐普通 2:套餐先用后付 3:增值先用后付" json:"contractTplType"`
|
||||||
}
|
}
|
||||||
type BundleOrderValueAdd struct {
|
type BundleOrderValueAdd struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
@ -78,6 +82,10 @@ type BundleOrderValueAdd struct {
|
|||||||
QuotaType int32 `json:"quotaType" gorm:"column:quota_type;type:int;default:1;comment:额度类型 1:不限额度 2:每月限额度"`
|
QuotaType int32 `json:"quotaType" gorm:"column:quota_type;type:int;default:1;comment:额度类型 1:不限额度 2:每月限额度"`
|
||||||
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
QuotaValue int32 `json:"quotaValue" gorm:"column:quota_value;type:int;comment:额度值"`
|
||||||
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
||||||
|
OrderMode int32 `json:"orderMode" gorm:"column:order_mode;type:int;default:2;comment:订单模式 1:普通 2:先用后付(增值默认2);index:idx_valueadd_order_mode"`
|
||||||
|
DueTime string `json:"dueTime" gorm:"column:due_time;type:varchar(64);comment:先用后付到期应付时间"`
|
||||||
|
PayLaterStatus int32 `json:"payLaterStatus" gorm:"column:pay_later_status;type:int;default:0;comment:先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付;index:idx_valueadd_paylater_status"`
|
||||||
|
ContractTplType int32 `json:"contractTplType" gorm:"column:contract_tpl_type;type:int;default:0;comment:合同模板类型 3:增值先用后付"`
|
||||||
}
|
}
|
||||||
type PlatformIDs []uint32
|
type PlatformIDs []uint32
|
||||||
|
|
||||||
@ -109,3 +117,45 @@ const (
|
|||||||
ConfirmationNotConfirmed = 1
|
ConfirmationNotConfirmed = 1
|
||||||
ConfirmationConfirmed = 2
|
ConfirmationConfirmed = 2
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// 订单模式
|
||||||
|
const (
|
||||||
|
OrderModeNormal int32 = 1 // 普通订单
|
||||||
|
OrderModePayLater int32 = 2 // 先用后付订单
|
||||||
|
)
|
||||||
|
|
||||||
|
// 套餐订单 Status
|
||||||
|
const (
|
||||||
|
BundleStatusSignedUnpaid int64 = 1 // 已签未支付
|
||||||
|
BundleStatusPaid int64 = 2 // 已签已支付
|
||||||
|
BundleStatusOverdue int64 = 3 // 先用后付到期未付
|
||||||
|
)
|
||||||
|
|
||||||
|
// 先用后付状态
|
||||||
|
const (
|
||||||
|
PayLaterStatusNone int32 = 0
|
||||||
|
PayLaterStatusPending int32 = 1 // 待付款
|
||||||
|
PayLaterStatusPaid int32 = 2 // 已付款
|
||||||
|
PayLaterStatusOverdue int32 = 3 // 逾期未付
|
||||||
|
)
|
||||||
|
|
||||||
|
// 合同模板类型
|
||||||
|
const (
|
||||||
|
ContractTplBundleNormal int32 = 1 // 套餐-普通
|
||||||
|
ContractTplBundlePayLater int32 = 2 // 套餐-先用后付
|
||||||
|
ContractTplValueAddPayLater int32 = 3 // 增值-先用后付
|
||||||
|
)
|
||||||
|
|
||||||
|
// 下单校验业务类型
|
||||||
|
const (
|
||||||
|
OrderKindBundle int32 = 1
|
||||||
|
OrderKindValueAdd int32 = 2
|
||||||
|
)
|
||||||
|
|
||||||
|
// 下单校验错误码
|
||||||
|
const (
|
||||||
|
OrderGateReasonPayLaterBundleOverdue = "PAYLATER_BUNDLE_OVERDUE"
|
||||||
|
OrderGateReasonPayLaterBundlePending = "PAYLATER_BUNDLE_PENDING"
|
||||||
|
OrderGateReasonBundleActiveExists = "BUNDLE_ACTIVE_EXISTS"
|
||||||
|
OrderGateReasonValueAddLocked = "VALUE_ADD_OVERDUE_LOCKED"
|
||||||
|
)
|
||||||
|
|||||||
@ -62,6 +62,8 @@ type Contract struct {
|
|||||||
OperatorNum string `gorm:"column:operator_num;comment:操作人账号;index:idx_operator_num" json:"operatorNum"`
|
OperatorNum string `gorm:"column:operator_num;comment:操作人账号;index:idx_operator_num" json:"operatorNum"`
|
||||||
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间;index:idx_operator_time;" json:"operatorTime"`
|
OperatorTime time.Time `gorm:"column:operator_time;comment:操作时间;index:idx_operator_time;" json:"operatorTime"`
|
||||||
|
|
||||||
|
ContractTemplateType int `gorm:"column:contract_template_type;type:int;default:0;comment:合同模板类型 1:套餐普通 2:套餐先用后付 3:增值先用后付;index:idx_contract_tpl_type" json:"contractTemplateType"`
|
||||||
|
|
||||||
PaymentCycles []ContractPaymentCycle `gorm:"foreignKey:ContractUUID;references:ContractUUID" json:"paymentCycles"`
|
PaymentCycles []ContractPaymentCycle `gorm:"foreignKey:ContractUUID;references:ContractUUID" json:"paymentCycles"`
|
||||||
DevelopmentCycles []DevelopmentCycle `gorm:"foreignKey:ContractUUID;references:ContractUUID" json:"developmentCycles"`
|
DevelopmentCycles []DevelopmentCycle `gorm:"foreignKey:ContractUUID;references:ContractUUID" json:"developmentCycles"`
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ type ValueAddService struct {
|
|||||||
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
||||||
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"`
|
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"`
|
||||||
ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"`
|
ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"`
|
||||||
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"`
|
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数"`
|
||||||
ValueAddServiceLang []ValueAddServiceLang `gorm:"foreignKey:UUID;references:UUID"`
|
ValueAddServiceLang []ValueAddServiceLang `gorm:"foreignKey:UUID;references:UUID"`
|
||||||
BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:ValueUid;references:UUID"`
|
BundleToValueAddService []BundleToValueAddService `gorm:"foreignKey:ValueUid;references:UUID"`
|
||||||
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
||||||
@ -48,7 +48,7 @@ type ValueAddServiceLang struct {
|
|||||||
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
Id int32 `gorm:"column:id;type:int(11);primary_key;AUTO_INCREMENT" json:"id"`
|
||||||
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"`
|
UUID string `json:"uuid" gorm:"column:uuid;type:varchar(1024);comment:增值套餐UUID"`
|
||||||
ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"`
|
ServiceName string `json:"serviceName" gorm:"column:service_name;type:varchar(1024);comment:增值服务名称"`
|
||||||
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长"`
|
ServiceType int32 `json:"serviceType" gorm:"column:service_type;type:int;comment:服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长 6:竞品数"`
|
||||||
PriceMode int32 `json:"priceMode" gorm:"column:price_mode;type:int;comment:套餐价格类型 1:单价 2:总价"`
|
PriceMode int32 `json:"priceMode" gorm:"column:price_mode;type:int;comment:套餐价格类型 1:单价 2:总价"`
|
||||||
OriginalPrice float32 `json:"originalPrice" gorm:"column:original_price;type:decimal(12,2);comment:原单价"`
|
OriginalPrice float32 `json:"originalPrice" gorm:"column:original_price;type:decimal(12,2);comment:原单价"`
|
||||||
TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"` //总价模式不合理,该字段暂时无用
|
TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"` //总价模式不合理,该字段暂时无用
|
||||||
|
|||||||
@ -35,6 +35,8 @@ service Bundle {
|
|||||||
rpc OnlyAddValueListByOrderNo(OnlyAddValueListByOrderNoRequest) returns (OnlyAddValueListByOrderNoResp) {} // 根据orderNo只查增值服务
|
rpc OnlyAddValueListByOrderNo(OnlyAddValueListByOrderNoRequest) returns (OnlyAddValueListByOrderNoResp) {} // 根据orderNo只查增值服务
|
||||||
rpc ReSignTheContract(ReSignTheContractRequest) returns (CommonResponse) {}
|
rpc ReSignTheContract(ReSignTheContractRequest) returns (CommonResponse) {}
|
||||||
rpc GetInEffectOrderRecord(GetInEffectOrderRecordRequest) returns (OrderRecord) {} // 获取用户当前生效的订单信息
|
rpc GetInEffectOrderRecord(GetInEffectOrderRecordRequest) returns (OrderRecord) {} // 获取用户当前生效的订单信息
|
||||||
|
rpc CheckOrderEligibility(CheckOrderEligibilityRequest) returns (CheckOrderEligibilityResponse) {} // 下单前置校验(先用后付)
|
||||||
|
rpc MarkOverdueOrders(MarkOverdueOrdersRequest) returns (MarkOverdueOrdersResponse) {} // 扫描到期未付订单(定时任务可调用)
|
||||||
|
|
||||||
//增值套餐
|
//增值套餐
|
||||||
rpc CreateValueAddBundle(CreateValueAddBundleRequest) returns (CreateValueAddBundleResponse) {}
|
rpc CreateValueAddBundle(CreateValueAddBundleRequest) returns (CreateValueAddBundleResponse) {}
|
||||||
@ -266,6 +268,10 @@ message OrderCreateRecord{
|
|||||||
uint64 inviterId = 23; // 邀请人ID
|
uint64 inviterId = 23; // 邀请人ID
|
||||||
uint64 purchaseType = 24; // 购买类型 1:新购 2:续费
|
uint64 purchaseType = 24; // 购买类型 1:新购 2:续费
|
||||||
string renewalOrderUUID = 25; // 续费订单UUID
|
string renewalOrderUUID = 25; // 续费订单UUID
|
||||||
|
int32 orderMode = 26 [json_name = "orderMode"]; // 订单模式 1:普通 2:先用后付
|
||||||
|
string dueTime = 27 [json_name = "dueTime"]; // 先用后付到期应付时间(北京时间)
|
||||||
|
int32 payLaterStatus = 28 [json_name = "payLaterStatus"]; // 先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
|
int32 contractTplType = 29 [json_name = "contractTplType"]; // 合同模板类型 1:套餐普通 2:套餐先用后付 3:增值先用后付
|
||||||
}
|
}
|
||||||
message OrderCreateAddRecord{
|
message OrderCreateAddRecord{
|
||||||
int32 serviceType = 1 [json_name = "serviceType"];
|
int32 serviceType = 1 [json_name = "serviceType"];
|
||||||
@ -281,6 +287,10 @@ message OrderCreateAddRecord{
|
|||||||
int32 quotaType = 11 [json_name = "quotaType"];
|
int32 quotaType = 11 [json_name = "quotaType"];
|
||||||
int32 quotaValue = 12 [json_name = "quotaValue"];
|
int32 quotaValue = 12 [json_name = "quotaValue"];
|
||||||
bool isExpired = 13 [json_name = "isExpired"];
|
bool isExpired = 13 [json_name = "isExpired"];
|
||||||
|
int32 orderMode = 14 [json_name = "orderMode"]; // 订单模式 1:普通 2:先用后付(增值默认2)
|
||||||
|
string dueTime = 15 [json_name = "dueTime"]; // 先用后付到期应付时间
|
||||||
|
int32 payLaterStatus = 16 [json_name = "payLaterStatus"]; // 先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
|
int32 contractTplType = 17 [json_name = "contractTplType"]; // 合同模板类型 3:增值先用后付
|
||||||
}
|
}
|
||||||
message OrderRecordsRequestV2{
|
message OrderRecordsRequestV2{
|
||||||
string customerName = 1;
|
string customerName = 1;
|
||||||
@ -300,6 +310,8 @@ message OrderRecordsRequestV2{
|
|||||||
string bundlePayStart = 15;
|
string bundlePayStart = 15;
|
||||||
string bundlePayEnd = 16;
|
string bundlePayEnd = 16;
|
||||||
uint64 purchaseType = 17;
|
uint64 purchaseType = 17;
|
||||||
|
int32 orderMode = 18 [json_name = "orderMode"]; // 订单模式筛选 1:普通 2:先用后付
|
||||||
|
int32 payLaterStatus = 19 [json_name = "payLaterStatus"]; // 先用后付状态筛选 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
}
|
}
|
||||||
message OrderRecordsResponseV2{
|
message OrderRecordsResponseV2{
|
||||||
repeated OrderBundleRecordInfo bundleInfo = 1;
|
repeated OrderBundleRecordInfo bundleInfo = 1;
|
||||||
@ -324,6 +336,10 @@ message OrderBundleRecordInfo{
|
|||||||
string inviterName = 14;
|
string inviterName = 14;
|
||||||
uint64 purchaseType = 15;
|
uint64 purchaseType = 15;
|
||||||
string renewalOrderUUID = 16;
|
string renewalOrderUUID = 16;
|
||||||
|
int32 orderMode = 17 [json_name = "orderMode"]; // 订单模式 1:普通 2:先用后付
|
||||||
|
string dueTime = 18 [json_name = "dueTime"]; // 先用后付到期应付时间
|
||||||
|
int32 payLaterStatus = 19 [json_name = "payLaterStatus"]; // 先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
|
int32 contractTplType = 20 [json_name = "contractTplType"]; // 合同模板类型 1:套餐普通 2:套餐先用后付
|
||||||
}
|
}
|
||||||
message OrderAddBundleRecordInfo{
|
message OrderAddBundleRecordInfo{
|
||||||
string orderAddNo = 1;
|
string orderAddNo = 1;
|
||||||
@ -339,6 +355,10 @@ message OrderAddBundleRecordInfo{
|
|||||||
string CheckoutSessionId = 11;
|
string CheckoutSessionId = 11;
|
||||||
string CustomerID = 12;
|
string CustomerID = 12;
|
||||||
int32 videoNum = 13;
|
int32 videoNum = 13;
|
||||||
|
int32 orderMode = 14 [json_name = "orderMode"]; // 订单模式 1:普通 2:先用后付(增值默认2)
|
||||||
|
string dueTime = 15 [json_name = "dueTime"]; // 先用后付到期应付时间
|
||||||
|
int32 payLaterStatus = 16 [json_name = "payLaterStatus"]; // 先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
|
int32 contractTplType = 17 [json_name = "contractTplType"]; // 合同模板类型 3:增值先用后付
|
||||||
}
|
}
|
||||||
message PackagePriceAndTimeResponse{
|
message PackagePriceAndTimeResponse{
|
||||||
float price = 1 [json_name = "price"];
|
float price = 1 [json_name = "price"];
|
||||||
@ -373,6 +393,8 @@ message BundleProfile {
|
|||||||
repeated BundleProfileLang bundleProfileLang = 19 [json_name = "bundleProfileLang"];
|
repeated BundleProfileLang bundleProfileLang = 19 [json_name = "bundleProfileLang"];
|
||||||
int32 imgOption = 20 [json_name = "imgOption"];
|
int32 imgOption = 20 [json_name = "imgOption"];
|
||||||
string fontColor = 21 [json_name = "fontColor"];
|
string fontColor = 21 [json_name = "fontColor"];
|
||||||
|
int64 bundleType = 22 [json_name = "bundleType"];
|
||||||
|
int64 payLaterTime = 23 [json_name = "payLaterTime"]; //先用后付套餐的后付时间,单位为天
|
||||||
}
|
}
|
||||||
message BundleProfileLang {
|
message BundleProfileLang {
|
||||||
string uuid = 1 [json_name = "uuid"];
|
string uuid = 1 [json_name = "uuid"];
|
||||||
@ -392,7 +414,9 @@ message BundleProfileLang {
|
|||||||
string bgImg2 = 15 [json_name = "bgImg2"];
|
string bgImg2 = 15 [json_name = "bgImg2"];
|
||||||
int64 shelfStatus = 16 [json_name = "shelfStatus"]; // 1 上架 2 下架
|
int64 shelfStatus = 16 [json_name = "shelfStatus"]; // 1 上架 2 下架
|
||||||
int32 imgOption = 17 [json_name = "imgOption"];
|
int32 imgOption = 17 [json_name = "imgOption"];
|
||||||
repeated ServiceLangInfo serviceLangInfo = 18 [json_name = "serviceLangInfo"];//增值服务信息
|
int64 bundleType = 18 [json_name = "bundleType"];
|
||||||
|
int64 payLaterTime = 19 [json_name = "payLaterTime"]; //先用后付套餐的后付时间,单位为天
|
||||||
|
repeated ServiceLangInfo serviceLangInfo = 20 [json_name = "serviceLangInfo"];//增值服务信息
|
||||||
//repeated ValueAddServiceLang valueAddServiceLang = 12 [json_name = "ValueAddServiceLang"];
|
//repeated ValueAddServiceLang valueAddServiceLang = 12 [json_name = "ValueAddServiceLang"];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -441,6 +465,7 @@ message BundleListRequest {
|
|||||||
string name = 3 [json_name = "name"];
|
string name = 3 [json_name = "name"];
|
||||||
string content = 4 [json_name = "content"];
|
string content = 4 [json_name = "content"];
|
||||||
string language = 5 [json_name = "language"];
|
string language = 5 [json_name = "language"];
|
||||||
|
int32 bundleType = 6 [json_name = "bundleType"];
|
||||||
}
|
}
|
||||||
|
|
||||||
message BundleListResponse {
|
message BundleListResponse {
|
||||||
@ -507,6 +532,32 @@ message OrderRecord {
|
|||||||
int32 reSignature = 40 [json_name = "reSignature"];
|
int32 reSignature = 40 [json_name = "reSignature"];
|
||||||
uint64 purchaseType = 41 [json_name = "purchaseType"]; // 购买类型 1:新购 2:续费
|
uint64 purchaseType = 41 [json_name = "purchaseType"]; // 购买类型 1:新购 2:续费
|
||||||
string renewalOrderUUID = 42 [json_name = "renewalOrderUUID"];
|
string renewalOrderUUID = 42 [json_name = "renewalOrderUUID"];
|
||||||
|
int32 orderMode = 43 [json_name = "orderMode"]; // 订单模式 1:普通 2:先用后付
|
||||||
|
string dueTime = 44 [json_name = "dueTime"]; // 先用后付到期时间
|
||||||
|
int32 payLaterStatus = 45 [json_name = "payLaterStatus"]; // 先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
|
int32 contractTplType = 46 [json_name = "contractTplType"]; // 合同模板类型
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下单前置校验
|
||||||
|
message CheckOrderEligibilityRequest {
|
||||||
|
string customerID = 1 [json_name = "customerID"];
|
||||||
|
int32 orderKind = 2 [json_name = "orderKind"]; // 1:套餐订单 2:增值订单
|
||||||
|
int32 orderMode = 3 [json_name = "orderMode"]; // 1:普通 2:先用后付
|
||||||
|
}
|
||||||
|
message CheckOrderEligibilityResponse {
|
||||||
|
bool allow = 1 [json_name = "allow"];
|
||||||
|
string reason = 2 [json_name = "reason"]; // 错误码:PAYLATER_BUNDLE_OVERDUE / BUNDLE_ACTIVE_EXISTS
|
||||||
|
string msg = 3 [json_name = "msg"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 扫描到期未付订单
|
||||||
|
message MarkOverdueOrdersRequest {
|
||||||
|
string now = 1 [json_name = "now"]; // 可选,默认服务端 now(北京时间)
|
||||||
|
}
|
||||||
|
message MarkOverdueOrdersResponse {
|
||||||
|
int32 bundleOverdueCount = 1 [json_name = "bundleOverdueCount"];
|
||||||
|
int32 valueAddExpiredCount = 2 [json_name = "valueAddExpiredCount"];
|
||||||
|
string msg = 3 [json_name = "msg"];
|
||||||
}
|
}
|
||||||
message AddInfo{
|
message AddInfo{
|
||||||
string orderNo = 1 [json_name = "orderNo"];
|
string orderNo = 1 [json_name = "orderNo"];
|
||||||
@ -531,6 +582,10 @@ message OrderAddRecord{
|
|||||||
string expirationDate = 11 [json_name = "expirationDate"];
|
string expirationDate = 11 [json_name = "expirationDate"];
|
||||||
string snapshot = 38 [json_name = "snapshot"];
|
string snapshot = 38 [json_name = "snapshot"];
|
||||||
string orderUUID = 39 [json_name = "orderUUID"];
|
string orderUUID = 39 [json_name = "orderUUID"];
|
||||||
|
int32 orderMode = 40 [json_name = "orderMode"]; // 订单模式 1:普通 2:先用后付(增值默认2)
|
||||||
|
string dueTime = 41 [json_name = "dueTime"]; // 先用后付到期应付时间
|
||||||
|
int32 payLaterStatus = 42 [json_name = "payLaterStatus"]; // 先用后付状态 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
|
int32 contractTplType = 43 [json_name = "contractTplType"]; // 合同模板类型 3:增值先用后付
|
||||||
}
|
}
|
||||||
message AddPriceOptionsInfo {
|
message AddPriceOptionsInfo {
|
||||||
int32 id = 1 [json_name = "id"];
|
int32 id = 1 [json_name = "id"];
|
||||||
@ -564,6 +619,8 @@ message OrderRecordsRequest {
|
|||||||
int32 financialConfirmation = 15 [json_name = "financialConfirmation"];
|
int32 financialConfirmation = 15 [json_name = "financialConfirmation"];
|
||||||
string telNum = 16 [json_name = "telNum"];
|
string telNum = 16 [json_name = "telNum"];
|
||||||
string purchaseType = 17 [json_name = "purchaseType"]; // 购买类型 1:新购 2:续费
|
string purchaseType = 17 [json_name = "purchaseType"]; // 购买类型 1:新购 2:续费
|
||||||
|
int32 orderMode = 18 [json_name = "orderMode"]; // 订单模式筛选 1:普通 2:先用后付
|
||||||
|
int32 payLaterStatus = 19 [json_name = "payLaterStatus"]; // 先用后付状态筛选 0:无 1:待付款 2:已付款 3:逾期未付
|
||||||
}
|
}
|
||||||
|
|
||||||
message OrderRecordsResponse {
|
message OrderRecordsResponse {
|
||||||
@ -735,13 +792,13 @@ message BundleExtendRequest{
|
|||||||
uint32 imagesAdditional = 4; //图文
|
uint32 imagesAdditional = 4; //图文
|
||||||
uint32 dataAdditional = 5;//数据分析
|
uint32 dataAdditional = 5;//数据分析
|
||||||
uint32 competitiveAdditional = 6;//竞品数
|
uint32 competitiveAdditional = 6;//竞品数
|
||||||
uint32 availableDurationAdditional = 7;
|
uint32 availableDurationAdditional = 7;
|
||||||
uint32 timeUnit = 8; // 1 日 2 月 3年
|
uint32 timeUnit = 8; // 1 日 2 月 3年
|
||||||
string remark = 9;
|
string remark = 9;
|
||||||
string associatedorderNumber = 10;
|
string associatedorderNumber = 10;
|
||||||
uint64 operatorId = 11;
|
uint64 operatorId = 11;
|
||||||
string operatorName = 12;
|
string operatorName = 12;
|
||||||
string operatorPhoneNumber = 13;
|
string operatorPhoneNumber = 13;
|
||||||
int32 type = 14;
|
int32 type = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1072,7 +1129,7 @@ message AddBundleBalanceReq{
|
|||||||
int32 dataAnalysisConsumptionNumber = 11;
|
int32 dataAnalysisConsumptionNumber = 11;
|
||||||
int32 competitiveNumber = 12;
|
int32 competitiveNumber = 12;
|
||||||
int32 competitiveConsumptionNumber = 13;
|
int32 competitiveConsumptionNumber = 13;
|
||||||
int32 expansionPacksNumber = 14;
|
int32 expansionPacksNumber = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
message AddBundleBalanceResp{
|
message AddBundleBalanceResp{
|
||||||
@ -1184,19 +1241,19 @@ message GetBundleBalanceByUserIdResp{
|
|||||||
string paymentAmount = 8;
|
string paymentAmount = 8;
|
||||||
int32 paymentType = 9;
|
int32 paymentType = 9;
|
||||||
int32 accountNumber = 10;
|
int32 accountNumber = 10;
|
||||||
int32 accountExtendNumber = 11;
|
int32 accountExtendNumber = 11;
|
||||||
int32 accountAdditional = 12;
|
int32 accountAdditional = 12;
|
||||||
int32 accountConsumptionNumber = 13;
|
int32 accountConsumptionNumber = 13;
|
||||||
int32 videoNumber = 14;
|
int32 videoNumber = 14;
|
||||||
int32 videoExtendNumber = 15;
|
int32 videoExtendNumber = 15;
|
||||||
int32 videoExtendConsumptionNumber = 16;
|
int32 videoExtendConsumptionNumber = 16;
|
||||||
int32 videoAdditional = 17;
|
int32 videoAdditional = 17;
|
||||||
int32 videoConsumptionNumber = 18;
|
int32 videoConsumptionNumber = 18;
|
||||||
int32 imageNumber = 19;
|
int32 imageNumber = 19;
|
||||||
int32 imageExtendNumber = 20;
|
int32 imageExtendNumber = 20;
|
||||||
int32 imageExtendConsumptionNumber = 21;
|
int32 imageExtendConsumptionNumber = 21;
|
||||||
int32 imageAdditional = 22;
|
int32 imageAdditional = 22;
|
||||||
int32 imageConsumptionNumber = 23;
|
int32 imageConsumptionNumber = 23;
|
||||||
int32 dataAnalysisNumber = 24;
|
int32 dataAnalysisNumber = 24;
|
||||||
int32 dataAnalysisExtendNumber = 25;
|
int32 dataAnalysisExtendNumber = 25;
|
||||||
int32 dataAnalysisExtendConsumptionNumber = 26;
|
int32 dataAnalysisExtendConsumptionNumber = 26;
|
||||||
@ -1939,7 +1996,7 @@ message MetricsOperatingStatusResp {
|
|||||||
int64 pendingUploadCompetitiveCount = 32; // 待发布竞品数
|
int64 pendingUploadCompetitiveCount = 32; // 待发布竞品数
|
||||||
int64 uploadSuccessCompetitiveCount = 33; // 发布成功竞品数
|
int64 uploadSuccessCompetitiveCount = 33; // 发布成功竞品数
|
||||||
int64 uploadFailedCompetitiveCount = 34; // 发布异常竞品数
|
int64 uploadFailedCompetitiveCount = 34; // 发布异常竞品数
|
||||||
|
|
||||||
int64 abnormalAccountAcount = 35; // 触发预警的账号数
|
int64 abnormalAccountAcount = 35; // 触发预警的账号数
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2174,6 +2231,7 @@ message ContractInfo {
|
|||||||
repeated AttachmentItem otherAttachments = 18 [json_name = "otherAttachments"]; // 其他附件(含url+fileName)
|
repeated AttachmentItem otherAttachments = 18 [json_name = "otherAttachments"]; // 其他附件(含url+fileName)
|
||||||
string operator = 19 [json_name = "operator"]; // 操作人
|
string operator = 19 [json_name = "operator"]; // 操作人
|
||||||
string operatorTime = 22 [json_name = "operatorTime"]; // 操作时间
|
string operatorTime = 22 [json_name = "operatorTime"]; // 操作时间
|
||||||
|
int32 contractTemplateType = 23 [json_name = "contractTemplateType"]; // 合同模板类型 1:套餐普通 2:套餐先用后付 3:增值先用后付
|
||||||
}
|
}
|
||||||
|
|
||||||
// 合同信息(详情用)
|
// 合同信息(详情用)
|
||||||
@ -2202,6 +2260,7 @@ message Contract {
|
|||||||
string operatorTime = 23 [json_name = "operatorTime"]; // 操作时间
|
string operatorTime = 23 [json_name = "operatorTime"]; // 操作时间
|
||||||
repeated ContractPaymentCycle paymentCycles = 24 [json_name = "paymentCycles"]; // 支付周期子表数组
|
repeated ContractPaymentCycle paymentCycles = 24 [json_name = "paymentCycles"]; // 支付周期子表数组
|
||||||
repeated DevelopmentCycle developmentCycles = 25 [json_name = "developmentCycles"]; // 开发周期子表数组
|
repeated DevelopmentCycle developmentCycles = 25 [json_name = "developmentCycles"]; // 开发周期子表数组
|
||||||
|
int32 contractTemplateType = 26 [json_name = "contractTemplateType"]; // 合同模板类型 1:套餐普通 2:套餐先用后付 3:增值先用后付
|
||||||
}
|
}
|
||||||
|
|
||||||
// 支付周期子表
|
// 支付周期子表
|
||||||
@ -2384,6 +2443,7 @@ message GetLastInvoiceNoResp{
|
|||||||
string lastNo = 1;
|
string lastNo = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message UpdataInvoiceInfoReq{
|
message UpdataInvoiceInfoReq{
|
||||||
string orderNo = 1;
|
string orderNo = 1;
|
||||||
string url = 2;
|
string url = 2;
|
||||||
|
|||||||
17810
pb/bundle/bundle.pb.go
17810
pb/bundle/bundle.pb.go
File diff suppressed because it is too large
Load Diff
@ -217,6 +217,18 @@ func (this *OrderRecord) Validate() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
func (this *CheckOrderEligibilityRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *CheckOrderEligibilityResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *MarkOverdueOrdersRequest) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
func (this *MarkOverdueOrdersResponse) Validate() error {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
func (this *AddInfo) Validate() error {
|
func (this *AddInfo) Validate() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||||
// versions:
|
// versions:
|
||||||
// - protoc-gen-go-triple v1.0.5
|
// - protoc-gen-go-triple v1.0.5
|
||||||
// - protoc v5.26.0
|
// - protoc v6.32.0
|
||||||
// source: pb/bundle.proto
|
// source: pb/bundle.proto
|
||||||
|
|
||||||
package bundle
|
package bundle
|
||||||
@ -52,6 +52,8 @@ type BundleClient interface {
|
|||||||
OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAddValueListByOrderNoRequest, opts ...grpc_go.CallOption) (*OnlyAddValueListByOrderNoResp, common.ErrorWithAttachment)
|
OnlyAddValueListByOrderNo(ctx context.Context, in *OnlyAddValueListByOrderNoRequest, opts ...grpc_go.CallOption) (*OnlyAddValueListByOrderNoResp, common.ErrorWithAttachment)
|
||||||
ReSignTheContract(ctx context.Context, in *ReSignTheContractRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
ReSignTheContract(ctx context.Context, in *ReSignTheContractRequest, opts ...grpc_go.CallOption) (*CommonResponse, common.ErrorWithAttachment)
|
||||||
GetInEffectOrderRecord(ctx context.Context, in *GetInEffectOrderRecordRequest, opts ...grpc_go.CallOption) (*OrderRecord, common.ErrorWithAttachment)
|
GetInEffectOrderRecord(ctx context.Context, in *GetInEffectOrderRecordRequest, opts ...grpc_go.CallOption) (*OrderRecord, common.ErrorWithAttachment)
|
||||||
|
CheckOrderEligibility(ctx context.Context, in *CheckOrderEligibilityRequest, opts ...grpc_go.CallOption) (*CheckOrderEligibilityResponse, common.ErrorWithAttachment)
|
||||||
|
MarkOverdueOrders(ctx context.Context, in *MarkOverdueOrdersRequest, opts ...grpc_go.CallOption) (*MarkOverdueOrdersResponse, common.ErrorWithAttachment)
|
||||||
// 增值套餐
|
// 增值套餐
|
||||||
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment)
|
CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment)
|
||||||
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
|
ValueAddBundleList(ctx context.Context, in *ValueAddBundleListRequest, opts ...grpc_go.CallOption) (*ValueAddBundleListResponse, common.ErrorWithAttachment)
|
||||||
@ -184,6 +186,8 @@ type BundleClientImpl struct {
|
|||||||
OnlyAddValueListByOrderNo func(ctx context.Context, in *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
OnlyAddValueListByOrderNo func(ctx context.Context, in *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
||||||
ReSignTheContract func(ctx context.Context, in *ReSignTheContractRequest) (*CommonResponse, error)
|
ReSignTheContract func(ctx context.Context, in *ReSignTheContractRequest) (*CommonResponse, error)
|
||||||
GetInEffectOrderRecord func(ctx context.Context, in *GetInEffectOrderRecordRequest) (*OrderRecord, error)
|
GetInEffectOrderRecord func(ctx context.Context, in *GetInEffectOrderRecordRequest) (*OrderRecord, error)
|
||||||
|
CheckOrderEligibility func(ctx context.Context, in *CheckOrderEligibilityRequest) (*CheckOrderEligibilityResponse, error)
|
||||||
|
MarkOverdueOrders func(ctx context.Context, in *MarkOverdueOrdersRequest) (*MarkOverdueOrdersResponse, error)
|
||||||
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
CreateValueAddBundle func(ctx context.Context, in *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||||
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
ValueAddBundleList func(ctx context.Context, in *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||||
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
ValueAddBundleDetail func(ctx context.Context, in *ValueAddBundleDetailRequest) (*ValueAddBundleDetailResponse, error)
|
||||||
@ -430,6 +434,18 @@ func (c *bundleClient) GetInEffectOrderRecord(ctx context.Context, in *GetInEffe
|
|||||||
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetInEffectOrderRecord", in, out)
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetInEffectOrderRecord", in, out)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *bundleClient) CheckOrderEligibility(ctx context.Context, in *CheckOrderEligibilityRequest, opts ...grpc_go.CallOption) (*CheckOrderEligibilityResponse, common.ErrorWithAttachment) {
|
||||||
|
out := new(CheckOrderEligibilityResponse)
|
||||||
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CheckOrderEligibility", in, out)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *bundleClient) MarkOverdueOrders(ctx context.Context, in *MarkOverdueOrdersRequest, opts ...grpc_go.CallOption) (*MarkOverdueOrdersResponse, common.ErrorWithAttachment) {
|
||||||
|
out := new(MarkOverdueOrdersResponse)
|
||||||
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
|
return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/MarkOverdueOrders", in, out)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) {
|
func (c *bundleClient) CreateValueAddBundle(ctx context.Context, in *CreateValueAddBundleRequest, opts ...grpc_go.CallOption) (*CreateValueAddBundleResponse, common.ErrorWithAttachment) {
|
||||||
out := new(CreateValueAddBundleResponse)
|
out := new(CreateValueAddBundleResponse)
|
||||||
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
interfaceKey := ctx.Value(constant.InterfaceKey).(string)
|
||||||
@ -986,6 +1002,8 @@ type BundleServer interface {
|
|||||||
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
OnlyAddValueListByOrderNo(context.Context, *OnlyAddValueListByOrderNoRequest) (*OnlyAddValueListByOrderNoResp, error)
|
||||||
ReSignTheContract(context.Context, *ReSignTheContractRequest) (*CommonResponse, error)
|
ReSignTheContract(context.Context, *ReSignTheContractRequest) (*CommonResponse, error)
|
||||||
GetInEffectOrderRecord(context.Context, *GetInEffectOrderRecordRequest) (*OrderRecord, error)
|
GetInEffectOrderRecord(context.Context, *GetInEffectOrderRecordRequest) (*OrderRecord, error)
|
||||||
|
CheckOrderEligibility(context.Context, *CheckOrderEligibilityRequest) (*CheckOrderEligibilityResponse, error)
|
||||||
|
MarkOverdueOrders(context.Context, *MarkOverdueOrdersRequest) (*MarkOverdueOrdersResponse, error)
|
||||||
// 增值套餐
|
// 增值套餐
|
||||||
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error)
|
||||||
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
ValueAddBundleList(context.Context, *ValueAddBundleListRequest) (*ValueAddBundleListResponse, error)
|
||||||
@ -1167,6 +1185,12 @@ func (UnimplementedBundleServer) ReSignTheContract(context.Context, *ReSignTheCo
|
|||||||
func (UnimplementedBundleServer) GetInEffectOrderRecord(context.Context, *GetInEffectOrderRecordRequest) (*OrderRecord, error) {
|
func (UnimplementedBundleServer) GetInEffectOrderRecord(context.Context, *GetInEffectOrderRecordRequest) (*OrderRecord, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method GetInEffectOrderRecord not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method GetInEffectOrderRecord not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedBundleServer) CheckOrderEligibility(context.Context, *CheckOrderEligibilityRequest) (*CheckOrderEligibilityResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method CheckOrderEligibility not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedBundleServer) MarkOverdueOrders(context.Context, *MarkOverdueOrdersRequest) (*MarkOverdueOrdersResponse, error) {
|
||||||
|
return nil, status.Errorf(codes.Unimplemented, "method MarkOverdueOrders not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) {
|
func (UnimplementedBundleServer) CreateValueAddBundle(context.Context, *CreateValueAddBundleRequest) (*CreateValueAddBundleResponse, error) {
|
||||||
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
|
return nil, status.Errorf(codes.Unimplemented, "method CreateValueAddBundle not implemented")
|
||||||
}
|
}
|
||||||
@ -2155,6 +2179,64 @@ func _Bundle_GetInEffectOrderRecord_Handler(srv interface{}, ctx context.Context
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _Bundle_CheckOrderEligibility_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CheckOrderEligibilityRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||||
|
args := []interface{}{}
|
||||||
|
args = append(args, in)
|
||||||
|
md, _ := metadata.FromIncomingContext(ctx)
|
||||||
|
invAttachment := make(map[string]interface{}, len(md))
|
||||||
|
for k, v := range md {
|
||||||
|
invAttachment[k] = v
|
||||||
|
}
|
||||||
|
invo := invocation.NewRPCInvocation("CheckOrderEligibility", args, invAttachment)
|
||||||
|
if interceptor == nil {
|
||||||
|
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||||
|
return result, result.Error()
|
||||||
|
}
|
||||||
|
info := &grpc_go.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||||
|
return result, result.Error()
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _Bundle_MarkOverdueOrders_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(MarkOverdueOrdersRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
base := srv.(dubbo3.Dubbo3GrpcService)
|
||||||
|
args := []interface{}{}
|
||||||
|
args = append(args, in)
|
||||||
|
md, _ := metadata.FromIncomingContext(ctx)
|
||||||
|
invAttachment := make(map[string]interface{}, len(md))
|
||||||
|
for k, v := range md {
|
||||||
|
invAttachment[k] = v
|
||||||
|
}
|
||||||
|
invo := invocation.NewRPCInvocation("MarkOverdueOrders", args, invAttachment)
|
||||||
|
if interceptor == nil {
|
||||||
|
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||||
|
return result, result.Error()
|
||||||
|
}
|
||||||
|
info := &grpc_go.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string),
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
result := base.XXX_GetProxyImpl().Invoke(ctx, invo)
|
||||||
|
return result, result.Error()
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
func _Bundle_CreateValueAddBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(CreateValueAddBundleRequest)
|
in := new(CreateValueAddBundleRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -4810,6 +4892,14 @@ var Bundle_ServiceDesc = grpc_go.ServiceDesc{
|
|||||||
MethodName: "GetInEffectOrderRecord",
|
MethodName: "GetInEffectOrderRecord",
|
||||||
Handler: _Bundle_GetInEffectOrderRecord_Handler,
|
Handler: _Bundle_GetInEffectOrderRecord_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CheckOrderEligibility",
|
||||||
|
Handler: _Bundle_CheckOrderEligibility_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "MarkOverdueOrders",
|
||||||
|
Handler: _Bundle_MarkOverdueOrders_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "CreateValueAddBundle",
|
MethodName: "CreateValueAddBundle",
|
||||||
Handler: _Bundle_CreateValueAddBundle_Handler,
|
Handler: _Bundle_CreateValueAddBundle_Handler,
|
||||||
|
|||||||
@ -95,6 +95,24 @@ func loadMysqlConn(conn string) *gorm.DB {
|
|||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 先用后付字段迁移
|
||||||
|
for _, col := range []string{"order_mode", "due_time", "pay_later_status", "contract_tpl_type"} {
|
||||||
|
if !db.Migrator().HasColumn(&model.BundleOrderRecords{}, col) {
|
||||||
|
if err := db.Migrator().AddColumn(&model.BundleOrderRecords{}, col); err != nil {
|
||||||
|
fmt.Println("[migrate BundleOrderRecords]", col, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !db.Migrator().HasColumn(&model.BundleOrderValueAdd{}, col) {
|
||||||
|
if err := db.Migrator().AddColumn(&model.BundleOrderValueAdd{}, col); err != nil {
|
||||||
|
fmt.Println("[migrate BundleOrderValueAdd]", col, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !db.Migrator().HasColumn(&model.Contract{}, "contract_template_type") {
|
||||||
|
if err := db.Migrator().AddColumn(&model.Contract{}, "contract_template_type"); err != nil {
|
||||||
|
fmt.Println("[migrate Contract] contract_template_type", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// return nil
|
// return nil
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|||||||
@ -119,6 +119,7 @@ const (
|
|||||||
DataReportService = 3 //数据报表
|
DataReportService = 3 //数据报表
|
||||||
AccountService = 4 //账号数
|
AccountService = 4 //账号数
|
||||||
AvailableTimeService = 5 //可用时长
|
AvailableTimeService = 5 //可用时长
|
||||||
|
CompetitiveService = 6 //竞品数
|
||||||
)
|
)
|
||||||
|
|
||||||
// 套餐状态
|
// 套餐状态
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user