conf_test.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. package config
  2. import (
  3. "io/ioutil"
  4. "os"
  5. "testing"
  6. )
  7. var confs = `
  8. [udp]
  9. locport = ":1783"
  10. jyaddr = "127.0.0.1"
  11. jyport = 11118
  12. [db]
  13. [db.mongoB]
  14. addr = "192.168.3.207:27092"
  15. dbname = "wjh"
  16. coll = "bidding"
  17. size = 15
  18. user = ""
  19. password = ""
  20. [db.mongoP]
  21. addr = "192.168.3.207:27092"
  22. dbname = "wjh"
  23. coll = "projectset"
  24. size = 15
  25. user = ""
  26. password = ""
  27. [db.mongoQ]
  28. addr = "192.168.3.207:27092"
  29. dbname = "wjh"
  30. coll = "projectset"
  31. size = 15
  32. user = ""
  33. password = ""
  34. [db.es]
  35. addr = "http://192.168.3.206:9800"
  36. size = 5
  37. indexb = "bidding"
  38. typeb = "bidding"
  39. indexp = "projectset"
  40. typep = "projectset"
  41. indexwinner = "winner"
  42. typewinner = "winner"
  43. indexbuyer = "buyer"
  44. typebuyer = "buyer"
  45. detailfilter = ["(招标网|千里马|采招网|招标采购导航网|招标与采购网|中国招投标网|中国采购与招标网|中国采购与招标|优质采)[\\w\\W]{0,15}[http|https|htpps]?[a-z0-9:\\/\\/.]{0,20}(qianlima|zhaobiao|okcis|zbytb|infobidding|bidcenter|youzhicai|chinabidding|Chinabidding|CHINABIDDING)[a-z0-9.\\/\\/]{0,40}",
  46. "招标网[\\w\\W]{0,15}[http|https|htpps]?[a-z0-9:\\/\\/.]{0,20}zhaobiao[a-z0-9.\\/\\/]{0,40}",
  47. "千里马[\\w\\W]{0,15}[a-z0-9:\\/\\/.]{0,20}qianlima[a-z0-9.\\/\\/]{0,10}",
  48. "[\\((]?(网址)?[::;;]?(http|https|htpps)*[::]?(\\/\\/)?(www|jinan|WWW)?.(zhaobiao|chinabidding|Chinabidding|CHINABIDDING|infobidding|zbytb|okcis|qianlima|youzhicai).(com|cn|COM|CN)?(.cn|.CN)?\\/?[\\))]?",
  49. "[\\((]?(网址)?(::)?(http|https|htpps)*(:|:)?\\/\\/www.bidcenter.com.cn\\/",
  50. "千里马(平台|网站)+", "[“\"]?优质采(平台|电子交易平台|云采购平台|交易平台)?[”\"]?", "《?(中国采购与|中国)?招(投)?标(与采购|采购导航)?网》?",
  51. "《?元博网(采购与招标网)?》?", "《?(中国)?招标采购导航网》?", "中\\W{0,3}国采\\W{0,3}招\\W{0,3}网\\W*[((]?(bidcenter.com.cn)?[))]?", "已方宝", "中国招标与采购"]
  52. [mail]
  53. send = false
  54. to = "wangjianghan@topnet.net.cn"
  55. api = "http://172.17.145.179:19281/_send/_mail"
  56. # 日志
  57. [log]
  58. # 日志路径,为空将输出控制台
  59. logpath = ""
  60. # log size (M)
  61. maxsize = 10
  62. # compress log
  63. compress = true
  64. # log save time (day)
  65. maxage = 7
  66. # save total log file total
  67. maxbackups = 10
  68. # log level
  69. loglevel = "debug"
  70. # text or json output
  71. format = "text"
  72. [db.es.fieldes]
  73. "_id" = ""
  74. "buyerzipcode" = "string"
  75. "winnertel" = "string"
  76. "winnerperson" = "string"
  77. "contractcode" = "string"
  78. "winneraddr" = "string"
  79. "agencyaddr" = "string"
  80. "buyeraddr" = "string"
  81. "signaturedate" = "int64"
  82. "projectperiod" = "string"
  83. "projectaddr" = "string"
  84. "agencytel" = "string"
  85. "agencyperson" = "string"
  86. "buyerperson" = "string"
  87. "agency" = "string"
  88. "projectscope" = "string"
  89. "projectcode" = "string"
  90. "bidopentime" = "int64"
  91. "supervisorrate" = "float64"
  92. "buyertel" = "string"
  93. "bidamount" = "float64"
  94. "winner" = "string"
  95. "buyer" = "string"
  96. "budget" = "float64"
  97. "projectname" = "string"
  98. "bidstatus" = "string"
  99. "buyerclass" = "string"
  100. "topscopeclass" = ""
  101. "s_topscopeclass" = "string"
  102. "s_subscopeclass" = "string"
  103. "area" = "string"
  104. "city" = "string"
  105. "district" = "string"
  106. "s_winner" = "string"
  107. "title" = "string"
  108. "detail" = "string"
  109. "site" = "string"
  110. "comeintime" = "int64"
  111. "href" = "string"
  112. "infoformat" = "int32"
  113. "publishtime" = "int64"
  114. "s_sha" = "string"
  115. "spidercode" = "string"
  116. "subtype" = "string"
  117. "toptype" = "string"
  118. "projectinfo" = ""
  119. "purchasing" = "string"
  120. "purchasinglist" = ""
  121. "channel" = "string"
  122. "winnerorder" = ""
  123. "project_scale" = "string"
  124. "project_duration" = "int32"
  125. "project_timeunit" = "string"
  126. "project_startdate" = "int64"
  127. "project_completedate" = "int64"
  128. "payway" = "string"
  129. "contract_guarantee" = "bool"
  130. "bid_guarantee" = "bool"
  131. "qualifies" = ""
  132. "entidlist" = ""
  133. "funds" = "string"
  134. "review_experts" = "string"
  135. "bidmethod" = "string"
  136. "bidendtime" = "int64"
  137. "bidopenaddress" = "string"
  138. "docamount" = "float64"
  139. "agencyrate" = "float64"
  140. "agencyfee" = "float64"
  141. "bidway" = "string"
  142. "getdocmethod" = "string"
  143. "china_bidding" = "string"
  144. "purchasing_tag" = "string"
  145. "multipackage" = "int32"
  146. "isValidFile" = "bool"
  147. "bid_field" = "string"
  148. [db.es.fieldprojectinfo]
  149. "approvecode" = "string"
  150. "approvecontent" = "string"
  151. "approvestatus" = "string"
  152. "approvetime" = "string"
  153. "approvedept" = "string"
  154. "approvenumber" = "string"
  155. "projecttype" = "string"
  156. "approvecity" = "string"
  157. [db.es.fieldpurchasinglist]
  158. "itemname" = "string"
  159. "item" = "string"
  160. "brandname" = "string"
  161. "model" = "string"
  162. "unitname" = "string"
  163. "number" = "float64"
  164. "unitprice" = "float64"
  165. "totalprice" = "float64"
  166. [db.es.fieldprocurementlist]
  167. "projectname" = "string"
  168. "buyer" = "string"
  169. "item" = "string"
  170. "projectscope" = "string"
  171. "expurasingtime" = "string"
  172. "totalprice" = "float64"
  173. [db.es.fieldwinnerorder]
  174. "sort" = "int"
  175. "sortstr" = "string"
  176. "entname" = "string"
  177. `
  178. func TestInit(t *testing.T) {
  179. testfile := "/tmp/crocodile.toml"
  180. ioutil.WriteFile(testfile, []byte(confs), 0644)
  181. Init(testfile)
  182. //t.Logf("%+v", Conf.DB.Es.FieldPurchasingList)
  183. os.Remove(testfile)
  184. }