info.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. ),
  130. 'seller_id' => array
  131. (
  132. 'type' => 'int-11',
  133. 'name' => '销售商',
  134. 'default' => '1',
  135. 'desc' => '销售商',
  136. 'match' => 'is_numeric',
  137. 'update' => 'select',
  138. 'option' => $seller,
  139. 'search' => 'select',
  140. 'list' => true,
  141. ),
  142. 'uid' => array
  143. (
  144. 'type' => 'int-11',
  145. 'name' => '用户信息',
  146. 'default' => '0',
  147. 'desc' => '用户信息',
  148. 'match' => 'is_numeric',
  149. 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}")',
  150. ),
  151. 'order_id' => array
  152. (
  153. 'type' => 'varchar-100',
  154. 'name' => '付款订单id',
  155. 'default' => '',
  156. 'desc' => '付款订单id',
  157. 'match' => 'is_string',
  158. 'update' => 'text',
  159. //'list' => true,
  160. //'list' => '"{order_id}" ? "{order_id}" : "{code}"',
  161. ),
  162. 'state' => array
  163. (
  164. 'type' => 'tinyint-1',
  165. 'name' => '状态',
  166. 'default' => '1',
  167. 'desc' => '请选择状态',
  168. 'match' => 'is_numeric',
  169. ),
  170. 'ldate' => array
  171. (
  172. 'type' => 'int-11',
  173. 'name' => '领取时间',
  174. 'match' => 'option',
  175. 'default' => '',
  176. 'desc' => '',
  177. //'search' => 'date',
  178. ),
  179. 'cdate' => array
  180. (
  181. 'type' => 'int-11',
  182. 'name' => '生成时间',
  183. 'match' => array('is_numeric', time()),
  184. 'desc' => '',
  185. # 只有insert时才生效
  186. 'insert' => true,
  187. 'search' => 'date',
  188. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  189. ),
  190. ),
  191. 'top' => Dever::config('base')->top,
  192. # 增加这个,为了给当前的list增加一个option
  193. 'top_option' => array
  194. (
  195. 'value' => $auth,
  196. 'col' => 'cate_id',
  197. ),
  198. 'manage' => array
  199. (
  200. 'excel' => true,
  201. 'delete' => false,
  202. 'edit' => false,
  203. 'insert' => false,
  204. # 自定义快捷新增和编辑
  205. 'button' => array
  206. (
  207. '新增兑换码' => array('fast', 1, 'config&where_id=1'),
  208. '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'),
  209. '新增销售商' => array('fast', 1, 'seller'),
  210. ),
  211. 'list_button' => array
  212. (
  213. 'oper' => array('作废', ''),
  214. ),
  215. ),
  216. 'request' => array
  217. (
  218. 'getAll' => array
  219. (
  220. # 匹配的正则或函数 选填项
  221. 'option' => array
  222. (
  223. 'cate_id' => 'yes',
  224. 'create_uid' => 'yes',
  225. 'state' => 1,
  226. ),
  227. 'type' => 'all',
  228. 'order' => array('cdate' => 'desc'),
  229. 'page' => array(10, 'list'),
  230. 'col' => '*',
  231. ),
  232. )
  233. );