city.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. 'list' => true,
  140. 'edit' => true,
  141. ),
  142. 'state' => array
  143. (
  144. 'type' => 'tinyint-1',
  145. 'name' => '状态',
  146. 'default' => '1',
  147. 'desc' => '请选择状态',
  148. 'match' => 'is_numeric',
  149. ),
  150. 'cdate' => array
  151. (
  152. 'type' => 'int-11',
  153. 'name' => '录入时间',
  154. 'match' => array('is_numeric', time()),
  155. 'desc' => '',
  156. # 只有insert时才生效
  157. 'insert' => true,
  158. 'search' => 'date',
  159. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  160. ),
  161. ),
  162. 'manage' => array
  163. (
  164. ),
  165. 'request' => array
  166. (
  167. 'getAll' => array
  168. (
  169. # 匹配的正则或函数 选填项
  170. 'option' => array
  171. (
  172. 'province_id' => 'yes',
  173. 'level_id' => array('yes', '<'),
  174. 'price' => array('yes', '>'),
  175. 'noid' => array('yes-id', 'not in'),
  176. 'status' => 'yes',
  177. 'state' => 1,
  178. ),
  179. 'type' => 'all',
  180. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  181. 'col' => 'id,id as value, name, pinyin, pinyin_first',
  182. ),
  183. 'getData' => array
  184. (
  185. # 匹配的正则或函数 选填项
  186. 'option' => array
  187. (
  188. 'province_id' => 'yes',
  189. 'level_id' => array('yes', '<'),
  190. 'state' => 1,
  191. ),
  192. 'type' => 'all',
  193. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  194. 'col' => 'id, name, pinyin, pinyin_first|id',
  195. ),
  196. 'getOne' => array
  197. (
  198. # 匹配的正则或函数 选填项
  199. 'option' => array
  200. (
  201. 'name' => array('yes', 'like'),
  202. 'province_id' => 'yes',
  203. 'state' => 1,
  204. ),
  205. 'type' => 'one',
  206. 'col' => '*',
  207. ),
  208. 'getDatas' => array
  209. (
  210. # 匹配的正则或函数 选填项
  211. 'option' => array
  212. (
  213. 'name' => array('yes', 'like'),
  214. 'province_id' => 'yes',
  215. 'state' => 1,
  216. ),
  217. 'type' => 'all',
  218. 'col' => '*',
  219. ),
  220. 'updateLevel' => array
  221. (
  222. 'where' => array
  223. (
  224. 'level_id' => 'yes',
  225. ),
  226. 'set' => array
  227. (
  228. 'level_id' => 'yes',
  229. ),
  230. 'type' => 'update',
  231. ),
  232. 'getLike' => array
  233. (
  234. # 匹配的正则或函数 选填项
  235. 'option' => array
  236. (
  237. 'province_id' => 'yes',
  238. 'name' => array('yes', 'like'),
  239. 'state' => 1,
  240. ),
  241. 'type' => 'one',
  242. 'col' => '*',
  243. ),
  244. )
  245. );