city.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. -1 => array
  17. (
  18. 'id' => -1,
  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' => '-1',
  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. 'state' => array
  122. (
  123. 'type' => 'tinyint-1',
  124. 'name' => '状态',
  125. 'default' => '1',
  126. 'desc' => '请选择状态',
  127. 'match' => 'is_numeric',
  128. ),
  129. 'cdate' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '录入时间',
  133. 'match' => array('is_numeric', time()),
  134. 'desc' => '',
  135. # 只有insert时才生效
  136. 'insert' => true,
  137. 'search' => 'date',
  138. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  139. ),
  140. ),
  141. 'manage' => array
  142. (
  143. ),
  144. 'request' => array
  145. (
  146. 'getAll' => array
  147. (
  148. # 匹配的正则或函数 选填项
  149. 'option' => array
  150. (
  151. 'province_id' => 'yes',
  152. 'state' => 1,
  153. ),
  154. 'type' => 'all',
  155. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  156. 'col' => 'id,id as value, name, pinyin, pinyin_first',
  157. ),
  158. 'getData' => array
  159. (
  160. # 匹配的正则或函数 选填项
  161. 'option' => array
  162. (
  163. 'province_id' => 'yes',
  164. 'state' => 1,
  165. ),
  166. 'type' => 'all',
  167. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  168. 'col' => 'id, name, pinyin, pinyin_first|id',
  169. ),
  170. 'getOne' => array
  171. (
  172. # 匹配的正则或函数 选填项
  173. 'option' => array
  174. (
  175. 'name' => array('yes', 'like'),
  176. 'province_id' => 'yes',
  177. 'state' => 1,
  178. ),
  179. 'type' => 'one',
  180. 'col' => '*',
  181. ),
  182. 'updateLevel' => array
  183. (
  184. 'where' => array
  185. (
  186. 'level_id' => 'yes',
  187. ),
  188. 'set' => array
  189. (
  190. 'level_id' => 'yes',
  191. ),
  192. 'type' => 'update',
  193. ),
  194. )
  195. );