v2_10
This commit is contained in:
@@ -3,6 +3,7 @@ package convertor
|
||||
import (
|
||||
"net/url"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func ConvertInt[T int | int16 | int32 | int64](value string, defaultValue T) T {
|
||||
@@ -35,3 +36,13 @@ func QueryInt[T int | int16 | int32 | int64](vars url.Values, key string, defaul
|
||||
|
||||
return T(i)
|
||||
}
|
||||
|
||||
func DefaultStartTimeAndEndTime(start string, end string) (string, string) {
|
||||
if len(start) == 0 {
|
||||
start = "2000-01-01 00:00:00"
|
||||
}
|
||||
if len(end) == 0 {
|
||||
end = time.Now().Add(time.Hour * 24).Format(time.DateTime)
|
||||
}
|
||||
return start, end
|
||||
}
|
||||
|
||||
45
internal/pkg/know/know.go
Normal file
45
internal/pkg/know/know.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package know
|
||||
|
||||
const (
|
||||
CustomerCategory = "customer_category"
|
||||
CustomerSource = "customer_source"
|
||||
|
||||
BudgetCategory = "budget_category"
|
||||
|
||||
IncomeBank = "income_bank"
|
||||
IncomeCategory = "income_category"
|
||||
|
||||
ExpenseCategory = "expense_category"
|
||||
|
||||
CookieName = "authorize"
|
||||
StoreName = "authorize_user"
|
||||
)
|
||||
|
||||
var (
|
||||
// pear admin 配置
|
||||
PearAdmin = "m:pearjson"
|
||||
|
||||
// 所有类别
|
||||
AllCategories = "m:category:all"
|
||||
// 所有类别 简单信息
|
||||
AllCategorySimple = "m:categorysimple:all"
|
||||
// 类别列表 根据 父id 获取
|
||||
ListCategoriesByParentID = "m:category:parent_id:%d"
|
||||
|
||||
// 所有部门
|
||||
AllDepartments = "m:department:all"
|
||||
|
||||
// 所有菜单
|
||||
AllMenus = "m:menus:all"
|
||||
// 递归菜单
|
||||
RecursiveMenus = "m:rec_menus:%d"
|
||||
// 根据用户ID获取菜单
|
||||
AdminMenus = "m:admin_menus:%d"
|
||||
// 登陆用户的菜单
|
||||
OwnerMenus = "m:owner_menus:%d"
|
||||
// 登陆用户的菜单
|
||||
OwnerMenusMap = "m:owner_menus_map:%d"
|
||||
|
||||
// 所有角色
|
||||
AllRoles = "m:role:all"
|
||||
)
|
||||
17
internal/pkg/tpl/html/select.go
Normal file
17
internal/pkg/tpl/html/select.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package html
|
||||
|
||||
type SelectDict struct {
|
||||
Name string
|
||||
Value string
|
||||
Selected bool
|
||||
}
|
||||
|
||||
func NewSelectControls(data []*SelectDict, value string) []*SelectDict {
|
||||
for _, item := range data {
|
||||
item.Selected = false
|
||||
if item.Value == value {
|
||||
item.Selected = true
|
||||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
19
internal/pkg/tpl/html/vars.go
Normal file
19
internal/pkg/tpl/html/vars.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package html
|
||||
|
||||
var SearchStatuses = []*SelectDict{
|
||||
{Name: "状态", Value: "9999", Selected: false},
|
||||
{Name: "正常", Value: "0", Selected: false},
|
||||
{Name: "删除", Value: "-1", Selected: false},
|
||||
}
|
||||
|
||||
var Statuses = []*SelectDict{
|
||||
{Name: "正常", Value: "0", Selected: false},
|
||||
{Name: "删除", Value: "-1", Selected: false},
|
||||
}
|
||||
|
||||
var ProjectStatuses = []*SelectDict{
|
||||
{Name: "未开始", Value: "0", Selected: false},
|
||||
{Name: "进行中", Value: "10", Selected: false},
|
||||
{Name: "已结项", Value: "20", Selected: false},
|
||||
{Name: "已删除", Value: "-1", Selected: false},
|
||||
}
|
||||
Reference in New Issue
Block a user