discount.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <?php
  2. $role = array
  3. (
  4. 1 => '代理商角色',
  5. );
  6. $cate = function()
  7. {
  8. $where['project_id'] = 1;
  9. return Dever::db('category/info')->getTop($where);
  10. };
  11. $list_button = array();
  12. if(Dever::load('manage/auth')->checkFunc('act.discount', 'shopset', '商品设置')){
  13. $list_button['location'] = array('商品设置', Dever::url('lib/goods_set.home', 'act'));
  14. }
  15. return array
  16. (
  17. # 表名
  18. 'name' => 'discount',
  19. # 显示给用户看的名称
  20. 'lang' => '角色折扣管理',
  21. 'order' => 90,
  22. # 数据结构
  23. 'struct' => array
  24. (
  25. 'id' => array
  26. (
  27. 'type' => 'int-11',
  28. 'name' => 'ID',
  29. 'default' => '',
  30. 'desc' => '',
  31. 'match' => 'is_numeric',
  32. 'list' => true,
  33. ),
  34. 'role' => array
  35. (
  36. 'type' => 'int-11',
  37. 'name' => '折扣角色',
  38. 'default' => '1',
  39. 'desc' => '折扣角色',
  40. 'match' => 'is_numeric',
  41. 'update' => 'select',
  42. 'option' => $role,
  43. 'search' => 'radio',
  44. 'list' => true,
  45. ),
  46. 'name' => array
  47. (
  48. 'type' => 'varchar-80',
  49. 'name' => '折扣标题',
  50. 'default' => '',
  51. 'desc' => '标题',
  52. 'match' => 'is_string',
  53. 'update' => 'text',
  54. 'list' => true,
  55. 'search' => 'fulltext',
  56. ),
  57. 'num' => array
  58. (
  59. 'type' => 'decimal-11,2',
  60. 'name' => '折扣数值-直接填写折扣的数值,如填写9,就是9折,如一个角色填写了多个折扣,支付时自动使用最低折扣结算',
  61. 'default' => '9',
  62. 'desc' => '折扣数值',
  63. 'match' => 'is_string',
  64. 'update' => 'text',
  65. 'list' => true,
  66. ),
  67. 'category' => array
  68. (
  69. 'type' => 'varchar-500',
  70. 'name' => '可用商品分类-不选择则所有商品可用',
  71. 'default' => '',
  72. 'desc' => '可用商品分类',
  73. 'match' => 'option',
  74. //'search' => 'linkage',
  75. 'update' => 'checkbox',
  76. 'option' => $cate,
  77. //'option' => Dever::url('api.get', 'category'),
  78. //'list' => 'Dever::load("category/api.string", "{category}")',
  79. ),
  80. 'state' => array
  81. (
  82. 'type' => 'tinyint-1',
  83. 'name' => '状态',
  84. 'default' => '1',
  85. 'desc' => '请选择状态',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'cdate' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '录入时间',
  92. 'match' => array('is_numeric', time()),
  93. 'desc' => '',
  94. # 只有insert时才生效
  95. 'insert' => true,
  96. ),
  97. ),
  98. # 默认值
  99. 'default' => array
  100. (
  101. 'col' => 'name,role,num,state,cdate',
  102. 'value' => array
  103. (
  104. '"代理优惠",1,9,1,' . time(),
  105. ),
  106. ),
  107. 'alter' => array
  108. (
  109. 5 => array
  110. (
  111. array('update', 'num', 'num', 'decimal-11,2 9 折扣数值'),
  112. ),
  113. 'version' => 5,
  114. ),
  115. # 管理功能
  116. 'manage' => array
  117. (
  118. //'insert' => false,
  119. //'edit' => false,
  120. //'delete' => false,
  121. # 列表
  122. 'list_button' => $list_button,
  123. // array
  124. // (
  125. // //'edit' => array('预览', str_replace('https://api.', 'http://www.', Dever::url('main/preview.get?type=1'))),
  126. // 'location' => array('商品设置', Dever::url('lib/goods_set.home', 'act')),
  127. // ),
  128. ),
  129. # request 请求接口定义
  130. 'request' => array
  131. (
  132. 'getAll' => array
  133. (
  134. # 匹配的正则或函数 选填项
  135. 'option' => array
  136. (
  137. 'role' => 1,
  138. 'state' => 1,
  139. ),
  140. 'type' => 'all',
  141. 'order' => array('num' => 'asc', 'id' => 'asc'),
  142. 'col' => '*',
  143. ),
  144. ),
  145. );