coupon.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <?php
  2. $shop_id = Dever::input('search_option_shop_id');
  3. $method = Dever::db('goods/coupon')->config['method'];
  4. $time = array
  5. (
  6. 3 => '3天',
  7. 7 => '7天',
  8. 15 => '15天',
  9. 30 => '30天',
  10. 90 => '90天',
  11. 182 => '182天',
  12. 365 => '365天',
  13. );
  14. return array
  15. (
  16. # 表名
  17. 'name' => 'coupon',
  18. # 显示给用户看的名称
  19. 'lang' => '优惠券设置',
  20. 'menu' => false,
  21. 'time' => $time,
  22. 'check' => 'shop_id,coupon',
  23. 'end' => array
  24. (
  25. 'insert' => 'shop/lib/manage.couponUpdate',
  26. 'update' => 'shop/lib/manage.couponUpdate',
  27. ),
  28. # 数据结构
  29. 'struct' => array
  30. (
  31. 'id' => array
  32. (
  33. 'type' => 'int-11',
  34. 'name' => 'ID',
  35. 'default' => '',
  36. 'desc' => '',
  37. 'match' => 'is_numeric',
  38. 'search' => 'order',
  39. 'update' => 'hidden',
  40. //'list' => true,
  41. ),
  42. 'shop_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '所属门店',
  46. 'default' => '',
  47. 'desc' => '所属门店',
  48. 'match' => 'is_numeric',
  49. 'update' => 'hidden',
  50. 'search' => 'hidden',
  51. 'value' => Dever::input('search_option_shop_id'),
  52. 'list' => 'Dever::load("shop/info-find#name", {shop_id})',
  53. ),
  54. 'coupon' => array
  55. (
  56. 'type' => 'varchar-500',
  57. 'name' => '优惠券',
  58. 'default' => '',
  59. 'desc' => '优惠券',
  60. 'match' => 'option',
  61. //'search' => 'linkage',
  62. 'update' => 'linkage',
  63. 'option' => Dever::url('lib/coupon.get', 'goods'),
  64. ),
  65. 'method' => array
  66. (
  67. 'type' => 'int-11',
  68. 'name' => '优惠券属性',
  69. 'default' => '',
  70. 'desc' => '优惠券属性',
  71. 'match' => 'option',
  72. 'search' => 'select',
  73. //'update' => 'select',
  74. 'option' => $method,
  75. 'list' => true,
  76. ),
  77. 'coupon_id' => array
  78. (
  79. 'type' => 'int-11',
  80. 'name' => '优惠券',
  81. 'default' => '',
  82. 'desc' => '优惠券',
  83. 'match' => 'option',
  84. 'list' => 'Dever::load("goods/coupon-find#name", {coupon_id})',
  85. ),
  86. 'city' => array
  87. (
  88. 'type' => 'int-11',
  89. 'name' => '城市',
  90. 'default' => '',
  91. 'desc' => '城市',
  92. 'match' => 'option',
  93. //'update' => 'hidden',
  94. //'value' => Dever::input('search_option_city'),
  95. ),
  96. 'day' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '有效期-请选择天数',
  100. 'default' => '7',
  101. 'desc' => '有效期',
  102. 'match' => 'is_numeric',
  103. 'update' => 'select',
  104. 'option' => $time,
  105. ),
  106. 'num' => array
  107. (
  108. 'type' => 'int-11',
  109. 'name' => '发放数量-数量为0则不限量',
  110. 'default' => '10',
  111. 'desc' => '发放数量',
  112. 'match' => 'is_string',
  113. 'update' => 'text',
  114. 'list' => true,
  115. ),
  116. 'act_num' => array
  117. (
  118. 'type' => 'int-11',
  119. 'name' => '已用数量',
  120. 'default' => '0',
  121. 'desc' => '已用数量',
  122. 'match' => 'is_string',
  123. //'update' => 'text',
  124. 'list_name' => '剩余数量',
  125. 'list' => '{num}-{act_num}',
  126. ),
  127. 'state' => array
  128. (
  129. 'type' => 'tinyint-1',
  130. 'name' => '状态',
  131. 'default' => '1',
  132. 'desc' => '请选择状态',
  133. 'match' => 'is_numeric',
  134. ),
  135. 'cdate' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '创建时间',
  139. 'match' => array('is_numeric', time()),
  140. 'desc' => '',
  141. # 只有insert时才生效
  142. //'insert' => true,
  143. 'search' => 'date',
  144. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  145. ),
  146. ),
  147. 'manage' => array
  148. (
  149. 'button' => array
  150. (
  151. //'分享领取优惠券活动设置' => array('fast', 1, 'coupon_act_1&where_id='.$shop_id.'&search_option_shop_id='.$shop_id),
  152. ),
  153. ),
  154. 'request' => array
  155. (
  156. # 列表
  157. 'getAllPage' => array
  158. (
  159. # 匹配的正则或函数 选填项
  160. 'option' => array
  161. (
  162. 'shop_id' => 'yes',
  163. 'method' => 'yes',
  164. 'state' => 1,
  165. ),
  166. 'type' => 'all',
  167. 'page' => array(10, 'list'),
  168. 'order' => array('id' => 'desc'),
  169. 'col' => '*,num-act_num as num',
  170. ),
  171. # 列表
  172. 'getAll' => array
  173. (
  174. # 匹配的正则或函数 选填项
  175. 'option' => array
  176. (
  177. 'shop_id' => 'yes',
  178. 'method' => 'yes',
  179. 'state' => 1,
  180. ),
  181. 'type' => 'all',
  182. 'order' => array('id' => 'desc'),
  183. 'col' => '*,num-act_num as num',
  184. ),
  185. 'getData' => array
  186. (
  187. # 匹配的正则或函数 选填项
  188. 'option' => array
  189. (
  190. 'id' => 'yes',
  191. 'shop_id' => 'yes',
  192. 'coupon_id' => 'yes',
  193. 'method' => 'yes',
  194. 'state' => 1,
  195. ),
  196. 'type' => 'all',
  197. 'order' => array('id' => 'desc'),
  198. 'col' => '*,num-act_num as total',
  199. ),
  200. 'getOne' => array
  201. (
  202. # 匹配的正则或函数 选填项
  203. 'option' => array
  204. (
  205. 'id' => 'yes',
  206. 'shop_id' => 'yes',
  207. 'coupon_id' => 'yes',
  208. 'method' => 'yes',
  209. 'state' => 1,
  210. ),
  211. 'type' => 'one',
  212. 'col' => '*,num-act_num as total',
  213. ),
  214. # 更新使用量
  215. 'updateNum' => array
  216. (
  217. 'type' => 'update',
  218. 'where' => array
  219. (
  220. 'id' => 'yes',
  221. ),
  222. 'set' => array
  223. (
  224. 'act_num' => array('yes', '+='),
  225. ),
  226. ),
  227. ),
  228. );