city.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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. 'reorder' => array
  108. (
  109. 'type' => 'int-11',
  110. 'name' => '排序(数值越大越靠前)',
  111. 'default' => '1',
  112. 'desc' => '请输入排序',
  113. 'match' => 'option',
  114. 'update' => 'text',
  115. 'search' => 'order',
  116. 'list_name' => '排序',
  117. 'list' => true,
  118. 'order' => 'desc',
  119. 'edit' => true,
  120. ),
  121. 'status' => array
  122. (
  123. 'type' => 'tinyint-1',
  124. 'name' => '状态',
  125. 'default' => '1',
  126. 'desc' => '请选择状态',
  127. 'match' => 'is_numeric',
  128. ),
  129. 'state' => array
  130. (
  131. 'type' => 'tinyint-1',
  132. 'name' => '状态',
  133. 'default' => '1',
  134. 'desc' => '请选择状态',
  135. 'match' => 'is_numeric',
  136. ),
  137. 'cdate' => array
  138. (
  139. 'type' => 'int-11',
  140. 'name' => '录入时间',
  141. 'match' => array('is_numeric', time()),
  142. 'desc' => '',
  143. # 只有insert时才生效
  144. 'insert' => true,
  145. 'search' => 'date',
  146. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  147. ),
  148. ),
  149. 'manage' => array
  150. (
  151. ),
  152. 'request' => array
  153. (
  154. 'getAll' => array
  155. (
  156. # 匹配的正则或函数 选填项
  157. 'option' => array
  158. (
  159. 'province_id' => 'yes',
  160. 'level_id' => array('yes', '<'),
  161. 'noid' => array('yes-id', 'not in'),
  162. 'status' => 'yes',
  163. 'state' => 1,
  164. ),
  165. 'type' => 'all',
  166. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  167. 'col' => 'id,id as value, name, pinyin, pinyin_first',
  168. ),
  169. 'getData' => array
  170. (
  171. # 匹配的正则或函数 选填项
  172. 'option' => array
  173. (
  174. 'province_id' => 'yes',
  175. 'level_id' => array('yes', '<'),
  176. 'state' => 1,
  177. ),
  178. 'type' => 'all',
  179. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  180. 'col' => 'id, name, pinyin, pinyin_first|id',
  181. ),
  182. 'getOne' => array
  183. (
  184. # 匹配的正则或函数 选填项
  185. 'option' => array
  186. (
  187. 'name' => array('yes', 'like'),
  188. 'province_id' => 'yes',
  189. 'state' => 1,
  190. ),
  191. 'type' => 'one',
  192. 'col' => '*',
  193. ),
  194. 'updateLevel' => array
  195. (
  196. 'where' => array
  197. (
  198. 'level_id' => 'yes',
  199. ),
  200. 'set' => array
  201. (
  202. 'level_id' => 'yes',
  203. ),
  204. 'type' => 'update',
  205. ),
  206. 'getLike' => array
  207. (
  208. # 匹配的正则或函数 选填项
  209. 'option' => array
  210. (
  211. 'province_id' => 'yes',
  212. 'name' => array('yes', 'like'),
  213. 'state' => 1,
  214. ),
  215. 'type' => 'one',
  216. 'col' => '*',
  217. ),
  218. )
  219. );