city.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. <?php
  2. $province = function()
  3. {
  4. $array = array();
  5. $data = Dever::load('area/province-state');
  6. if($data)
  7. {
  8. $array += $data;
  9. }
  10. return $array;
  11. };
  12. $level = function()
  13. {
  14. $array = array
  15. (
  16. 1000 => array
  17. (
  18. 'id' => 1000,
  19. 'name' => '普通城市',
  20. ),
  21. );
  22. $data = Dever::load('area/level-state');
  23. if($data)
  24. {
  25. $array += $data;
  26. }
  27. return $array;
  28. };
  29. return array
  30. (
  31. # 表名
  32. 'name' => 'city',
  33. # 显示给用户看的名称
  34. 'lang' => '城市',
  35. # 是否显示在后台菜单
  36. 'order' => 80,
  37. # 数据结构
  38. 'struct' => array
  39. (
  40. 'id' => array
  41. (
  42. 'type' => 'int-11',
  43. 'name' => 'ID',
  44. 'default' => '',
  45. 'desc' => '',
  46. 'match' => 'is_numeric',
  47. 'order' => 'asc',
  48. 'list' => true,
  49. ),
  50. 'name' => array
  51. (
  52. 'type' => 'varchar-150',
  53. 'name' => '城市名称',
  54. 'default' => '',
  55. 'desc' => '城市名称',
  56. 'match' => 'is_string',
  57. 'update' => 'text',
  58. 'search' => 'fulltext',
  59. 'list' => true,
  60. ),
  61. 'pinyin' => array
  62. (
  63. 'type' => 'varchar-300',
  64. 'name' => '拼音',
  65. 'default' => '',
  66. 'desc' => '拼音',
  67. 'match' => 'option',
  68. 'update' => 'text',
  69. 'search' => 'fulltext',
  70. 'list' => true,
  71. ),
  72. 'pinyin_first' => array
  73. (
  74. 'type' => 'varchar-30',
  75. 'name' => '拼音首字母',
  76. 'default' => '',
  77. 'desc' => '拼音首字母',
  78. 'match' => 'option',
  79. 'update' => 'text',
  80. 'search' => 'fulltext',
  81. 'list' => true,
  82. ),
  83. 'province_id' => array
  84. (
  85. 'type' => 'int-11',
  86. 'name' => '省份',
  87. 'default' => '0',
  88. 'desc' => '省份',
  89. 'match' => 'is_numeric',
  90. 'update' => 'select',
  91. 'option' => $province,
  92. 'list' => true,
  93. ),
  94. 'level_id' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => '城市等级',
  98. 'default' => '1000',
  99. 'desc' => '城市等级',
  100. 'match' => 'is_numeric',
  101. 'search' => 'select',
  102. 'update' => 'select',
  103. 'option' => $level,
  104. 'list' => true,
  105. 'edit' => true,
  106. ),
  107. 'price' => array
  108. (
  109. 'type' => 'varchar-15',
  110. 'name' => '城市价值-城市代理价格,以万为单位,负数表示继承城市等级里的价值规则',
  111. 'default' => '-1',
  112. 'desc' => '城市价值',
  113. 'match' => 'is_string',
  114. 'update' => 'text',
  115. 'list' => true,
  116. 'edit' => true,
  117. ),
  118. 'reorder' => array
  119. (
  120. 'type' => 'int-11',
  121. 'name' => '排序(数值越大越靠前)',
  122. 'default' => '1',
  123. 'desc' => '请输入排序',
  124. 'match' => 'option',
  125. 'update' => 'text',
  126. 'search' => 'order',
  127. 'list_name' => '排序',
  128. 'list' => true,
  129. 'order' => 'desc',
  130. 'edit' => true,
  131. ),
  132. 'status' => array
  133. (
  134. 'type' => 'tinyint-1',
  135. 'name' => '状态',
  136. 'default' => '1',
  137. 'desc' => '请选择状态',
  138. 'match' => 'is_numeric',
  139. ),
  140. 'state' => array
  141. (
  142. 'type' => 'tinyint-1',
  143. 'name' => '状态',
  144. 'default' => '1',
  145. 'desc' => '请选择状态',
  146. 'match' => 'is_numeric',
  147. ),
  148. 'cdate' => array
  149. (
  150. 'type' => 'int-11',
  151. 'name' => '录入时间',
  152. 'match' => array('is_numeric', time()),
  153. 'desc' => '',
  154. # 只有insert时才生效
  155. 'insert' => true,
  156. 'search' => 'date',
  157. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  158. ),
  159. ),
  160. 'manage' => array
  161. (
  162. ),
  163. 'request' => array
  164. (
  165. 'getAll' => array
  166. (
  167. # 匹配的正则或函数 选填项
  168. 'option' => array
  169. (
  170. 'province_id' => 'yes',
  171. 'level_id' => array('yes', '<'),
  172. 'price' => array('yes', '>'),
  173. 'noid' => array('yes-id', 'not in'),
  174. 'status' => 'yes',
  175. 'state' => 1,
  176. ),
  177. 'type' => 'all',
  178. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  179. 'col' => 'id,id as value, name, pinyin, pinyin_first',
  180. ),
  181. 'getData' => array
  182. (
  183. # 匹配的正则或函数 选填项
  184. 'option' => array
  185. (
  186. 'province_id' => 'yes',
  187. 'level_id' => array('yes', '<'),
  188. 'state' => 1,
  189. ),
  190. 'type' => 'all',
  191. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  192. 'col' => 'id, name, pinyin, pinyin_first|id',
  193. ),
  194. 'getOne' => array
  195. (
  196. # 匹配的正则或函数 选填项
  197. 'option' => array
  198. (
  199. 'name' => array('yes', 'like'),
  200. 'province_id' => 'yes',
  201. 'state' => 1,
  202. ),
  203. 'type' => 'one',
  204. 'col' => '*',
  205. ),
  206. 'getDatas' => array
  207. (
  208. # 匹配的正则或函数 选填项
  209. 'option' => array
  210. (
  211. 'name' => array('yes', 'like'),
  212. 'province_id' => 'yes',
  213. 'state' => 1,
  214. ),
  215. 'type' => 'all',
  216. 'col' => '*',
  217. ),
  218. 'updateLevel' => array
  219. (
  220. 'where' => array
  221. (
  222. 'level_id' => 'yes',
  223. ),
  224. 'set' => array
  225. (
  226. 'level_id' => 'yes',
  227. ),
  228. 'type' => 'update',
  229. ),
  230. 'getLike' => array
  231. (
  232. # 匹配的正则或函数 选填项
  233. 'option' => array
  234. (
  235. 'province_id' => 'yes',
  236. 'name' => array('yes', 'like'),
  237. 'state' => 1,
  238. ),
  239. 'type' => 'one',
  240. 'col' => '*',
  241. ),
  242. )
  243. );