address.php 5.8 KB

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