consts.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package consts
  2. import (
  3. "context"
  4. "fmt"
  5. "github.com/gogf/gf/v2/frame/g"
  6. "github.com/gogf/gf/v2/util/gconv"
  7. "strings"
  8. )
  9. const (
  10. AreaType = iota + 1 //省份
  11. CityType //城市
  12. CitySpecialType //直辖市
  13. HotBidding = iota - 2
  14. ClassBidding
  15. CityBidding
  16. )
  17. var (
  18. SettingPageSize = g.Cfg().MustGet(context.Background(), "listPageSetting.pageSize").Int()
  19. SettingBidCacheTime = g.Cfg().MustGet(context.Background(), "listPageSetting.cacheTime").Int64()
  20. BiddingListMaxTotal = g.Cfg().MustGet(context.Background(), "listPageSetting.maxBidSize", 5000).Int()
  21. TableName = g.Cfg().MustGet(context.Background(), "tableName", "jybid_classifyList").String()
  22. WebDomainFormat = g.Cfg("global").MustGet(context.Background(), "webDomainFormat").String()
  23. JyWebDomain = g.Cfg("global").MustGet(context.Background(), "jyWebDomain").String()
  24. PinyinKeywords map[string]map[string]string
  25. TopTypeMap = map[string]string{
  26. "预告": "招标预告",
  27. "招标": "招标公告",
  28. "结果": "招标结果",
  29. "其它": "招标信用",
  30. }
  31. )
  32. func init() {
  33. PinyinKeywords = map[string]map[string]string{}
  34. for _, m := range g.Config("global").MustGet(context.Background(), "pinyinKeywords").Maps() {
  35. keyword := strings.TrimSpace(gconv.String(m["name"]))
  36. code := strings.TrimSpace(gconv.String(m["code"]))
  37. if keyword != "" && code != "" {
  38. PinyinKeywords[keyword] = map[string]string{
  39. "name": keyword,
  40. "href": fmt.Sprintf("%s/list/keywords/%s.html", JyWebDomain, code),
  41. }
  42. }
  43. }
  44. }