Compare commits
No commits in common. "feat-hjj-packageManage#A116" and "main" have entirely different histories.
feat-hjj-p
...
main
33
.vscode/launch.json
vendored
33
.vscode/launch.json
vendored
@ -1,33 +0,0 @@
|
||||
{
|
||||
// 使用 IntelliSense 了解相关属性。
|
||||
// 悬停以查看现有属性的描述。
|
||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch Package",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"env": {
|
||||
"GOPATH":"C:\\Users\\lenovo\\go",
|
||||
"GOOS":"windows"
|
||||
},
|
||||
"program": "${workspaceFolder}\\cmd",
|
||||
"args":[]
|
||||
},
|
||||
{
|
||||
"name": "Run app.go",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "debug",
|
||||
"program": "${workspaceFolder}/cmd",
|
||||
"cwd": "${workspaceFolder}/cmd",
|
||||
"env": {
|
||||
"DEBUG": "true",
|
||||
"DUBBO_GO_CONFIG_PATH": "${workspaceFolder}/conf/dubbogo.yaml"
|
||||
},
|
||||
"dlvFlags": ["--check-go-version=false"]
|
||||
}
|
||||
]
|
||||
}
|
22
.vscode/settings.json
vendored
22
.vscode/settings.json
vendored
@ -1,22 +0,0 @@
|
||||
{
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#fa1b49",
|
||||
"activityBar.background": "#fa1b49",
|
||||
"activityBar.foreground": "#e7e7e7",
|
||||
"activityBar.inactiveForeground": "#e7e7e799",
|
||||
"activityBarBadge.background": "#155e02",
|
||||
"activityBarBadge.foreground": "#e7e7e7",
|
||||
"commandCenter.border": "#e7e7e799",
|
||||
"sash.hoverBorder": "#fa1b49",
|
||||
"statusBar.background": "#dd0531",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#fa1b49",
|
||||
"statusBarItem.remoteBackground": "#dd0531",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#dd0531",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#dd053199",
|
||||
"titleBar.inactiveForeground": "#e7e7e799"
|
||||
},
|
||||
"peacock.color": "#dd0531"
|
||||
}
|
@ -115,28 +115,10 @@ func UpdateValueAddServiceLang(tx *gorm.DB, columns map[string]interface{}) (err
|
||||
// 增值套餐列表
|
||||
func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res []*model.ValueAddService, total int64, err error) {
|
||||
query := app.ModuleClients.BundleDB.Model(&model.ValueAddService{}).
|
||||
Where("deleted_at = 0")
|
||||
|
||||
// 使用子查询筛选符合条件的UUID
|
||||
if req.Name != "" || req.ServiceType != 0 {
|
||||
subQuery := app.ModuleClients.BundleDB.Model(&model.ValueAddServiceLang{}).
|
||||
Select("uuid").
|
||||
Where("deleted_at = 0")
|
||||
|
||||
if req.Name != "" {
|
||||
subQuery = subQuery.Where("service_name LIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
if req.ServiceType != 0 {
|
||||
subQuery = subQuery.Where("service_type = ?", req.ServiceType)
|
||||
}
|
||||
|
||||
query = query.Where("uuid IN (?)", subQuery)
|
||||
}
|
||||
|
||||
// 预加载语言表数据
|
||||
query = query.Preload("ValueAddServiceLang", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("uuid,service_name,service_type,price_mode,original_price,unit,language,price_type,options,created_at,updated_at,quota_type,quota_value,is_expired")
|
||||
})
|
||||
Where("deleted_at = 0").
|
||||
Preload("ValueAddServiceLang", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Select("uuid,service_name,service_type,price_mode,original_price,unit,language,price_type,options,created_at,updated_at")
|
||||
})
|
||||
|
||||
count := *query
|
||||
if req.PageSize != 0 && req.Page != 0 {
|
||||
|
@ -64,7 +64,6 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
if req.Sort <= 0 {
|
||||
return res, errors.New("排序参数需为正整数")
|
||||
}
|
||||
//套餐主表数据
|
||||
bundleProfile := &model.BundleProfile{
|
||||
Name: req.Name,
|
||||
Sort: req.Sort,
|
||||
@ -85,7 +84,6 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
PriceType: req.PriceType,
|
||||
Language: req.Language,
|
||||
}
|
||||
//必须先创建中文版本
|
||||
if req.Uuid == "" && req.Language != msg.ZH_CN {
|
||||
return res, errors.New("请先创建中文版本套餐")
|
||||
}
|
||||
@ -101,13 +99,10 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//现需要区分类型 分为 1:套餐权益,该类型必须关联一个可用时长类型的权益 2:套餐可选附加权益,非必选可为空
|
||||
selectService := make([]*model.BundleToValueAddService, 0)
|
||||
var pkgBenefitsValueAddServiceCount = make(map[int]struct{}) //套餐权益增值服务类型数量
|
||||
var pkgOptionalValueAddServiceCount = make(map[int]struct{}) //套餐可选附加权益增值服务类型数量
|
||||
var selectValueAddServiceCount = make(map[int]struct{}) //增值服务类型数量
|
||||
if req.Language == msg.ZH_CN && req.SelectValueAddService != nil && len(req.SelectValueAddService) > 0 {
|
||||
for _, v := range req.SelectValueAddService {
|
||||
|
||||
detail, checkErr := dao.ValueAddServiceDetailByUuidAndLanguage(v.ValueAddUuid, req.Language)
|
||||
if checkErr != nil {
|
||||
if checkErr == gorm.ErrRecordNotFound {
|
||||
@ -116,22 +111,13 @@ func SaveBundle(req *bundle.BundleProfile) (res *bundle.SaveResponse, err error)
|
||||
return res, errors.New("查询增值服务失败")
|
||||
}
|
||||
}
|
||||
switch v.BenefitsType {
|
||||
case 1:
|
||||
if _, exists := pkgBenefitsValueAddServiceCount[int(detail.ServiceType)]; exists {
|
||||
return res, errors.New("每种增值服务类型只可选择一个")
|
||||
}
|
||||
pkgBenefitsValueAddServiceCount[int(detail.ServiceType)] = struct{}{}
|
||||
case 2:
|
||||
if _, exists := pkgOptionalValueAddServiceCount[int(detail.ServiceType)]; exists {
|
||||
return res, errors.New("每种增值服务类型只可选择一个")
|
||||
}
|
||||
pkgOptionalValueAddServiceCount[int(detail.ServiceType)] = struct{}{}
|
||||
if _, exists := selectValueAddServiceCount[int(detail.ServiceType)]; exists {
|
||||
return res, errors.New("每种增值服务类型只可选择一个")
|
||||
}
|
||||
selectValueAddServiceCount[int(detail.ServiceType)] = struct{}{}
|
||||
selectService = append(selectService, &model.BundleToValueAddService{
|
||||
ValueUid: v.ValueAddUuid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
BenefitsType: v.BenefitsType,
|
||||
ValueUid: v.ValueAddUuid,
|
||||
IsDisplay: v.IsDisplay,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -198,9 +198,6 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
Language: in.Language,
|
||||
PriceType: in.PriceType,
|
||||
Options: options,
|
||||
QuotaType: in.QuotaType,
|
||||
QuotaValue: in.QuotaValue,
|
||||
IsExpired: in.IsExpired,
|
||||
}
|
||||
if in.Uuid == "" && in.Language != msg.ZH_CN {
|
||||
return res, errors.New("请先创建中文版本增值服务")
|
||||
@ -262,9 +259,6 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
Language: lang,
|
||||
PriceType: valueAddServiceLang.PriceType,
|
||||
Options: valueAddServiceLang.Options,
|
||||
QuotaType: valueAddServiceLang.QuotaType,
|
||||
QuotaValue: valueAddServiceLang.QuotaValue,
|
||||
IsExpired: valueAddServiceLang.IsExpired,
|
||||
}
|
||||
otherLang.Language = lang
|
||||
if err = dao.CreateValueAddServiceLang(tx, &otherLang); err != nil {
|
||||
@ -303,9 +297,6 @@ func SaveValueAddService(in *bundle.ValueAddServiceLang) (res *bundle.SaveRespon
|
||||
"price_type": in.PriceType,
|
||||
"options": options,
|
||||
"language": in.Language,
|
||||
"quota_type": in.QuotaType,
|
||||
"quota_value": in.QuotaValue,
|
||||
"is_expired": in.IsExpired,
|
||||
}
|
||||
if err := dao.UpdateValueAddServiceLang(tx, updateLangService); err != nil {
|
||||
return res, errors.New("更新增值服务失败")
|
||||
@ -346,9 +337,6 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
||||
ServiceType: valueAddService.ServiceType,
|
||||
}
|
||||
for _, serviceLang := range valueAddService.ValueAddServiceLang {
|
||||
if serviceLang.QuotaType == 0 && serviceInfo.ServiceType != 5 && serviceInfo.ServiceType != 4 {
|
||||
serviceLang.QuotaType = 1
|
||||
}
|
||||
serviceLangInfo := &bundle.ValueAddServiceLang{
|
||||
Uuid: valueAddService.UUID,
|
||||
ServiceName: serviceLang.ServiceName,
|
||||
@ -360,14 +348,6 @@ func ValueAddServiceList(req *bundle.ValueAddServiceListRequest) (res *bundle.Va
|
||||
Language: serviceLang.Language,
|
||||
CreatedAt: time.Unix(serviceLang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: time.Unix(serviceLang.UpdatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
QuotaType: serviceLang.QuotaType,
|
||||
QuotaValue: serviceLang.QuotaValue,
|
||||
IsExpired: serviceLang.IsExpired,
|
||||
}
|
||||
if serviceLangInfo.Language == "zh-CN" && serviceInfo.ServiceType != 5 && serviceInfo.ServiceType != 4 {
|
||||
serviceInfo.QuotaType = serviceLangInfo.QuotaType
|
||||
serviceInfo.QuotaValue = serviceLangInfo.QuotaValue
|
||||
serviceInfo.IsExpired = serviceLangInfo.IsExpired
|
||||
}
|
||||
if len(serviceLang.Options) > 0 {
|
||||
var options []*bundle.ValueAddPriceOptions
|
||||
@ -465,9 +445,6 @@ func ValueAddServiceDetail(req *bundle.ValueAddServiceDetailRequest) (res *bundl
|
||||
Options: langOptions,
|
||||
CreatedAt: time.Unix(serviceLang.CreatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
UpdatedAt: time.Unix(serviceLang.UpdatedAt, 0).Format("2006-01-02 15:04:05"),
|
||||
QuotaType: serviceLang.QuotaType,
|
||||
QuotaValue: serviceLang.QuotaValue,
|
||||
IsExpired: serviceLang.IsExpired,
|
||||
}
|
||||
serviceLangs = append(serviceLangs, serviceLangInfo)
|
||||
}
|
||||
|
@ -49,7 +49,6 @@ type BundleToValueAddService struct {
|
||||
ValueUid string `json:"valueUid" gorm:"column:value_uid;type:varchar(1024);comment:增值服务UUID"`
|
||||
ValueAddService ValueAddService `gorm:"foreignKey:ValueUid;references:UUID" json:"valueAddService"`
|
||||
IsDisplay bool `json:"isDisplay" gorm:"column:is_display;type:tinyint(1);comment:是否显示"`
|
||||
BenefitsType int32 `json:"benefitsType" gorm:"column:benefits_type;type:int;comment:套餐权益类型 1:套餐权益 2:套餐可选附加权益"`
|
||||
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
||||
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
|
||||
DeletedAt soft_delete.DeletedAt
|
||||
|
@ -52,16 +52,13 @@ type ValueAddServiceLang struct {
|
||||
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:原单价"`
|
||||
TotalPrice float32 `json:"totalPrice" gorm:"column:total_price;type:decimal(12,2);comment:增值服务总价"`
|
||||
Unit string `json:"unit" gorm:"column:unit;type:varchar(50);comment:单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年"`
|
||||
Unit string `json:"unit" gorm:"column:unit;type:varchar(50);comment:单位 1:个 2:条 3:天 4:月 5:年"`
|
||||
Language string `json:"language" gorm:"column:language;type:varchar(32);comment:套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)"`
|
||||
PriceType int64 `json:"priceType" gorm:"column:price_type;type:int;comment:币种 1:人民币 2:美元 3:日元 4:欧元"`
|
||||
Options PriceOptions `gorm:"column:options;type:json" json:"options"`
|
||||
CreatedAt int64 `gorm:"column:created_at;autoCreateTime"`
|
||||
UpdatedAt int64 `gorm:"column:updated_at;autoCreateTime"`
|
||||
DeletedAt soft_delete.DeletedAt
|
||||
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:额度值"`
|
||||
IsExpired bool `json:"isExpired" gorm:"column:is_expired;default:false;comment:是否过期作废 false:不作废 true:作废"`
|
||||
}
|
||||
|
||||
type ValueAddServiceHistory struct {
|
||||
|
@ -285,10 +285,9 @@ message SaveResponse {
|
||||
}
|
||||
message SelectValueAddService {
|
||||
string valueAddUuid = 1 [json_name = "valueAddUuid"];
|
||||
string serviceName= 2 [json_name = "serviceName"];// 服务名称
|
||||
bool isDisplay = 3 [json_name = "isDisplay"];// 是否显示
|
||||
int32 serviceType = 4 [json_name = "serviceType"];// 服务类型
|
||||
int32 benefitsType = 5 [json_name = "benefitsType"]; //套餐权益类型 1:套餐权益 2:套餐可选附加权益
|
||||
string serviceName= 2 [json_name = "serviceName"];
|
||||
bool isDisplay = 3 [json_name = "isDisplay"];
|
||||
int32 serviceType = 4 [json_name = "serviceType"];
|
||||
|
||||
}
|
||||
message DelBundleRequest {
|
||||
@ -502,27 +501,21 @@ message FinancialConfirmationRequest {
|
||||
message ValueAddService {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
string serviceName = 2 [json_name = "serviceName"]; //服务名称
|
||||
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型
|
||||
repeated ValueAddServiceLang serviceLang = 4 [json_name = "serviceLang"]; //不太语言的服务详细
|
||||
int32 quotaType = 5 [json_name = "quotaType"];//额度类型
|
||||
int32 quotaValue = 6 [json_name = "quotaValue"];//额度值
|
||||
bool isExpired = 7 [json_name = "isExpired"];//是否过期作废
|
||||
int32 serviceType = 3 [json_name = "serviceType"];
|
||||
repeated ValueAddServiceLang serviceLang = 4 [json_name = "serviceLang"];
|
||||
}
|
||||
message ValueAddServiceLang {
|
||||
string uuid = 1 [json_name = "uuid"];
|
||||
string serviceName = 2 [json_name = "serviceName"]; //服务名称
|
||||
int32 serviceType = 3 [json_name = "serviceType"]; //服务类型 1:视频 2:图文 3:数据报表 4:账号数 5:可用时长
|
||||
int32 priceMode = 4 [json_name = "priceMode"]; //套餐价格类型 1:单价 2:总价
|
||||
string originalPrice = 5 [json_name = "originalPrice"];//原单价
|
||||
string unit = 6 [json_name = "unit"];//单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年
|
||||
int64 priceType = 7 [json_name = "priceType"];//币种 1:人民币 2:美元 3:日元 4:欧元
|
||||
string language = 8 [json_name = "language"];//套餐语言 zh-CN zh-TW EN de-DE ja-JP(中繁英德日)
|
||||
int32 serviceType = 3 [json_name = "serviceType"];
|
||||
int32 priceMode = 4 [json_name = "priceMode"];
|
||||
string originalPrice = 5 [json_name = "originalPrice"];
|
||||
string unit = 6 [json_name = "unit"];
|
||||
int64 priceType = 7 [json_name = "priceType"];
|
||||
string language = 8 [json_name = "language"];
|
||||
string createdAt = 9 [json_name = "createdAt"];
|
||||
string updatedAt = 10 [json_name = "updatedAt"];
|
||||
repeated ValueAddPriceOptions options = 11 [json_name = "options"];
|
||||
int32 quotaType = 12 [json_name = "quotaType"]; //额度类型 0;不限额度 1:每天限额度 2:每月限额度 3:每季度限额度 4:每半年限额度 5:每年限额度
|
||||
int32 quotaValue = 13 [json_name = "quotaValue"]; //额度值
|
||||
bool isExpired = 14 [json_name = "isExpired"]; //是否过期作废 false:不作废 true:作废
|
||||
repeated ValueAddPriceOptions options = 12 [json_name = "options"];
|
||||
}
|
||||
//增值服务价格选项
|
||||
message ValueAddPriceOptions {
|
||||
@ -537,9 +530,8 @@ message ValueAddPriceOptions {
|
||||
message ValueAddServiceListRequest {
|
||||
int32 page = 1 [json_name = "page"];
|
||||
int32 pageSize = 2 [json_name = "pageSize"];
|
||||
string name = 3 [json_name = "name"]; // 服务名称
|
||||
int32 serviceType = 4 [json_name = "serviceType"]; // 服务类型
|
||||
string language = 5 [json_name = "language"]; // 语言(历史遗留,暂未使用)
|
||||
string name = 3 [json_name = "name"];
|
||||
string language = 4 [json_name = "language"];
|
||||
}
|
||||
message ValueAddServiceListResponse {
|
||||
int32 total = 1 [json_name = "total"];
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-triple v1.0.5
|
||||
// - protoc v5.26.0
|
||||
// - protoc v6.32.0
|
||||
// source: pb/bundle.proto
|
||||
|
||||
package bundle
|
||||
|
@ -1,3 +0,0 @@
|
||||
@echo off
|
||||
protoc -I . -I ./pb --proto_path=./pb --go_out=./pb --go-triple_out=./pb --govalidators_out=./pb ./pb/bundle.proto
|
||||
.\clear.sh
|
Loading…
Reference in New Issue
Block a user