代码拉取完成,页面将自动刷新
package core
import (
"gitee.com/rio-studio/mouse-core/util"
"strings"
)
type Service struct{}
func (p *Service) ParseSort(sort string) string {
var order string
if sort != "" {
var sortType string
var sortField string
if strings.HasPrefix(sort, "+") {
sortType = "ASC"
sortField = strings.Replace(sort, "+", "", 1)
} else if strings.HasPrefix(sort, "-") {
sortType = "DESC"
sortField = strings.Replace(sort, "-", "", 1)
} else {
sortType = "DESC"
sortField = "id"
}
order = "`" + sortField + "` " + sortType
}
return order
}
func (p *Service) ParseSearchText(searchText string, fields *[]string, whereAnd map[string]interface{}, isOr bool) map[string]interface{} {
link := " And "
if isOr {
link = " OR "
}
if searchText != "" {
var arr []string
var str string
for _, field := range *fields {
str += " " + field + " LIKE ? " + link
arr = append(arr, "%"+searchText+"%")
}
whereAnd[str[:(len(str)-len(link))]] = arr
}
return whereAnd
}
func (p *Service) ParseDateTime(startTime, endTime int, timeField string, whereAnd map[string]interface{}) map[string]interface{} {
timeCondition := &util.TimeCondition{}
timeCondition.StartTime = startTime
timeCondition.EndTime = endTime
return util.ParseStrTimeCondition(timeCondition, timeField, whereAnd)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。