info.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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. ),
  67. 'product_num' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '兑换本数',
  71. 'default' => '1',
  72. 'desc' => '兑换本数',
  73. 'match' => 'option',
  74. 'update' => 'text',
  75. 'search' => 'fulltext',
  76. 'list' => true,
  77. ),
  78. 'type' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => '使用状态',
  82. 'default' => '1',
  83. 'desc' => '使用状态',
  84. 'match' => 'is_numeric',
  85. 'option' => $type,
  86. 'search' => 'select',
  87. 'update' => 'select',
  88. 'list' => true,
  89. ),
  90. 'seller_id' => array
  91. (
  92. 'type' => 'int-11',
  93. 'name' => '销售商',
  94. 'default' => '1',
  95. 'desc' => '销售商',
  96. 'match' => 'is_numeric',
  97. 'update' => 'select',
  98. 'option' => $seller,
  99. 'search' => 'select',
  100. 'list' => true,
  101. ),
  102. 'uid' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => '用户信息',
  106. 'default' => '0',
  107. 'desc' => '用户信息',
  108. 'match' => 'is_numeric',
  109. 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{create_uid}", "{uid}", "{ldate}")',
  110. ),
  111. 'state' => array
  112. (
  113. 'type' => 'tinyint-1',
  114. 'name' => '状态',
  115. 'default' => '1',
  116. 'desc' => '请选择状态',
  117. 'match' => 'is_numeric',
  118. ),
  119. 'ldate' => array
  120. (
  121. 'type' => 'int-11',
  122. 'name' => '领取时间',
  123. 'match' => 'option',
  124. 'default' => '',
  125. 'desc' => '',
  126. 'search' => 'date',
  127. ),
  128. 'cdate' => array
  129. (
  130. 'type' => 'int-11',
  131. 'name' => '生成时间',
  132. 'match' => array('is_numeric', time()),
  133. 'desc' => '',
  134. # 只有insert时才生效
  135. 'insert' => true,
  136. //'search' => 'date',
  137. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  138. ),
  139. ),
  140. 'manage' => array
  141. (
  142. 'excel' => true,
  143. 'delete' => false,
  144. 'edit' => false,
  145. 'insert' => false,
  146. # 自定义快捷新增和编辑
  147. 'button' => array
  148. (
  149. '新增兑换码' => array('fast', 1, 'config&where_id=1'),
  150. '销售商列表' => array('list', 'seller&project=code&oper_parent=info&oper_project=code'),
  151. '新增销售商' => array('fast', 1, 'seller'),
  152. ),
  153. ),
  154. 'request' => array
  155. (
  156. 'getAll' => array
  157. (
  158. # 匹配的正则或函数 选填项
  159. 'option' => array
  160. (
  161. 'create_uid' => 'yes',
  162. 'state' => 1,
  163. ),
  164. 'type' => 'all',
  165. 'order' => array('cdate' => 'desc'),
  166. 'page' => array(10, 'list'),
  167. 'col' => '*',
  168. ),
  169. )
  170. );