fix: 调整自动创建代码,待测试
This commit is contained in:
parent
488d293282
commit
96684582ce
@ -253,14 +253,16 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
||||
reportUuid := ""
|
||||
accountUuid := ""
|
||||
durationUuid := ""
|
||||
bundleVideoUuid := ""
|
||||
if config.AppConfig.System.AppMode == "prod" {
|
||||
BundleName = "全球尊享版"
|
||||
BundleUuid = "ac4c99c2951c2fcdbf417928d321554d"
|
||||
videoUuid = "a29a1fa2862b2cdda1377b19066c8eb7"
|
||||
textAndImagesUuid = "dfba176a40ae2d23aa4ef9b30b646bc8"
|
||||
reportUuid = "1727557a85c92957a3e3332d18c713aa"
|
||||
accountUuid = "e1cc219e4f682b3d8cb85929e540a0de"
|
||||
durationUuid = "f002449ac57a2e71b0673da938c0354e"
|
||||
videoUuid = "355aae784d77280197c92ff56733459d" // 增值视频
|
||||
textAndImagesUuid = "41a7753d210d22f8972dc273ff1360c4" // 套餐图文
|
||||
reportUuid = "069497de55852c24a3b0f702c1250900" // 套餐数据
|
||||
accountUuid = "1e04078d2a8824d18be1c281bc3167a8" // 套餐账号
|
||||
durationUuid = "e3ad8f15aa022b12afe47170c9051db9" // 套餐时长
|
||||
bundleVideoUuid = "fdbef018707e2a8ebc82a22e257abaff" // 套餐视频
|
||||
} else {
|
||||
BundleName = "测试导入全球尊享版"
|
||||
BundleUuid = "5e84f86cb7f92a4ab785271e4a383aa5"
|
||||
@ -307,7 +309,21 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
||||
f64, err := strconv.ParseFloat(unfinishInfo.OrderPayAmount, 32)
|
||||
TotalPrice = float32(f64)
|
||||
addRecords = append(addRecords,
|
||||
&bundle.OrderCreateAddRecord{
|
||||
&bundle.OrderCreateAddRecord{ // 套餐视频
|
||||
ServiceType: 1,
|
||||
ValueUid: bundleVideoUuid,
|
||||
CurrencyType: 2, //美元
|
||||
Amount: 0, //增值服务金额
|
||||
Num: 24,
|
||||
Unit: "个",
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
HandlingFee: unfinishInfo.OrderFeeAmount,
|
||||
EquityType: 1,
|
||||
QuotaType: 2,
|
||||
QuotaValue: 2,
|
||||
},
|
||||
&bundle.OrderCreateAddRecord{ //视频增值
|
||||
ServiceType: 1,
|
||||
ValueUid: videoUuid,
|
||||
CurrencyType: 2, //美元
|
||||
@ -317,6 +333,8 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
HandlingFee: unfinishInfo.OrderFeeAmount,
|
||||
EquityType: 2,
|
||||
QuotaType: 1,
|
||||
}, &bundle.OrderCreateAddRecord{ //图文
|
||||
ServiceType: 2,
|
||||
ValueUid: textAndImagesUuid,
|
||||
@ -327,6 +345,9 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
HandlingFee: unfinishInfo.OrderFeeAmount,
|
||||
EquityType: 1,
|
||||
QuotaType: 2,
|
||||
QuotaValue: 10,
|
||||
}, &bundle.OrderCreateAddRecord{ //数据报表
|
||||
ServiceType: 3,
|
||||
ValueUid: reportUuid,
|
||||
@ -337,6 +358,9 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
HandlingFee: unfinishInfo.OrderFeeAmount,
|
||||
EquityType: 1,
|
||||
QuotaType: 2,
|
||||
QuotaValue: 1,
|
||||
}, &bundle.OrderCreateAddRecord{ //账号数
|
||||
ServiceType: 4,
|
||||
ValueUid: accountUuid,
|
||||
@ -347,16 +371,20 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
HandlingFee: unfinishInfo.OrderFeeAmount,
|
||||
EquityType: 1,
|
||||
QuotaType: 1,
|
||||
}, &bundle.OrderCreateAddRecord{ //可用时长
|
||||
ServiceType: 5,
|
||||
ValueUid: durationUuid,
|
||||
CurrencyType: 2, //美元
|
||||
Amount: 0, //增值服务金额
|
||||
Num: 10,
|
||||
Num: 1,
|
||||
Unit: "年",
|
||||
Source: 1,
|
||||
PaymentStatus: 1,
|
||||
HandlingFee: unfinishInfo.OrderFeeAmount,
|
||||
EquityType: 1,
|
||||
QuotaType: 1,
|
||||
},
|
||||
)
|
||||
// 当前 未将 签名 写入合同中 todo 金额和有效时间待修改
|
||||
@ -464,6 +492,26 @@ func AutoCreateUserAndOrder(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
//生成发票
|
||||
orderRecord, err := service.BundleProvider.GetOrderInfoByOrderNo(context.Background(), &bundle.GetOrderInfoByOrderNoReq{
|
||||
Uuid: unfinishInfo.OrderNo, //因为需求更新,实际传入的是订单的uuid
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, err)
|
||||
return
|
||||
}
|
||||
amountType := strconv.FormatInt(orderRecord.AmountType, 10)
|
||||
applyTime := common.GetBeijingTime()
|
||||
payTime, _ := time.Parse("2006-01-02 15:04:05", applyTime)
|
||||
payTimeString := payTime.Format("20060102")
|
||||
fmt.Println("发票payTimeString :", payTimeString, "发票applyTime :", applyTime, "发票payTime :", payTime)
|
||||
fmt.Println("发票时间数据获取完成")
|
||||
err = createInvoice(orderRecord.UserId, orderRecord.UserNum, orderRecord.UserName, orderRecord.Address, orderRecord.Phone, orderRecord.BundleName, orderRecord.OrderNo, "1", amountType, orderRecord.TotalAmount, payTimeString, payTimeString, applyTime)
|
||||
if err != nil {
|
||||
service.Error(c, errors.New("生成发票失败"))
|
||||
return
|
||||
}
|
||||
|
||||
//如果是购买套餐 1:创建新的余量信息CreateBundleBalance 2 添加扩展记录BundleExtend
|
||||
_, err = service.BundleProvider.CreateBundleBalance(context.Background(), &bundle.CreateBundleBalanceReq{
|
||||
UserId: int32(userResp.UserId),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user