info.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. return array
  15. (
  16. # 表名
  17. 'name' => 'info',
  18. # 显示给用户看的名称
  19. 'lang' => '兑换码列表',
  20. 'menu' => 'journal',
  21. 'order' => 1,
  22. # 数据结构
  23. 'struct' => array
  24. (
  25. 'id' => array
  26. (
  27. 'type' => 'int-11',
  28. 'name' => 'ID',
  29. 'default' => '',
  30. 'desc' => '',
  31. 'match' => 'is_numeric',
  32. 'search' => 'order',
  33. //'list' => true,
  34. ),
  35. 'create_uid' => array
  36. (
  37. 'type' => 'int-11',
  38. 'name' => '创建人',
  39. 'default' => '-1',
  40. 'desc' => '创建人',
  41. 'match' => 'is_numeric',
  42. //'list' => 'Dever::load("code/lib/manage.showUserInfo", "{uid}", "{ldate}")',
  43. ),
  44. 'product_id' => array
  45. (
  46. 'type' => 'int-11',
  47. 'name' => '小刊',
  48. 'default' => '',
  49. 'desc' => '小刊',
  50. 'match' => 'is_numeric',
  51. 'update' => 'select',
  52. 'option' => $product,
  53. 'search' => 'select',
  54. 'list' => true,
  55. ),
  56. 'code' => array
  57. (
  58. 'type' => 'varchar-32',
  59. 'name' => '兑换码',
  60. 'default' => '',
  61. 'desc' => '兑换码',
  62. 'match' => 'is_string',
  63. 'update' => 'text',
  64. //'search' => 'fulltext',
  65. 'list' => '{create_uid} > 0 ? "用户创建" : "{code}"',
  66. 'list' => true,
  67. ),
  68. 'product_num' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => '兑换本数',
  72. 'default' => '1',
  73. 'desc' => '兑换本数',
  74. 'match' => 'option',
  75. 'update' => 'text',
  76. 'search' => 'fulltext',
  77. 'list' => true,
  78. ),
  79. 'type' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '使用状态',
  83. 'default' => '1',
  84. 'desc' => '使用状态',
  85. 'match' => 'is_numeric',
  86. 'option' => $type,
  87. 'search' => 'select',
  88. 'update' => 'select',
  89. 'list' => true,
  90. ),
  91. 'seller_id' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '销售商',
  95. 'default' => '1',
  96. 'desc' => '销售商',
  97. 'match' => 'is_numeric',
  98. 'update' => 'select',
  99. 'option' => $seller,
  100. 'search' => 'select',
  101. 'list' => true,
  102. ),
  103. 'uid' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '用户信息',
  107. 'default' => '0',
  108. 'desc' => '用户信息',
  109. 'match' => 'is_numeric',
  110. 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}")',
  111. ),
  112. 'state' => array
  113. (
  114. 'type' => 'tinyint-1',
  115. 'name' => '状态',
  116. 'default' => '1',
  117. 'desc' => '请选择状态',
  118. 'match' => 'is_numeric',
  119. ),
  120. 'ldate' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => '领取时间',
  124. 'match' => 'option',
  125. 'default' => '',
  126. 'desc' => '',
  127. //'search' => 'date',
  128. ),
  129. 'cdate' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '生成时间',
  133. 'match' => array('is_numeric', time()),
  134. 'desc' => '',
  135. # 只有insert时才生效
  136. 'insert' => true,
  137. 'search' => 'date',
  138. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  139. ),
  140. ),
  141. 'manage' => array
  142. (
  143. 'excel' => true,
  144. 'delete' => false,
  145. 'edit' => false,
  146. 'insert' => false,
  147. # 自定义快捷新增和编辑
  148. 'button' => array
  149. (
  150. '新增兑换码' => array('fast', 1, 'config&where_id=1'),
  151. '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'),
  152. '新增销售商' => array('fast', 1, 'seller'),
  153. ),
  154. ),
  155. 'request' => array
  156. (
  157. 'getAll' => array
  158. (
  159. # 匹配的正则或函数 选填项
  160. 'option' => array
  161. (
  162. 'create_uid' => 'yes',
  163. 'state' => 1,
  164. ),
  165. 'type' => 'all',
  166. 'order' => array('cdate' => 'desc'),
  167. 'page' => array(10, 'list'),
  168. 'col' => '*',
  169. ),
  170. )
  171. );