info.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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. //'list' => 'Dever::load("code/lib/manage.showUserInfo", "{uid}", "{ldate}")',
  61. ),
  62. 'product' => array
  63. (
  64. 'name' => '小刊',
  65. 'default' => '',
  66. 'desc' => '小刊',
  67. 'search' => 'linkage',
  68. 'search_col' => 'cate_id,product_id',
  69. 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
  70. ),
  71. 'cate_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '小刊分类',
  75. 'default' => '1',
  76. 'desc' => '小刊分类',
  77. 'match' => 'is_numeric',
  78. 'update' => 'select',
  79. 'option' => $cate,
  80. //'search' => 'select',
  81. 'list' => true,
  82. ),
  83. 'product_id' => array
  84. (
  85. 'type' => 'int-11',
  86. 'name' => '小刊',
  87. 'default' => '',
  88. 'desc' => '小刊',
  89. 'match' => 'is_numeric',
  90. 'update' => 'select',
  91. 'option' => $product,
  92. //'search' => 'select',
  93. 'list' => true,
  94. ),
  95. 'code' => array
  96. (
  97. 'type' => 'varchar-32',
  98. 'name' => '兑换码',
  99. 'default' => '',
  100. 'desc' => '兑换码',
  101. 'match' => 'is_string',
  102. 'update' => 'text',
  103. 'search' => 'fulltext',
  104. 'list' => '{create_uid} > 0 ? "用户创建" : "{code}"',
  105. 'list' => true,
  106. ),
  107. 'product_num' => array
  108. (
  109. 'type' => 'int-11',
  110. 'name' => '兑换本数',
  111. 'default' => '1',
  112. 'desc' => '兑换本数',
  113. 'match' => 'option',
  114. 'update' => 'text',
  115. 'search' => 'fulltext',
  116. 'list' => true,
  117. ),
  118. 'type' => array
  119. (
  120. 'type' => 'int-11',
  121. 'name' => '使用状态',
  122. 'default' => '1',
  123. 'desc' => '使用状态',
  124. 'match' => 'is_numeric',
  125. 'option' => $type,
  126. 'search' => 'select',
  127. 'update' => 'select',
  128. 'list' => true,
  129. 'mul' => array(1 => '恢复使用', 4 => '已作废'),
  130. ),
  131. 'seller_id' => array
  132. (
  133. 'type' => 'int-11',
  134. 'name' => '销售商',
  135. 'default' => '1',
  136. 'desc' => '销售商',
  137. 'match' => 'is_numeric',
  138. 'update' => 'select',
  139. 'option' => $seller,
  140. 'search' => 'select',
  141. 'list' => true,
  142. ),
  143. 'uid' => array
  144. (
  145. 'type' => 'int-11',
  146. 'name' => '用户信息',
  147. 'default' => '0',
  148. 'desc' => '用户信息',
  149. 'match' => 'is_numeric',
  150. 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}")',
  151. ),
  152. 'order_id' => array
  153. (
  154. 'type' => 'varchar-100',
  155. 'name' => '付款订单id',
  156. 'default' => '',
  157. 'desc' => '付款订单id',
  158. 'match' => 'is_string',
  159. 'update' => 'text',
  160. //'list' => true,
  161. //'list' => '"{order_id}" ? "{order_id}" : "{code}"',
  162. ),
  163. 'state' => array
  164. (
  165. 'type' => 'tinyint-1',
  166. 'name' => '状态',
  167. 'default' => '1',
  168. 'desc' => '请选择状态',
  169. 'match' => 'is_numeric',
  170. ),
  171. 'ldate' => array
  172. (
  173. 'type' => 'int-11',
  174. 'name' => '领取时间',
  175. 'match' => 'option',
  176. 'default' => '',
  177. 'desc' => '',
  178. //'search' => 'date',
  179. ),
  180. 'cdate' => array
  181. (
  182. 'type' => 'int-11',
  183. 'name' => '生成时间',
  184. 'match' => array('is_numeric', time()),
  185. 'desc' => '',
  186. # 只有insert时才生效
  187. 'insert' => true,
  188. 'search' => 'date',
  189. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  190. ),
  191. ),
  192. //'top' => Dever::config('base')->top,
  193. # 增加这个,为了给当前的list增加一个option
  194. 'top_option' => array
  195. (
  196. 'value' => $auth,
  197. 'col' => 'cate_id',
  198. ),
  199. 'manage' => array
  200. (
  201. 'excel' => true,
  202. 'delete' => false,
  203. 'edit' => false,
  204. 'insert' => false,
  205. 'mul' => '{type} == 1 || {type} == 4',
  206. # 自定义快捷新增和编辑
  207. 'button' => array
  208. (
  209. '新增兑换码' => array('fast', 1, 'config&where_id=1'),
  210. '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'),
  211. '新增销售商' => array('fast', 1, 'seller'),
  212. ),
  213. 'list_button' => array
  214. (
  215. 'oper' => array('作废', 'code/lib/manage.drop?id={id}', '{type} == 1'),
  216. 'oper2' => array('恢复使用', 'code/lib/manage.recovery?id={id}', '{type} == 4'),
  217. ),
  218. ),
  219. 'request' => array
  220. (
  221. 'getAll' => array
  222. (
  223. # 匹配的正则或函数 选填项
  224. 'option' => array
  225. (
  226. 'cate_id' => 'yes',
  227. 'create_uid' => 'yes',
  228. 'state' => 1,
  229. ),
  230. 'type' => 'all',
  231. 'order' => array('cdate' => 'desc'),
  232. 'page' => array(10, 'list'),
  233. 'col' => '*',
  234. ),
  235. )
  236. );