1、会员套餐管理
2、会员续费记录 3、通用字典
This commit is contained in:
@ -1,12 +1,13 @@
|
||||
package apis
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
|
||||
_ "github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
||||
"go-admin/app/admin/models"
|
||||
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/app/admin/service/dto"
|
||||
@ -216,5 +217,5 @@ func (e SysDictData) GetAll(c *gin.Context) {
|
||||
l = append(l, d)
|
||||
}
|
||||
|
||||
e.OK(l,"查询成功")
|
||||
e.OK(l, "查询成功")
|
||||
}
|
||||
|
||||
32
app/admin/fronted/member_renwal_log.go
Normal file
32
app/admin/fronted/member_renwal_log.go
Normal file
@ -0,0 +1,32 @@
|
||||
package fronted
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/service/appservice"
|
||||
"go-admin/app/admin/service/common"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/service/sysservice/sysstatuscode"
|
||||
statuscode "go-admin/common/status_code"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
)
|
||||
|
||||
type MemberRenwalLog struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// 分页查询
|
||||
func (e MemberRenwalLog) GetPage(c *gin.Context) {
|
||||
s := appservice.MemberRenwalLog{}
|
||||
req := dto.MemberRenwalLogPageAppReq{}
|
||||
|
||||
userId := common.GetUserId(c)
|
||||
data := make([]dto.MemberRenwalLogResp, 0)
|
||||
code := s.GetPage(userId, &req, &data)
|
||||
|
||||
if code != statuscode.OK {
|
||||
e.Error(code, nil, sysstatuscode.GetStatusCodeDescription(c, code))
|
||||
}
|
||||
|
||||
e.OK(data, "success")
|
||||
}
|
||||
45
app/admin/fronted/sys_dict.go
Normal file
45
app/admin/fronted/sys_dict.go
Normal file
@ -0,0 +1,45 @@
|
||||
package fronted
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/service/sysservice/sysstatuscode"
|
||||
statuscode "go-admin/common/status_code"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
)
|
||||
|
||||
type SysDict struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// 获取详情
|
||||
func (e SysDict) Get(c *gin.Context) {
|
||||
|
||||
}
|
||||
|
||||
// 获取字典数据列表
|
||||
func (e SysDict) GetChild(c *gin.Context) {
|
||||
req := dto.SysDictChildAppReq{}
|
||||
s := service.SysDictType{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
|
||||
if err != nil {
|
||||
e.Error(500, nil, err.Error())
|
||||
}
|
||||
|
||||
list := make([]dto.SysDictDataResp, 0)
|
||||
|
||||
code := s.GetChild(&req, &list)
|
||||
|
||||
if code != statuscode.OK {
|
||||
e.Error(code, nil, sysstatuscode.GetStatusCodeDescription(c, code))
|
||||
}
|
||||
|
||||
e.OK(list, "success")
|
||||
}
|
||||
@ -12,10 +12,12 @@ type MemberRenwalConfig struct {
|
||||
PackageName string `json:"packageName" gorm:"type:varchar(255);comment:套餐名称"`
|
||||
DurationDay int `json:"durationDay" gorm:"type:int;comment:续期时间(天)"`
|
||||
OriginalPrice decimal.Decimal `json:"originalPrice" gorm:"type:decimal(18,6);comment:原始单价"`
|
||||
DiscountPrice decimal.Decimal `json:"discountPrice" gorm:"type:decimal(18,6);comment:折扣价格"`
|
||||
DiscountPrice decimal.Decimal `json:"discountPrice" gorm:"type:decimal(18,6);comment:折扣价格 -1为未设置"`
|
||||
IsDefault int `json:"isDefault" gorm:"type:int;comment:是否默认套餐 0-无 1-是 2-否"`
|
||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"`
|
||||
Status string `json:"status" gorm:"type:varchar(255);comment:套餐状态(字典 rewal_status)"`
|
||||
IsVisible int `json:"isVisible" gorm:"type:int;comment:是否显示 2-否 1-是"`
|
||||
Sort int `json:"sort" gorm:"type:int;comment:排序 顺序"`
|
||||
models.ModelTime
|
||||
models.ControlBy
|
||||
}
|
||||
|
||||
@ -5,11 +5,13 @@ import (
|
||||
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
|
||||
|
||||
"go-admin/app/admin/apis"
|
||||
"go-admin/common/middleware"
|
||||
"go-admin/app/admin/fronted"
|
||||
"go-admin/common/actions"
|
||||
"go-admin/common/middleware"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerFrontedCheckRole = append(routerFrontedCheckRole, registerFrontedMemberRenwalConfigRouter)
|
||||
routerCheckRole = append(routerCheckRole, registerMemberRenwalConfigRouter)
|
||||
}
|
||||
|
||||
@ -24,4 +26,12 @@ func registerMemberRenwalConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.G
|
||||
r.PUT("/:id", actions.PermissionAction(), api.Update)
|
||||
r.DELETE("", api.Delete)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func registerFrontedMemberRenwalConfigRouter(v1 *gin.RouterGroup) {
|
||||
api := fronted.MemberRenwalConfig{}
|
||||
r := v1.Group("/member-renwal-config")
|
||||
{
|
||||
r.GET("list", api.GetActiveList)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/apis"
|
||||
"go-admin/app/admin/fronted"
|
||||
"go-admin/common/middleware"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
|
||||
"go-admin/app/admin/apis"
|
||||
"go-admin/common/middleware"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerDictRouter)
|
||||
routerNoCheckRole = append(routerNoCheckRole, registerNoCheckDictRouter)
|
||||
}
|
||||
|
||||
func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
@ -35,3 +38,12 @@ func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar
|
||||
opSelect.GET("/option-select", dataApi.GetAll)
|
||||
}
|
||||
}
|
||||
|
||||
func registerNoCheckDictRouter(v1 *gin.RouterGroup) {
|
||||
//dictApi := apis.SysDictType{}
|
||||
dataApi := fronted.SysDict{}
|
||||
dicts := v1.Group("/dict")
|
||||
{
|
||||
dicts.GET("/child", dataApi.GetChild)
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,8 @@ package appservice
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
memberrenwalconfigstatus "go-admin/common/const/dicts/member_renwal_config_status"
|
||||
memberrenwalisvisible "go-admin/common/const/dicts/member_renwal_isvisible"
|
||||
statuscode "go-admin/common/status_code"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk/service"
|
||||
@ -13,6 +15,8 @@ type MemberRenwalConfigAppService struct {
|
||||
|
||||
func (e *MemberRenwalConfigAppService) GetList() ([]models.MemberRenwalConfig, int) {
|
||||
result := make([]models.MemberRenwalConfig, 0)
|
||||
|
||||
if err := e.Orm.Model(&models.MemberRenwalConfig{}).Where(" status =? AND is_visible =?", memberrenwalconfigstatus.ENABLE, memberrenwalisvisible.IsVisibleYes).Order("sort asc").Find(&result).Error; err != nil {
|
||||
return result, statuscode.ServerError
|
||||
}
|
||||
return result, statuscode.OK
|
||||
}
|
||||
|
||||
42
app/admin/service/appservice/member_renwal_log.go
Normal file
42
app/admin/service/appservice/member_renwal_log.go
Normal file
@ -0,0 +1,42 @@
|
||||
package appservice
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/service/dto"
|
||||
cDto "go-admin/common/dto"
|
||||
statuscode "go-admin/common/status_code"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk/service"
|
||||
"github.com/jinzhu/copier"
|
||||
)
|
||||
|
||||
type MemberRenwalLog struct {
|
||||
service.Service
|
||||
}
|
||||
|
||||
// 分页查询续期记录
|
||||
func (e *MemberRenwalLog) GetPage(userId int, req *dto.MemberRenwalLogPageAppReq, list *[]dto.MemberRenwalLogResp) int {
|
||||
var count int64
|
||||
var data models.MemberRenwaLog
|
||||
resp := dto.MemberRenwalLogResp{}
|
||||
|
||||
err := e.Orm.Model(&data).
|
||||
Where("user_id = ?", userId).
|
||||
Scopes(
|
||||
cDto.Paginate(req.GetPageSize(), req.GetPageIndex()),
|
||||
).
|
||||
Find(list).Limit(-1).Offset(-1).
|
||||
Count(&count).Error
|
||||
|
||||
if err != nil {
|
||||
return statuscode.ServerError
|
||||
}
|
||||
|
||||
for _, item := range *list {
|
||||
copier.Copy(&resp, item)
|
||||
|
||||
*list = append(*list, resp)
|
||||
}
|
||||
|
||||
return statuscode.OK
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"time"
|
||||
"time"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/common/dto"
|
||||
@ -9,27 +9,42 @@ import (
|
||||
)
|
||||
|
||||
type MemberRenwaLogGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
MemberRenwaLogOrder
|
||||
dto.Pagination `search:"-"`
|
||||
MemberRenwaLogOrder
|
||||
}
|
||||
|
||||
type MemberRenwalLogPageAppReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
}
|
||||
|
||||
type MemberRenwalLogResp struct {
|
||||
Id int `json:"id"`
|
||||
RenwalName string `json:"renwalName" comment:"续期套餐名称"`
|
||||
RenwalDuration string `json:"renwalDuration" comment:"续期时长(天数)"`
|
||||
Status string `json:"status" comment:"订单状态(member_renwal_log_status)"`
|
||||
PayableAmount string `json:"payableAmount" comment:"应付金额"`
|
||||
ActualPaymentAmount string `json:"actualPaymentAmount" comment:"实付金额"`
|
||||
FromAddress string `json:"fromAddress" comment:"付款地址"`
|
||||
Coin string `json:"coin" comment:"代币"`
|
||||
PaymentTime time.Time `json:"paymentTime" comment:"支付时间"`
|
||||
}
|
||||
|
||||
type MemberRenwaLogOrder struct {
|
||||
Id string `form:"idOrder" search:"type:order;column:id;table:member_renwa_log"`
|
||||
RenwalId string `form:"renwalIdOrder" search:"type:order;column:renwal_id;table:member_renwa_log"`
|
||||
RenwalName string `form:"renwalNameOrder" search:"type:order;column:renwal_name;table:member_renwa_log"`
|
||||
RenwalDuration string `form:"renwalDurationOrder" search:"type:order;column:renwal_duration;table:member_renwa_log"`
|
||||
Status string `form:"statusOrder" search:"type:order;column:status;table:member_renwa_log"`
|
||||
PayableAmount string `form:"payableAmountOrder" search:"type:order;column:payable_amount;table:member_renwa_log"`
|
||||
ActualPaymentAmount string `form:"actualPaymentAmountOrder" search:"type:order;column:actual_payment_amount;table:member_renwa_log"`
|
||||
FromAddress string `form:"fromAddressOrder" search:"type:order;column:from_address;table:member_renwa_log"`
|
||||
Coin string `form:"coinOrder" search:"type:order;column:coin;table:member_renwa_log"`
|
||||
PaymentTime string `form:"paymentTimeOrder" search:"type:order;column:payment_time;table:member_renwa_log"`
|
||||
CreatedAt string `form:"createdAtOrder" search:"type:order;column:created_at;table:member_renwa_log"`
|
||||
UpdatedAt string `form:"updatedAtOrder" search:"type:order;column:updated_at;table:member_renwa_log"`
|
||||
DeletedAt string `form:"deletedAtOrder" search:"type:order;column:deleted_at;table:member_renwa_log"`
|
||||
CreateBy string `form:"createByOrder" search:"type:order;column:create_by;table:member_renwa_log"`
|
||||
UpdateBy string `form:"updateByOrder" search:"type:order;column:update_by;table:member_renwa_log"`
|
||||
|
||||
Id string `form:"idOrder" search:"type:order;column:id;table:member_renwa_log"`
|
||||
RenwalId string `form:"renwalIdOrder" search:"type:order;column:renwal_id;table:member_renwa_log"`
|
||||
RenwalName string `form:"renwalNameOrder" search:"type:order;column:renwal_name;table:member_renwa_log"`
|
||||
RenwalDuration string `form:"renwalDurationOrder" search:"type:order;column:renwal_duration;table:member_renwa_log"`
|
||||
Status string `form:"statusOrder" search:"type:order;column:status;table:member_renwa_log"`
|
||||
PayableAmount string `form:"payableAmountOrder" search:"type:order;column:payable_amount;table:member_renwa_log"`
|
||||
ActualPaymentAmount string `form:"actualPaymentAmountOrder" search:"type:order;column:actual_payment_amount;table:member_renwa_log"`
|
||||
FromAddress string `form:"fromAddressOrder" search:"type:order;column:from_address;table:member_renwa_log"`
|
||||
Coin string `form:"coinOrder" search:"type:order;column:coin;table:member_renwa_log"`
|
||||
PaymentTime string `form:"paymentTimeOrder" search:"type:order;column:payment_time;table:member_renwa_log"`
|
||||
CreatedAt string `form:"createdAtOrder" search:"type:order;column:created_at;table:member_renwa_log"`
|
||||
UpdatedAt string `form:"updatedAtOrder" search:"type:order;column:updated_at;table:member_renwa_log"`
|
||||
DeletedAt string `form:"deletedAtOrder" search:"type:order;column:deleted_at;table:member_renwa_log"`
|
||||
CreateBy string `form:"createByOrder" search:"type:order;column:create_by;table:member_renwa_log"`
|
||||
UpdateBy string `form:"updateByOrder" search:"type:order;column:update_by;table:member_renwa_log"`
|
||||
}
|
||||
|
||||
func (m *MemberRenwaLogGetPageReq) GetNeedSearch() interface{} {
|
||||
@ -37,33 +52,33 @@ func (m *MemberRenwaLogGetPageReq) GetNeedSearch() interface{} {
|
||||
}
|
||||
|
||||
type MemberRenwaLogInsertReq struct {
|
||||
Id int `json:"-" comment:"主键"` // 主键
|
||||
RenwalId string `json:"renwalId" comment:"套餐id"`
|
||||
RenwalName string `json:"renwalName" comment:"续期套餐名称"`
|
||||
RenwalDuration string `json:"renwalDuration" comment:"续期时长(天数)"`
|
||||
Status string `json:"status" comment:"订单状态(member_renwal_log_status)"`
|
||||
PayableAmount string `json:"payableAmount" comment:"应付金额"`
|
||||
ActualPaymentAmount string `json:"actualPaymentAmount" comment:"实付金额"`
|
||||
FromAddress string `json:"fromAddress" comment:"付款地址"`
|
||||
Coin string `json:"coin" comment:"代币"`
|
||||
PaymentTime time.Time `json:"paymentTime" comment:"支付时间"`
|
||||
common.ControlBy
|
||||
Id int `json:"-" comment:"主键"` // 主键
|
||||
RenwalId string `json:"renwalId" comment:"套餐id"`
|
||||
RenwalName string `json:"renwalName" comment:"续期套餐名称"`
|
||||
RenwalDuration string `json:"renwalDuration" comment:"续期时长(天数)"`
|
||||
Status string `json:"status" comment:"订单状态(member_renwal_log_status)"`
|
||||
PayableAmount string `json:"payableAmount" comment:"应付金额"`
|
||||
ActualPaymentAmount string `json:"actualPaymentAmount" comment:"实付金额"`
|
||||
FromAddress string `json:"fromAddress" comment:"付款地址"`
|
||||
Coin string `json:"coin" comment:"代币"`
|
||||
PaymentTime time.Time `json:"paymentTime" comment:"支付时间"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *MemberRenwaLogInsertReq) Generate(model *models.MemberRenwaLog) {
|
||||
if s.Id == 0 {
|
||||
model.Model = common.Model{ Id: s.Id }
|
||||
}
|
||||
model.RenwalId = s.RenwalId
|
||||
model.RenwalName = s.RenwalName
|
||||
model.RenwalDuration = s.RenwalDuration
|
||||
model.Status = s.Status
|
||||
model.PayableAmount = s.PayableAmount
|
||||
model.ActualPaymentAmount = s.ActualPaymentAmount
|
||||
model.FromAddress = s.FromAddress
|
||||
model.Coin = s.Coin
|
||||
model.PaymentTime = s.PaymentTime
|
||||
model.CreateBy = s.CreateBy // 添加这而,需要记录是被谁创建的
|
||||
func (s *MemberRenwaLogInsertReq) Generate(model *models.MemberRenwaLog) {
|
||||
if s.Id == 0 {
|
||||
model.Model = common.Model{Id: s.Id}
|
||||
}
|
||||
model.RenwalId = s.RenwalId
|
||||
model.RenwalName = s.RenwalName
|
||||
model.RenwalDuration = s.RenwalDuration
|
||||
model.Status = s.Status
|
||||
model.PayableAmount = s.PayableAmount
|
||||
model.ActualPaymentAmount = s.ActualPaymentAmount
|
||||
model.FromAddress = s.FromAddress
|
||||
model.Coin = s.Coin
|
||||
model.PaymentTime = s.PaymentTime
|
||||
model.CreateBy = s.CreateBy // 添加这而,需要记录是被谁创建的
|
||||
}
|
||||
|
||||
func (s *MemberRenwaLogInsertReq) GetId() interface{} {
|
||||
@ -71,33 +86,33 @@ func (s *MemberRenwaLogInsertReq) GetId() interface{} {
|
||||
}
|
||||
|
||||
type MemberRenwaLogUpdateReq struct {
|
||||
Id int `uri:"id" comment:"主键"` // 主键
|
||||
RenwalId string `json:"renwalId" comment:"套餐id"`
|
||||
RenwalName string `json:"renwalName" comment:"续期套餐名称"`
|
||||
RenwalDuration string `json:"renwalDuration" comment:"续期时长(天数)"`
|
||||
Status string `json:"status" comment:"订单状态(member_renwal_log_status)"`
|
||||
PayableAmount string `json:"payableAmount" comment:"应付金额"`
|
||||
ActualPaymentAmount string `json:"actualPaymentAmount" comment:"实付金额"`
|
||||
FromAddress string `json:"fromAddress" comment:"付款地址"`
|
||||
Coin string `json:"coin" comment:"代币"`
|
||||
PaymentTime time.Time `json:"paymentTime" comment:"支付时间"`
|
||||
common.ControlBy
|
||||
Id int `uri:"id" comment:"主键"` // 主键
|
||||
RenwalId string `json:"renwalId" comment:"套餐id"`
|
||||
RenwalName string `json:"renwalName" comment:"续期套餐名称"`
|
||||
RenwalDuration string `json:"renwalDuration" comment:"续期时长(天数)"`
|
||||
Status string `json:"status" comment:"订单状态(member_renwal_log_status)"`
|
||||
PayableAmount string `json:"payableAmount" comment:"应付金额"`
|
||||
ActualPaymentAmount string `json:"actualPaymentAmount" comment:"实付金额"`
|
||||
FromAddress string `json:"fromAddress" comment:"付款地址"`
|
||||
Coin string `json:"coin" comment:"代币"`
|
||||
PaymentTime time.Time `json:"paymentTime" comment:"支付时间"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
func (s *MemberRenwaLogUpdateReq) Generate(model *models.MemberRenwaLog) {
|
||||
if s.Id == 0 {
|
||||
model.Model = common.Model{ Id: s.Id }
|
||||
}
|
||||
model.RenwalId = s.RenwalId
|
||||
model.RenwalName = s.RenwalName
|
||||
model.RenwalDuration = s.RenwalDuration
|
||||
model.Status = s.Status
|
||||
model.PayableAmount = s.PayableAmount
|
||||
model.ActualPaymentAmount = s.ActualPaymentAmount
|
||||
model.FromAddress = s.FromAddress
|
||||
model.Coin = s.Coin
|
||||
model.PaymentTime = s.PaymentTime
|
||||
model.UpdateBy = s.UpdateBy // 添加这而,需要记录是被谁更新的
|
||||
func (s *MemberRenwaLogUpdateReq) Generate(model *models.MemberRenwaLog) {
|
||||
if s.Id == 0 {
|
||||
model.Model = common.Model{Id: s.Id}
|
||||
}
|
||||
model.RenwalId = s.RenwalId
|
||||
model.RenwalName = s.RenwalName
|
||||
model.RenwalDuration = s.RenwalDuration
|
||||
model.Status = s.Status
|
||||
model.PayableAmount = s.PayableAmount
|
||||
model.ActualPaymentAmount = s.ActualPaymentAmount
|
||||
model.FromAddress = s.FromAddress
|
||||
model.Coin = s.Coin
|
||||
model.PaymentTime = s.PaymentTime
|
||||
model.UpdateBy = s.UpdateBy // 添加这而,需要记录是被谁更新的
|
||||
}
|
||||
|
||||
func (s *MemberRenwaLogUpdateReq) GetId() interface{} {
|
||||
@ -106,8 +121,9 @@ func (s *MemberRenwaLogUpdateReq) GetId() interface{} {
|
||||
|
||||
// MemberRenwaLogGetReq 功能获取请求参数
|
||||
type MemberRenwaLogGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
func (s *MemberRenwaLogGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
@ -10,13 +10,14 @@ import (
|
||||
|
||||
type MemberRenwalConfigGetPageReq struct {
|
||||
dto.Pagination `search:"-"`
|
||||
PackageName string `form:"packageName" search:"type:exact;column:package_name;table:member_renwal_config" comment:"套餐名称"`
|
||||
PackageName string `form:"packageName" search:"type:contains;column:package_name;table:member_renwal_config" comment:"套餐名称"`
|
||||
Status string `form:"status" search:"type:exact;column:status;table:member_renwal_config" comment:"套餐状态(字典 rewal_status)"`
|
||||
MemberRenwalConfigOrder
|
||||
}
|
||||
|
||||
type MemberRenwalConfigOrder struct {
|
||||
Id string `form:"idOrder" search:"type:order;column:id;table:member_renwal_config"`
|
||||
Sort string `form:"sortOrder" search:"type:order;column:sort;table:member_renwal_config"`
|
||||
PackageName string `form:"packageNameOrder" search:"type:order;column:package_name;table:member_renwal_config"`
|
||||
DurationDay string `form:"durationDayOrder" search:"type:order;column:duration_day;table:member_renwal_config"`
|
||||
OriginalPrice string `form:"originalPriceOrder" search:"type:order;column:original_price;table:member_renwal_config"`
|
||||
@ -35,14 +36,16 @@ func (m *MemberRenwalConfigGetPageReq) GetNeedSearch() interface{} {
|
||||
}
|
||||
|
||||
type MemberRenwalConfigInsertReq struct {
|
||||
Id int `json:"-" comment:"主键"` // 主键
|
||||
PackageName string `json:"packageName" comment:"套餐名称"`
|
||||
DurationDay int `json:"durationDay" comment:"续期时间(天)"`
|
||||
OriginalPrice decimal.Decimal `json:"originalPrice" comment:"原始单价"`
|
||||
DiscountPrice decimal.Decimal `json:"discountPrice" comment:"折扣价格"`
|
||||
IsDefault int `json:"isDefault" comment:"是否默认套餐 0-无 1-是 2-否"`
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
Status string `json:"status" comment:"套餐状态(字典 rewal_status)"`
|
||||
Id int `json:"-" comment:"主键"` // 主键
|
||||
PackageName string `json:"packageName" comment:"套餐名称"`
|
||||
DurationDay int `json:"durationDay" comment:"续期时间(天)"`
|
||||
OriginalPrice decimal.Decimal `json:"originalPrice" comment:"原始单价"`
|
||||
DiscountPrice *decimal.Decimal `json:"discountPrice" comment:"折扣价格 -1为未设置"`
|
||||
IsDefault int `json:"isDefault" comment:"是否默认套餐 0-无 1-是 2-否"`
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
Status string `json:"status" comment:"套餐状态(字典 rewal_status)"`
|
||||
IsVisible int `json:"isVisible" comment:"是否可见 2-不可见 1-可见"`
|
||||
Sort int `json:"sort" comment:"排序"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
@ -53,10 +56,17 @@ func (s *MemberRenwalConfigInsertReq) Generate(model *models.MemberRenwalConfig)
|
||||
model.PackageName = s.PackageName
|
||||
model.DurationDay = s.DurationDay
|
||||
model.OriginalPrice = s.OriginalPrice
|
||||
model.DiscountPrice = s.DiscountPrice
|
||||
|
||||
if s.DiscountPrice == nil {
|
||||
model.DiscountPrice = decimal.NewFromInt(-1)
|
||||
} else {
|
||||
model.DiscountPrice = *s.DiscountPrice
|
||||
}
|
||||
model.IsDefault = s.IsDefault
|
||||
model.Remark = s.Remark
|
||||
model.Status = s.Status
|
||||
model.IsVisible = s.IsVisible
|
||||
model.Sort = s.Sort
|
||||
model.CreateBy = s.CreateBy // 添加这而,需要记录是被谁创建的
|
||||
}
|
||||
|
||||
@ -65,14 +75,16 @@ func (s *MemberRenwalConfigInsertReq) GetId() interface{} {
|
||||
}
|
||||
|
||||
type MemberRenwalConfigUpdateReq struct {
|
||||
Id int `uri:"id" comment:"主键"` // 主键
|
||||
PackageName string `json:"packageName" comment:"套餐名称"`
|
||||
DurationDay int `json:"durationDay" comment:"续期时间(天)"`
|
||||
OriginalPrice decimal.Decimal `json:"originalPrice" comment:"原始单价"`
|
||||
DiscountPrice decimal.Decimal `json:"discountPrice" comment:"折扣价格"`
|
||||
IsDefault int `json:"isDefault" comment:"是否默认套餐 0-无 1-是 2-否"`
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
Status string `json:"status" comment:"套餐状态(字典 rewal_status)"`
|
||||
Id int `uri:"id" comment:"主键"` // 主键
|
||||
PackageName string `json:"packageName" comment:"套餐名称"`
|
||||
DurationDay int `json:"durationDay" comment:"续期时间(天)"`
|
||||
OriginalPrice decimal.Decimal `json:"originalPrice" comment:"原始单价"`
|
||||
DiscountPrice *decimal.Decimal `json:"discountPrice" comment:"折扣价格 -1为未设置"`
|
||||
IsDefault int `json:"isDefault" comment:"是否默认套餐 0-无 1-是 2-否"`
|
||||
Remark string `json:"remark" comment:"备注"`
|
||||
Status string `json:"status" comment:"套餐状态(字典 rewal_status)"`
|
||||
IsVisible int `json:"isVisible" comment:"是否可见 2-不可见 1-可见"`
|
||||
Sort int `json:"sort" comment:"排序"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
@ -83,10 +95,17 @@ func (s *MemberRenwalConfigUpdateReq) Generate(model *models.MemberRenwalConfig)
|
||||
model.PackageName = s.PackageName
|
||||
model.DurationDay = s.DurationDay
|
||||
model.OriginalPrice = s.OriginalPrice
|
||||
model.DiscountPrice = s.DiscountPrice
|
||||
|
||||
if s.DiscountPrice == nil {
|
||||
model.DiscountPrice = decimal.NewFromInt(-1)
|
||||
} else {
|
||||
model.DiscountPrice = *s.DiscountPrice
|
||||
}
|
||||
model.IsDefault = s.IsDefault
|
||||
model.Status = s.Status
|
||||
model.Remark = s.Remark
|
||||
model.IsVisible = s.IsVisible
|
||||
model.Sort = s.Sort
|
||||
model.UpdateBy = s.UpdateBy // 添加这而,需要记录是被谁更新的
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,18 @@ type SysDictDataGetAllResp struct {
|
||||
DictValue string `json:"value"`
|
||||
}
|
||||
|
||||
type SysDictDataResp struct {
|
||||
DictSort int `json:"dictSort" comment:""`
|
||||
DictLabel string `json:"dictLabel" comment:""`
|
||||
DictValue string `json:"dictValue" comment:""`
|
||||
DictType string `json:"dictType" comment:""`
|
||||
CssClass string `json:"cssClass" comment:""`
|
||||
ListClass string `json:"listClass" comment:""`
|
||||
IsDefault string `json:"isDefault" comment:""`
|
||||
Status int `json:"status" comment:""`
|
||||
Default string `json:"default" comment:""`
|
||||
Remark string `json:"remark" comment:""`
|
||||
}
|
||||
type SysDictDataInsertReq struct {
|
||||
Id int `json:"-" comment:""`
|
||||
DictSort int `json:"dictSort" comment:""`
|
||||
|
||||
@ -23,6 +23,23 @@ func (m *SysDictTypeGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
type SysDictChildAppReq struct {
|
||||
DictCode string `json:"dictCode" form:"dictCode"`
|
||||
// DataCode string `json:"dataCode" form:"dataCode"`
|
||||
}
|
||||
|
||||
type SysDictDataAppReq struct {
|
||||
DictCode string `json:"dictCode" form:"dictCode"`
|
||||
DataCode string `json:"dataCode" form:"dataCode"`
|
||||
}
|
||||
|
||||
type SysDictTypeResp struct {
|
||||
DictName string `json:"dictName"`
|
||||
DictType string `json:"dictType"`
|
||||
Status int `json:"status"`
|
||||
Remark string `json:"remark"`
|
||||
}
|
||||
|
||||
type SysDictTypeInsertReq struct {
|
||||
Id int `uri:"id"`
|
||||
DictName string `json:"dictName"`
|
||||
|
||||
@ -10,6 +10,7 @@ import (
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/service/dto"
|
||||
cDto "go-admin/common/dto"
|
||||
statuscode "go-admin/common/status_code"
|
||||
)
|
||||
|
||||
type SysDictType struct {
|
||||
@ -122,3 +123,23 @@ func (e *SysDictType) GetAll(c *dto.SysDictTypeGetPageReq, list *[]models.SysDic
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取所有子类
|
||||
func (e *SysDictType) GetChild(req *dto.SysDictChildAppReq, list *[]dto.SysDictDataResp) int {
|
||||
datas := make([]models.SysDictData, 0)
|
||||
|
||||
if err := e.Orm.Model(&models.SysDictData{}).Where("dict_type =?", req.DictCode).Find(&datas).Error; err != nil {
|
||||
return statuscode.ServerError
|
||||
}
|
||||
|
||||
for _, v := range datas {
|
||||
*list = append(*list, dto.SysDictDataResp{
|
||||
DictLabel: v.DictLabel,
|
||||
DictValue: v.DictValue,
|
||||
Remark: v.Remark,
|
||||
Status: v.Status,
|
||||
})
|
||||
}
|
||||
|
||||
return statuscode.OK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user