code.php 7.8 KB

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