info.php 11 KB

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