address.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. <?php
  2. $type = array
  3. (
  4. 1 => '普通地址',
  5. 2 => '默认地址',
  6. );
  7. $tag = array
  8. (
  9. 1 => '公司',
  10. 2 => '家',
  11. 3 => '学校',
  12. 4 => '其他',
  13. );
  14. $source_table = Dever::input('search_option_source_table');
  15. $source_id = Dever::input('search_option_source_id');
  16. $area_total = Dever::input('area_total', 3);
  17. return array
  18. (
  19. # 表名
  20. 'name' => 'address',
  21. # 显示给用户看的名称
  22. 'lang' => '用户地址库',
  23. 'end' => array
  24. (
  25. 'insert' => 'user/lib/address.manage_update',
  26. 'update' => 'user/lib/address.manage_update',
  27. ),
  28. 'menu' => false,
  29. # 数据结构
  30. 'struct' => array
  31. (
  32. 'id' => array
  33. (
  34. 'type' => 'int-11',
  35. 'name' => 'ID',
  36. 'default' => '',
  37. 'desc' => '',
  38. 'match' => 'is_numeric',
  39. 'search' => 'order',
  40. 'update' => 'hidden',
  41. //'list' => true,
  42. ),
  43. 'source_table' => array
  44. (
  45. 'type' => 'varchar-100',
  46. 'name' => '来源表名',
  47. 'default' => '',
  48. 'desc' => '来源表名',
  49. 'match' => 'is_numeric',
  50. 'update' => 'hidden',
  51. 'value' => $source_table,
  52. ),
  53. 'source_id' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '用户名',
  57. 'default' => '0',
  58. 'desc' => '请选择用户',
  59. 'match' => 'is_numeric',
  60. 'update' => 'hidden',
  61. 'search' => $source_table ? array
  62. (
  63. 'api' => $source_table . '-like',
  64. 'col' => 'search',
  65. 'result' => 'id',
  66. ) : false,
  67. 'value' => $source_id,
  68. 'list' => 'Dever::load("user/lib/address.getSource#name", "{source_table}", "{source_id}")',
  69. ),
  70. 'type' => array
  71. (
  72. 'type' => 'tinyint-1',
  73. 'name' => '类型',
  74. 'default' => '2',
  75. 'desc' => '类型',
  76. 'match' => 'is_numeric',
  77. 'option' => $type,
  78. 'update' => 'hidden',
  79. 'value' => Dever::input('type', 2),
  80. 'list' => true,
  81. 'order' => 'desc',
  82. ),
  83. 'contacts' => array
  84. (
  85. 'type' => 'varchar-100',
  86. 'name' => '联系人',
  87. 'default' => '',
  88. 'desc' => '联系人',
  89. 'match' => 'option',
  90. 'search' => 'fulltext',
  91. 'update' => 'text',
  92. 'value' => Dever::input('contacts'),
  93. 'list' => true,
  94. ),
  95. 'phone' => array
  96. (
  97. 'type' => 'varchar-100',
  98. 'name' => '联系电话',
  99. 'default' => '',
  100. 'desc' => '联系电话',
  101. 'match' => 'option',
  102. 'search' => 'fulltext',
  103. 'update' => 'text',
  104. 'value' => Dever::input('phone'),
  105. 'list' => true,
  106. ),
  107. 'area' => array
  108. (
  109. 'type' => 'varchar-800',
  110. 'name' => '城市地区',
  111. 'default' => '',
  112. 'desc' => '城市地区',
  113. 'match' => 'is_string',
  114. 'search' => 'linkage',
  115. 'update' => 'linkage',
  116. 'value' => Dever::input('area'),
  117. 'option' => Dever::url('api.get?level_total=' . $area_total, 'area'),
  118. 'list' => 'Dever::load("area/api.string", "{area}")',
  119. ),
  120. 'province' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => '省份',
  124. 'default' => '',
  125. 'desc' => '省份',
  126. 'match' => 'option',
  127. ),
  128. 'city' => array
  129. (
  130. 'type' => 'int-11',
  131. 'name' => '城市',
  132. 'default' => '',
  133. 'desc' => '城市',
  134. 'match' => 'option',
  135. ),
  136. 'county' => array
  137. (
  138. 'type' => 'int-11',
  139. 'name' => '县区',
  140. 'default' => '',
  141. 'desc' => '县区',
  142. 'match' => 'option',
  143. ),
  144. 'town' => array
  145. (
  146. 'type' => 'int-11',
  147. 'name' => '街道',
  148. 'default' => '',
  149. 'desc' => '街道',
  150. 'match' => 'option',
  151. ),
  152. 'lng' => array
  153. (
  154. 'type' => 'varchar-100',
  155. 'name' => '经度',
  156. 'default' => '',
  157. 'desc' => '经度',
  158. 'match' => 'option',
  159. ),
  160. 'lat' => array
  161. (
  162. 'type' => 'varchar-100',
  163. 'name' => '纬度',
  164. 'default' => '',
  165. 'desc' => '纬度',
  166. 'match' => 'option',
  167. ),
  168. 'address' => array
  169. (
  170. 'type' => 'varchar-1000',
  171. 'name' => '详细地址',
  172. 'default' => '',
  173. 'desc' => '详细地址',
  174. 'match' => 'option',
  175. 'update' => 'textarea',
  176. 'value' => Dever::input('address'),
  177. 'list' => true,
  178. ),
  179. 'tag' => array
  180. (
  181. 'type' => 'tinyint-1',
  182. 'name' => '标签',
  183. 'default' => '1',
  184. 'desc' => '标签',
  185. 'match' => 'is_numeric',
  186. 'option' => $tag,
  187. ),
  188. 'state' => array
  189. (
  190. 'type' => 'tinyint-1',
  191. 'name' => '状态',
  192. 'default' => '1',
  193. 'desc' => '请选择状态',
  194. 'match' => 'is_numeric',
  195. ),
  196. 'cdate' => array
  197. (
  198. 'type' => 'int-11',
  199. 'name' => '操作时间',
  200. 'match' => array('is_numeric', time()),
  201. 'desc' => '',
  202. # 只有insert时才生效
  203. //'insert' => true,
  204. 'search' => 'date',
  205. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  206. ),
  207. ),
  208. 'index' => array
  209. (
  210. 1 => array
  211. (
  212. 'source' => 'source_table,source_id,type',
  213. ),
  214. # 版本号 更改版本号会更新当前表的索引
  215. 'version' => 1,
  216. ),
  217. 'manage' => array
  218. (
  219. ),
  220. 'request' => array
  221. (
  222. 'getList' => array
  223. (
  224. # 匹配的正则或函数 选填项
  225. 'option' => array
  226. (
  227. 'source_table' => 'yes',
  228. 'source_id' => 'yes',
  229. 'state' => 1,
  230. ),
  231. 'type' => 'all',
  232. 'order' => array('type' => 'desc','id' => 'desc'),
  233. 'page' => array(10, 'list'),
  234. 'col' => '*',
  235. ),
  236. 'updateType' => array
  237. (
  238. 'set' => array
  239. (
  240. 'type' => 'yes',
  241. ),
  242. 'where' => array
  243. (
  244. 'type' => 'yes',
  245. ),
  246. 'type' => 'update',
  247. ),
  248. ),
  249. );