address.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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' => 'radio',
  79. 'list' => true,
  80. 'order' => 'desc',
  81. ),
  82. 'contacts' => array
  83. (
  84. 'type' => 'varchar-100',
  85. 'name' => '联系人',
  86. 'default' => '',
  87. 'desc' => '联系人',
  88. 'match' => 'option',
  89. 'search' => 'fulltext',
  90. 'update' => 'text',
  91. 'list' => true,
  92. ),
  93. 'phone' => array
  94. (
  95. 'type' => 'varchar-100',
  96. 'name' => '联系电话',
  97. 'default' => '',
  98. 'desc' => '联系电话',
  99. 'match' => 'option',
  100. 'search' => 'fulltext',
  101. 'update' => 'text',
  102. 'list' => true,
  103. ),
  104. 'area' => array
  105. (
  106. 'type' => 'varchar-800',
  107. 'name' => '城市地区',
  108. 'default' => '',
  109. 'desc' => '城市地区',
  110. 'match' => 'is_string',
  111. 'search' => 'linkage',
  112. 'update' => 'linkage',
  113. 'option' => Dever::url('api.get?level_total=' . $area_total, 'area'),
  114. 'list' => 'Dever::load("area/api.string", "{area}")',
  115. ),
  116. 'province' => array
  117. (
  118. 'type' => 'int-11',
  119. 'name' => '省份',
  120. 'default' => '',
  121. 'desc' => '省份',
  122. 'match' => 'option',
  123. //'update' => 'text',
  124. ),
  125. 'city' => array
  126. (
  127. 'type' => 'int-11',
  128. 'name' => '城市',
  129. 'default' => '',
  130. 'desc' => '城市',
  131. 'match' => 'option',
  132. //'update' => 'text',
  133. ),
  134. 'county' => array
  135. (
  136. 'type' => 'int-11',
  137. 'name' => '县区',
  138. 'default' => '',
  139. 'desc' => '县区',
  140. 'match' => 'option',
  141. //'update' => 'text',
  142. ),
  143. 'town' => array
  144. (
  145. 'type' => 'int-11',
  146. 'name' => '街道',
  147. 'default' => '',
  148. 'desc' => '街道',
  149. 'match' => 'option',
  150. //'update' => 'text',
  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. 'list' => true,
  177. ),
  178. 'tag' => array
  179. (
  180. 'type' => 'tinyint-1',
  181. 'name' => '标签',
  182. 'default' => '1',
  183. 'desc' => '标签',
  184. 'match' => 'is_numeric',
  185. 'option' => $tag,
  186. //'update' => 'radio',
  187. //'list' => true,
  188. ),
  189. 'state' => array
  190. (
  191. 'type' => 'tinyint-1',
  192. 'name' => '状态',
  193. 'default' => '1',
  194. 'desc' => '请选择状态',
  195. 'match' => 'is_numeric',
  196. ),
  197. 'cdate' => array
  198. (
  199. 'type' => 'int-11',
  200. 'name' => '操作时间',
  201. 'match' => array('is_numeric', time()),
  202. 'desc' => '',
  203. # 只有insert时才生效
  204. //'insert' => true,
  205. 'search' => 'date',
  206. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  207. ),
  208. ),
  209. 'index' => array
  210. (
  211. 1 => array
  212. (
  213. 'source' => 'source_table,source_id,type',
  214. ),
  215. # 版本号 更改版本号会更新当前表的索引
  216. 'version' => 1,
  217. ),
  218. 'manage' => array
  219. (
  220. ),
  221. 'request' => array
  222. (
  223. 'getList' => array
  224. (
  225. # 匹配的正则或函数 选填项
  226. 'option' => array
  227. (
  228. 'source_table' => 'yes',
  229. 'source_id' => 'yes',
  230. 'state' => 1,
  231. ),
  232. 'type' => 'all',
  233. 'order' => array('type' => 'desc','id' => 'desc'),
  234. 'page' => array(10, 'list'),
  235. 'col' => '*',
  236. ),
  237. 'updateType' => array
  238. (
  239. 'set' => array
  240. (
  241. 'type' => 'yes',
  242. ),
  243. 'where' => array
  244. (
  245. 'type' => 'yes',
  246. ),
  247. 'type' => 'update',
  248. ),
  249. ),
  250. );