info.php 10 KB

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