city.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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. 'noid' => array('yes-id', 'not in'),
  173. 'status' => 'yes',
  174. 'state' => 1,
  175. ),
  176. 'type' => 'all',
  177. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  178. 'col' => 'id,id as value, name, pinyin, pinyin_first',
  179. ),
  180. 'getData' => array
  181. (
  182. # 匹配的正则或函数 选填项
  183. 'option' => array
  184. (
  185. 'province_id' => 'yes',
  186. 'level_id' => array('yes', '<'),
  187. 'state' => 1,
  188. ),
  189. 'type' => 'all',
  190. 'order' => array('pinyin_first' => 'asc', 'reorder' => 'desc', 'id' => 'asc'),
  191. 'col' => 'id, name, pinyin, pinyin_first|id',
  192. ),
  193. 'getOne' => array
  194. (
  195. # 匹配的正则或函数 选填项
  196. 'option' => array
  197. (
  198. 'name' => array('yes', 'like'),
  199. 'province_id' => 'yes',
  200. 'state' => 1,
  201. ),
  202. 'type' => 'one',
  203. 'col' => '*',
  204. ),
  205. 'updateLevel' => array
  206. (
  207. 'where' => array
  208. (
  209. 'level_id' => 'yes',
  210. ),
  211. 'set' => array
  212. (
  213. 'level_id' => 'yes',
  214. ),
  215. 'type' => 'update',
  216. ),
  217. 'getLike' => array
  218. (
  219. # 匹配的正则或函数 选填项
  220. 'option' => array
  221. (
  222. 'province_id' => 'yes',
  223. 'name' => array('yes', 'like'),
  224. 'state' => 1,
  225. ),
  226. 'type' => 'one',
  227. 'col' => '*',
  228. ),
  229. )
  230. );