info.php 5.2 KB

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