This commit is contained in:
2024-08-26 17:20:13 +08:00
commit 51090658a2
39 changed files with 2231 additions and 0 deletions

20
form/page.go Normal file
View File

@@ -0,0 +1,20 @@
package form
type Page struct {
PageIndex int `form:"page_index" json:"page_index"`
PageSize int `form:"page_size" json:"page_size"`
}
func (m *Page) GetPageIndex() int {
if m.PageIndex <= 0 {
m.PageIndex = 1
}
return m.PageIndex
}
func (m *Page) GetPageSize() int {
if m.PageSize <= 0 {
m.PageSize = 10
}
return m.PageSize
}

42
form/peak_valley_rule.go Normal file
View File

@@ -0,0 +1,42 @@
package form
// 一天的完整谷峰规则
// 发电 (光伏)
// 用电 (电机、生产)
//新建规则
//
//选择时间段 设置电价
//(将时间段 转化为十分钟区块 查找到对应十分钟区块 创建该规则的电价)
type PeakValleyRuleListReq struct {
Page `json:"page"`
}
type PeakValleyRuleDetailReq struct {
RuleId int `form:"rule_id" json:"rule_id"`
}
type PeakValleyRuleEditDetailReq struct {
RuleId int `form:"rule_id" json:"rule_id"`
}
type CreatePeakValleyRuleReq struct {
RuleName string `json:"rule_name" binding:"required"`
Description string `json:"description" binding:"required"`
RuleItem []TimeBlockPriceReq `json:"rule_item"`
}
type UpdatePeakValleyRuleReq struct {
RuleId int `json:"rule_id" binding:"required"`
RuleName string `json:"rule_name" binding:"required"`
Description string `json:"description" binding:"required"`
RuleItem []TimeBlockPriceReq `json:"rule_item"`
}
type TimeBlockPriceReq struct {
CustomName string `json:"custom_name"`
PeakValleyType uint `json:"peak_valley_type"`
StartTime string `json:"start_time"`
EndTime string `json:"end_time"`
Price int `json:"price"`
}