info.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <?php
  2. $status = Dever::config('base')->status;
  3. $type = function()
  4. {
  5. return Dever::db('card/type')->state();
  6. };
  7. $cate = function()
  8. {
  9. $where['project_id'] = 1;
  10. return Dever::db('category/info')->getTop($where);
  11. };
  12. $buy = array
  13. (
  14. 1 => '可购买',
  15. 2 => '不可购买',
  16. );
  17. $card_type = array
  18. (
  19. 1 => '全数字',
  20. 2 => '全小写',
  21. 3 => '全大写',
  22. 4 => '大小写组合',
  23. 5 => '数字+大小写组合',
  24. );
  25. $create_type = array
  26. (
  27. 1 => '正常礼品卡',
  28. 2 => '合并礼品卡',
  29. 3 => '面值自定义卡',
  30. );
  31. $shop_set = array
  32. (
  33. 1 => '体验店无使用限制',
  34. );
  35. return array
  36. (
  37. # 表名
  38. 'name' => 'info',
  39. # 显示给用户看的名称
  40. 'lang' => '面值配置',
  41. # 后台菜单排序
  42. 'order' => 99,
  43. # 数据结构
  44. 'struct' => array
  45. (
  46. 'id' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => 'ID',
  50. 'default' => '',
  51. 'desc' => '',
  52. 'match' => 'is_numeric',
  53. 'search' => 'order',
  54. //'list' => true,
  55. 'order' => 'desc',
  56. ),
  57. 'name' => array
  58. (
  59. 'type' => 'varchar-80',
  60. 'name' => '礼品卡名称',
  61. 'default' => '',
  62. 'desc' => '请输入礼品卡名称',
  63. 'match' => 'is_string',
  64. 'update' => 'text',
  65. 'search' => 'fulltext',
  66. 'list' => true,
  67. ),
  68. 'type_id' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => '礼品卡类型',
  72. 'default' => '1',
  73. 'desc' => '礼品卡类型',
  74. 'match' => 'is_numeric',
  75. 'update' => 'radio',
  76. 'option' => $type,
  77. 'list' => true,
  78. ),
  79. 'category' => array
  80. (
  81. 'type' => 'varchar-500',
  82. 'name' => '可用商品分类-不选择则所有商品可用',
  83. 'default' => '',
  84. 'desc' => '可用商品分类',
  85. 'match' => 'option',
  86. //'search' => 'linkage',
  87. 'update' => 'checkbox',
  88. 'option' => $cate,
  89. //'option' => Dever::url('api.get', 'category'),
  90. //'list' => 'Dever::load("category/api.string", "{category}")',
  91. ),
  92. 'value' => array
  93. (
  94. 'type' => 'int-11',
  95. 'name' => '面值',
  96. 'default' => '0',
  97. 'desc' => '面值',
  98. 'match' => 'is_numeric',
  99. 'update' => 'text',
  100. 'list_name' => '面值/售价',
  101. 'list' => '"{value}/{price}"',
  102. ),
  103. 'price' => array
  104. (
  105. 'type' => 'varchar-80',
  106. 'name' => '售价',
  107. 'default' => '0',
  108. 'desc' => '售价',
  109. 'match' => 'is_numeric',
  110. 'update' => 'text',
  111. //'list' => true,
  112. ),
  113. 'min' => array
  114. (
  115. 'type' => 'varchar-80',
  116. 'name' => '最低消费-填写大于0的数值后,满足条件的商品总额需大于等于该数值,才能使用该礼品卡',
  117. 'default' => '0',
  118. 'desc' => '最低消费',
  119. 'match' => 'is_numeric',
  120. 'update' => 'text',
  121. //'list' => true,
  122. ),
  123. 'create_type' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '生成类型-仅影响后台生成礼品卡时,生成的礼品卡类型,如代理商发放的礼品卡',
  127. 'default' => '1',
  128. 'desc' => '生成类型',
  129. 'match' => 'is_numeric',
  130. 'update' => 'radio',
  131. 'option' => $create_type,
  132. 'list' => true,
  133. ),
  134. 'buy' => array
  135. (
  136. 'type' => 'int-11',
  137. 'name' => '是否可以购买',
  138. 'default' => '2',
  139. 'desc' => '是否可以购买',
  140. 'match' => 'is_numeric',
  141. 'update' => 'radio',
  142. 'option' => $buy,
  143. //'list' => true,
  144. ),
  145. 'shop_set' => array
  146. (
  147. 'type' => 'varchar-80',
  148. 'name' => '特殊设置',
  149. 'default' => '',
  150. 'desc' => '特殊设置',
  151. 'match' => 'option',
  152. 'update' => 'checkbox',
  153. 'option' => $shop_set,
  154. ),
  155. 'card_type' => array
  156. (
  157. 'type' => 'int-11',
  158. 'name' => '卡号生成规则',
  159. 'default' => '3',
  160. 'desc' => '卡号生成规则',
  161. 'match' => 'is_numeric',
  162. 'update' => 'select',
  163. 'option' => $card_type,
  164. 'list_name' => '数量',
  165. 'list' => 'Dever::load("card/lib/manage.getNum", "{id}")',
  166. ),
  167. 'card_prefix' => array
  168. (
  169. 'type' => 'varchar-80',
  170. 'name' => '卡号前缀-前缀不占用卡号长度的位数,如卡号长度填写14,卡号前缀为Q,则生成卡号前缀+14位随机数',
  171. 'default' => '',
  172. 'desc' => '卡号前缀',
  173. 'match' => 'option',
  174. 'update' => 'text',
  175. ),
  176. 'card_len' => array
  177. (
  178. 'type' => 'int-11',
  179. 'name' => '卡号长度',
  180. 'default' => '14',
  181. 'desc' => '卡号长度',
  182. 'match' => 'is_numeric',
  183. 'update' => 'text',
  184. ),
  185. 'end_dh_day' => array
  186. (
  187. 'type' => 'int-11',
  188. 'name' => '兑换有效期-直接填写天数的数值',
  189. 'default' => '0',
  190. 'desc' => '兑换有效期',
  191. 'match' => 'is_numeric',
  192. 'update' => 'text',
  193. ),
  194. 'status' => array
  195. (
  196. 'type' => 'int-11',
  197. 'name' => '状态',
  198. 'default' => '1',
  199. 'desc' => '状态',
  200. 'match' => 'is_numeric',
  201. //'update' => 'select',
  202. 'option' => $status,
  203. 'search' => 'select',
  204. 'list' => true,
  205. 'edit' => true,
  206. ),
  207. 'content' => array
  208. (
  209. 'type' => 'text-255',
  210. 'name' => '规则介绍',
  211. 'default' => '',
  212. 'desc' => '请输入内容',
  213. 'match' => 'is_string',
  214. 'update' => 'textarea',
  215. 'key' => '1',
  216. ),
  217. 'reorder' => array
  218. (
  219. 'type' => 'int-11',
  220. 'name' => '排序-数值越大越靠前',
  221. 'default' => '1',
  222. 'desc' => '请输入排序',
  223. 'match' => 'option',
  224. 'update' => 'text',
  225. 'search' => 'order',
  226. 'list' => true,
  227. 'order' => 'desc',
  228. 'edit' => true,
  229. ),
  230. 'state' => array
  231. (
  232. 'type' => 'tinyint-1',
  233. 'name' => '状态',
  234. 'default' => '1',
  235. 'desc' => '请选择状态',
  236. 'match' => 'is_numeric',
  237. ),
  238. 'cdate' => array
  239. (
  240. 'type' => 'int-11',
  241. 'name' => '录入时间',
  242. 'match' => array('is_numeric', time()),
  243. 'desc' => '',
  244. # 只有insert时才生效
  245. 'insert' => true,
  246. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  247. ),
  248. ),
  249. 'manage' => array
  250. (
  251. 'list_button' => array
  252. (
  253. 'fast' => array('生成卡号', '"add&where_id=1&search_option_card_id={id}"', '{status} == 1'),
  254. 'list1' => array('卡号列表', '"code&search_option_card_id={id}&oper_table=info"'),
  255. 'location1' => array('可用商品设置', Dever::url('lib/goods_set.home', 'card')),
  256. ),
  257. ),
  258. 'request' => array
  259. (
  260. 'getDataByType' => array
  261. (
  262. # 匹配的正则或函数 选填项
  263. 'option' => array
  264. (
  265. 'buy' => 'yes',
  266. 'type_id' => array('yes', 'in'),
  267. 'create_type' => array('yes', 'in'),
  268. 'status' => 1,
  269. 'state' => 1,
  270. ),
  271. 'type' => 'all',
  272. 'order' => array('cdate' => 'desc'),
  273. 'col' => '*',
  274. ),
  275. ),
  276. );