Compare commits

...

9 Commits

Author SHA1 Message Date
jiaji.H
2461bb8a93 feat:修改服务列表额度字段逻辑 2025-09-09 10:59:23 +08:00
jiaji.H
2280cc40d9 Updata:更新数据库字段定义 2025-09-09 09:26:21 +08:00
jiaji.H
7741a5dc35 Updata:不在定义内的额度信息 2025-09-04 13:25:52 +08:00
jiaji.H
04b4b3f7c5 Updata:去除不必要err 2025-09-04 11:55:50 +08:00
jiaji.H
4b999f57c4 Updata:更新pb文件 2025-09-04 11:34:13 +08:00
jiaji.H
1624992428 Updata:添加需求字段赋值 2025-09-03 16:29:36 +08:00
jiaji.H
c1e1ef5e0f Updata:补充筛选逻辑 2025-09-03 15:57:56 +08:00
jiaji.H
1c148b0078 feat:增加对增值服务的名称和类型筛选以及额度字段和是否过期作废字段展示 2025-09-03 15:21:02 +08:00
jiaji.H
0c7f70af93 feat:增加额度对应需求字段 2025-09-03 11:33:05 +08:00
9 changed files with 4110 additions and 1892 deletions

33
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,33 @@
{
// 使 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 Normal file
View File

@ -0,0 +1,22 @@
{
"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"
}

View File

@ -115,10 +115,28 @@ 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").
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")
})
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")
})
count := *query
if req.PageSize != 0 && req.Page != 0 {

View File

@ -198,6 +198,9 @@ 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("请先创建中文版本增值服务")
@ -259,6 +262,9 @@ 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 {
@ -297,6 +303,9 @@ 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("更新增值服务失败")
@ -337,6 +346,9 @@ 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,
@ -348,6 +360,14 @@ 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
@ -445,6 +465,9 @@ 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)
}

View File

@ -52,13 +52,16 @@ 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:年"`
Unit string `json:"unit" gorm:"column:unit;type:varchar(50);comment:单位 1:个 2:条 3:天 4:月 5:年 6:自然月 7:自然季度 8:半年 9:自然年"`
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 {

View File

@ -501,21 +501,27 @@ 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 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"];//
}
message ValueAddServiceLang {
string uuid = 1 [json_name = "uuid"];
string serviceName = 2 [json_name = "serviceName"]; //
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"];
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()
string createdAt = 9 [json_name = "createdAt"];
string updatedAt = 10 [json_name = "updatedAt"];
repeated ValueAddPriceOptions options = 12 [json_name = "options"];
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
}
//
message ValueAddPriceOptions {
@ -530,8 +536,9 @@ message ValueAddPriceOptions {
message ValueAddServiceListRequest {
int32 page = 1 [json_name = "page"];
int32 pageSize = 2 [json_name = "pageSize"];
string name = 3 [json_name = "name"];
string language = 4 [json_name = "language"];
string name = 3 [json_name = "name"]; //
int32 serviceType = 4 [json_name = "serviceType"]; //
string language = 5 [json_name = "language"]; // (使)
}
message ValueAddServiceListResponse {
int32 total = 1 [json_name = "total"];

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go-triple. DO NOT EDIT.
// versions:
// - protoc-gen-go-triple v1.0.5
// - protoc v6.32.0
// - protoc v4.22.0
// source: pb/bundle.proto
package bundle

3
protocBundle.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
protoc -I . -I ./pb --proto_path=./pb --go_out=./pb --go-triple_out=./pb --govalidators_out=./pb ./pb/bundle.proto
.\clear.sh