coupon.php 6.6 KB

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