code.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <?php
  2. $status = array
  3. (
  4. 1 => '已生成',
  5. 2 => '已绑定',
  6. 3 => '已兑换',
  7. 4 => '已使用',
  8. 5 => '已过期',
  9. );
  10. return array
  11. (
  12. # 表名
  13. 'name' => 'code',
  14. # 显示给用户看的名称
  15. 'lang' => '礼品卡卡号',
  16. 'status' => $status,
  17. 'check' => 'card',
  18. # 后台菜单排序
  19. 'order' => 99,
  20. 'menu' => false,
  21. # 数据结构
  22. 'struct' => array
  23. (
  24. 'id' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => 'ID',
  28. 'default' => '',
  29. 'desc' => '',
  30. 'match' => 'is_numeric',
  31. 'search' => 'order',
  32. 'list' => true,
  33. 'order' => 'desc',
  34. ),
  35. 'card_id' => array
  36. (
  37. 'type' => 'int-11',
  38. 'name' => '礼品卡',
  39. 'default' => '',
  40. 'desc' => '礼品卡',
  41. 'match' => 'is_numeric',
  42. 'update' => 'hidden',
  43. 'search' => 'hidden',
  44. 'value' => Dever::input('search_option_card_id'),
  45. 'list' => 'Dever::load("card/info-find#name", "{card_id}")',
  46. ),
  47. 'card' => array
  48. (
  49. 'type' => 'varchar-32',
  50. 'name' => '卡号',
  51. 'default' => '',
  52. 'desc' => '卡号',
  53. 'match' => 'is_string',
  54. 'update' => 'text',
  55. 'search' => 'fulltext',
  56. 'list' => true,
  57. ),
  58. 'status' => array
  59. (
  60. 'type' => 'int-11',
  61. 'name' => '使用状态',
  62. 'default' => '1',
  63. 'desc' => '使用状态',
  64. 'match' => 'is_numeric',
  65. 'option' => $status,
  66. 'search' => 'select',
  67. 'update' => 'select',
  68. 'list' => true,
  69. //'mul' => array(1 => '恢复使用', 4 => '已作废'),
  70. ),
  71. 'total_cash' => array
  72. (
  73. 'type' => 'float-11',
  74. 'name' => '总额',
  75. 'default' => '0',
  76. 'desc' => '总额',
  77. 'match' => 'option',
  78. 'update' => 'text',
  79. ),
  80. 'use_cash' => array
  81. (
  82. 'type' => 'float-11',
  83. 'name' => '已使用',
  84. 'default' => '0',
  85. 'desc' => '已使用',
  86. 'match' => 'option',
  87. 'update' => 'text',
  88. ),
  89. 'uid' => array
  90. (
  91. 'type' => 'int-11',
  92. 'name' => '下单用户',
  93. 'default' => '0',
  94. 'desc' => '下单用户',
  95. 'match' => 'is_numeric',
  96. 'list_name' => '更多信息',
  97. 'list' => 'Dever::load("card/lib/manage.showUserInfo", "{id}")',
  98. ),
  99. 'dh_uid' => array
  100. (
  101. 'type' => 'int-11',
  102. 'name' => '兑换用户',
  103. 'default' => '0',
  104. 'desc' => '兑换用户',
  105. 'match' => 'is_numeric',
  106. ),
  107. 'shop_id' => array
  108. (
  109. 'type' => 'int-11',
  110. 'name' => '门店',
  111. 'default' => '',
  112. 'desc' => '门店',
  113. 'match' => 'is_numeric',
  114. ),
  115. 'city' => array
  116. (
  117. 'type' => 'int-11',
  118. 'name' => '城市',
  119. 'default' => '',
  120. 'desc' => '城市',
  121. 'match' => 'option',
  122. //'update' => 'text',
  123. ),
  124. 'order_id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '订单表id',
  128. 'default' => '',
  129. 'desc' => '订单表id',
  130. 'match' => 'is_numeric',
  131. ),
  132. 'order_card_id' => array
  133. (
  134. 'type' => 'int-11',
  135. 'name' => '订单表id',
  136. 'default' => '',
  137. 'desc' => '订单表id',
  138. 'match' => 'is_numeric',
  139. ),
  140. 'bdate' => array
  141. (
  142. 'type' => 'int-11',
  143. 'name' => '绑定时间',
  144. 'match' => 'option',
  145. 'default' => '',
  146. 'desc' => '',
  147. //'search' => 'date',
  148. ),
  149. 'ddate' => array
  150. (
  151. 'type' => 'int-11',
  152. 'name' => '兑换时间',
  153. 'match' => 'option',
  154. 'default' => '',
  155. 'desc' => '',
  156. //'search' => 'date',
  157. ),
  158. 'state' => array
  159. (
  160. 'type' => 'tinyint-1',
  161. 'name' => '状态',
  162. 'default' => '1',
  163. 'desc' => '请选择状态',
  164. 'match' => 'is_numeric',
  165. ),
  166. 'cdate' => array
  167. (
  168. 'type' => 'int-11',
  169. 'name' => '生成时间',
  170. 'match' => array('is_numeric', time()),
  171. 'desc' => '',
  172. # 只有insert时才生效
  173. 'insert' => true,
  174. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  175. ),
  176. ),
  177. 'alter' => array
  178. (
  179. 2 => array
  180. (
  181. array('update', 'total_cash', 'total_cash', 'float-11 0 总面值'),
  182. array('update', 'use_cash', 'use_cash', 'float-11 0 已用面值'),
  183. ),
  184. 'version' => 2,
  185. ),
  186. 'manage' => array
  187. (
  188. 'excel' => true,
  189. 'delete' => false,
  190. 'edit' => false,
  191. 'insert' => false,
  192. // 'mul' => '{type} == 1 || {type} == 4',
  193. 'list_button' => array
  194. (
  195. //'oper' => array('作废', 'goods/lib/manage.drop?id={id}', '{type} == 1'),
  196. //'oper2' => array('恢复使用', 'goods/lib/manage.recovery?id={id}', '{type} == 4'),
  197. ),
  198. ),
  199. # 索引
  200. 'index' => array
  201. (
  202. # 索引名 => 索引id
  203. 1 => array
  204. (
  205. 'card' => 'card',
  206. 'uid' => 'uid',
  207. 'dh_uid' => 'dh_uid',
  208. ),
  209. 'version' => 1,
  210. ),
  211. 'request' => array
  212. (
  213. 'getData' => array
  214. (
  215. # 匹配的正则或函数 选填项
  216. 'option' => array
  217. (
  218. 'uid' => 'yes',
  219. 'dh_uid' => 'yes',
  220. 'card_id' => 'yes',
  221. 'status' => 'yes',
  222. 'state' => 1,
  223. ),
  224. 'type' => 'all',
  225. 'limit' => '0,10',
  226. 'order' => array('ddate' => 'desc'),
  227. 'col' => '*',
  228. ),
  229. 'getPageData' => array
  230. (
  231. # 匹配的正则或函数 选填项
  232. 'option' => array
  233. (
  234. 'uid' => 'yes',
  235. 'dh_uid' => 'yes',
  236. 'status' => 'yes',
  237. 'state' => 1,
  238. ),
  239. 'type' => 'all',
  240. 'page' => array(10, 'list'),
  241. 'order' => array('ddate' => 'desc'),
  242. 'col' => '*',
  243. ),
  244. 'incUseCash' => array
  245. (
  246. 'type' => 'update',
  247. 'where' => array
  248. (
  249. 'id' => 'yes',
  250. ),
  251. 'set' => array
  252. (
  253. 'use_cash' => array('yes', '+='),
  254. ),
  255. ),
  256. 'decUseCash' => array
  257. (
  258. 'type' => 'update',
  259. 'where' => array
  260. (
  261. 'id' => 'yes',
  262. ),
  263. 'set' => array
  264. (
  265. 'use_cash' => array('yes', '-='),
  266. ),
  267. ),
  268. ),
  269. );