info.php 11 KB

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