info.php 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <?php
  2. # 定义几个常用的选项
  3. $type = array
  4. (
  5. 1 => '未领取',
  6. 2 => '已领取',
  7. 3 => '已使用',
  8. 4 => '已作废',
  9. );
  10. $product = Dever::load('journal/api.data');
  11. $seller = function()
  12. {
  13. return Dever::db('code/seller')->state();
  14. };
  15. # 获取小刊分类权限
  16. $auth = Dever::tops();
  17. $cate = function() use ($auth)
  18. {
  19. $array = array();
  20. if ($auth) {
  21. $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
  22. } else {
  23. $info = Dever::db('journal/cate')->state();
  24. }
  25. if($info)
  26. {
  27. $array += $info;
  28. }
  29. return $array;
  30. };
  31. return array
  32. (
  33. # 表名
  34. 'name' => 'info',
  35. # 显示给用户看的名称
  36. 'lang' => '兑换码列表',
  37. 'menu' => 'journal',
  38. 'order' => 1,
  39. # 数据结构
  40. 'struct' => array
  41. (
  42. 'id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => 'ID',
  46. 'default' => '',
  47. 'desc' => '',
  48. 'match' => 'is_numeric',
  49. 'search' => 'order',
  50. 'order' => 'desc',
  51. //'list' => true,
  52. ),
  53. 'create_uid' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '创建人',
  57. 'default' => '-1',
  58. 'desc' => '创建人',
  59. 'match' => 'is_numeric',
  60. 'search' => array
  61. (
  62. 'api' => 'passport/user-all',
  63. 'col' => 'username',
  64. 'result' => 'id',
  65. ),
  66. //'list' => 'Dever::load("code/lib/manage.showUserInfo", "{uid}", "{ldate}")',
  67. ),
  68. 'product' => array
  69. (
  70. 'name' => '小刊',
  71. 'default' => '',
  72. 'desc' => '小刊',
  73. 'search' => 'linkage',
  74. 'search_col' => 'cate_id,product_id',
  75. 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
  76. ),
  77. 'cate_id' => array
  78. (
  79. 'type' => 'int-11',
  80. 'name' => '小刊分类',
  81. 'default' => '1',
  82. 'desc' => '小刊分类',
  83. 'match' => 'is_numeric',
  84. 'update' => 'select',
  85. 'option' => $cate,
  86. //'search' => 'select',
  87. 'list' => true,
  88. ),
  89. 'product_id' => array
  90. (
  91. 'type' => 'int-11',
  92. 'name' => '小刊',
  93. 'default' => '',
  94. 'desc' => '小刊',
  95. 'match' => 'is_numeric',
  96. 'update' => 'select',
  97. 'option' => $product,
  98. //'search' => 'select',
  99. 'list' => '{product_id} > 0 ? Dever::load("journal/info-one#name", {product_id}) : "通用"',
  100. ),
  101. 'code' => array
  102. (
  103. 'type' => 'varchar-32',
  104. 'name' => '兑换码',
  105. 'default' => '',
  106. 'desc' => '兑换码',
  107. 'match' => 'is_string',
  108. 'update' => 'text',
  109. 'search' => 'fulltext',
  110. 'list' => '{create_uid} > 0 ? "用户创建" : "{code}"',
  111. 'list' => true,
  112. ),
  113. 'score' => array
  114. (
  115. 'type' => 'varchar-80',
  116. 'name' => '增加积分数-直接填写积分数,设置之后,积分规则里的设置及小刊兑换码中的设置将失效,当设置为0时,直接使用积分规则中的设置。当设置为-1时,不增加积分数',
  117. 'default' => '',
  118. 'desc' => '增加积分数',
  119. 'match' => 'is_string',
  120. //'update' => 'text',
  121. ),
  122. 'product_num' => array
  123. (
  124. 'type' => 'int-11',
  125. 'name' => '兑换本数',
  126. 'default' => '0',
  127. 'desc' => '兑换本数',
  128. 'match' => 'option',
  129. 'update' => 'text',
  130. 'search' => 'fulltext',
  131. 'list' => true,
  132. ),
  133. 'type' => array
  134. (
  135. 'type' => 'int-11',
  136. 'name' => '使用状态',
  137. 'default' => '1',
  138. 'desc' => '使用状态',
  139. 'match' => 'is_numeric',
  140. 'option' => $type,
  141. 'search' => 'select',
  142. 'update' => 'select',
  143. 'list' => true,
  144. 'mul' => array(1 => '恢复使用', 4 => '已作废'),
  145. ),
  146. 'seller_id' => array
  147. (
  148. 'type' => 'int-11',
  149. 'name' => '销售商',
  150. 'default' => '1',
  151. 'desc' => '销售商',
  152. 'match' => 'is_numeric',
  153. 'update' => 'select',
  154. 'option' => $seller,
  155. 'search' => 'select',
  156. 'list' => true,
  157. ),
  158. 'uid' => array
  159. (
  160. 'type' => 'int-11',
  161. 'name' => '用户信息',
  162. 'default' => '0',
  163. 'desc' => '用户信息',
  164. 'match' => 'is_numeric',
  165. 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}")',
  166. ),
  167. 'order_id' => array
  168. (
  169. 'type' => 'varchar-100',
  170. 'name' => '付款订单id',
  171. 'default' => '',
  172. 'desc' => '付款订单id',
  173. 'match' => 'is_string',
  174. 'update' => 'text',
  175. //'list' => true,
  176. //'list' => '"{order_id}" ? "{order_id}" : "{code}"',
  177. ),
  178. 'state' => array
  179. (
  180. 'type' => 'tinyint-1',
  181. 'name' => '状态',
  182. 'default' => '1',
  183. 'desc' => '请选择状态',
  184. 'match' => 'is_numeric',
  185. ),
  186. 'ldate' => array
  187. (
  188. 'type' => 'int-11',
  189. 'name' => '领取时间',
  190. 'match' => 'option',
  191. 'default' => '',
  192. 'desc' => '',
  193. //'search' => 'date',
  194. ),
  195. 'cdate' => array
  196. (
  197. 'type' => 'int-11',
  198. 'name' => '生成时间',
  199. 'match' => array('is_numeric', time()),
  200. 'desc' => '',
  201. # 只有insert时才生效
  202. 'insert' => true,
  203. 'search' => 'date',
  204. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  205. ),
  206. ),
  207. //'top' => Dever::config('base')->top,
  208. # 增加这个,为了给当前的list增加一个option
  209. 'top_option' => array
  210. (
  211. 'value' => $auth,
  212. 'col' => 'cate_id',
  213. ),
  214. # 更新表结构
  215. 'alter' => array
  216. (
  217. 2 => array
  218. (
  219. array('update', 'product_num', 'product_num', 'varchar-32 0 兑换本数'),
  220. //array('add', 'config', 'config', 'int-11 1 配置'),
  221. ),
  222. 'version' => 2,
  223. ),
  224. 'manage' => array
  225. (
  226. 'excel' => true,
  227. 'delete' => false,
  228. 'edit' => false,
  229. 'insert' => false,
  230. 'mul' => '{type} == 1 || {type} == 4',
  231. # 自定义快捷新增和编辑
  232. 'button' => array
  233. (
  234. '新增兑换码' => array('fast', 1, 'config&where_id=1'),
  235. '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'),
  236. '新增销售商' => array('fast', 1, 'seller'),
  237. ),
  238. 'list_button' => array
  239. (
  240. 'oper' => array('作废', 'code/lib/manage.drop?id={id}', '{type} == 1'),
  241. 'oper2' => array('恢复使用', 'code/lib/manage.recovery?id={id}', '{type} == 4'),
  242. ),
  243. ),
  244. 'request' => array
  245. (
  246. 'getAll' => array
  247. (
  248. # 匹配的正则或函数 选填项
  249. 'option' => array
  250. (
  251. 'cate_id' => 'yes',
  252. 'create_uid' => 'yes',
  253. 'state' => 1,
  254. ),
  255. 'type' => 'all',
  256. 'order' => array('cdate' => 'desc'),
  257. 'page' => array(10000, 'list'),
  258. 'col' => '*',
  259. ),
  260. )
  261. );