info.php 8.2 KB

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