info.php 11 KB

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