info.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <?php
  2. # 定义几个常用的选项
  3. $type = array
  4. (
  5. 1 => '未领取',
  6. 2 => '已领取',
  7. 3 => '已使用',
  8. 4 => '已作废',
  9. );
  10. $status = array
  11. (
  12. 1 => '不可用',
  13. 2 => '可用',
  14. );
  15. $product = function()
  16. {
  17. return Dever::db('course/info')->state();
  18. };
  19. $cate = function()
  20. {
  21. $array = array();
  22. $info = Dever::db('course/cate')->state();
  23. if($info)
  24. {
  25. $array += $info;
  26. }
  27. return $array;
  28. };
  29. return array
  30. (
  31. # 表名
  32. 'name' => 'info',
  33. # 显示给用户看的名称
  34. 'lang' => '认证码列表',
  35. 'menu' => 'course',
  36. 'order' => 1,
  37. 'auto' => 10000000,
  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. 'product' => array
  53. (
  54. 'name' => '课程',
  55. 'default' => '',
  56. 'desc' => '课程',
  57. 'search' => 'linkage',
  58. 'search_col' => 'cate_id,product_id',
  59. 'option' => Dever::url('lib/manage.search_cate_course', 'course'),
  60. ),
  61. 'cate_id' => array
  62. (
  63. 'type' => 'int-11',
  64. 'name' => '课程分类',
  65. 'default' => '1',
  66. 'desc' => '课程分类',
  67. 'match' => 'is_numeric',
  68. 'update' => 'select',
  69. 'option' => $cate,
  70. //'search' => 'select',
  71. 'list' => true,
  72. ),
  73. 'product_id' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => '课程',
  77. 'default' => '',
  78. 'desc' => '课程',
  79. 'match' => 'is_numeric',
  80. 'update' => 'select',
  81. 'option' => $product,
  82. //'search' => 'select',
  83. 'list' => '{product_id} > 0 ? Dever::load("course/info-one#name", {product_id}) : "通用"',
  84. ),
  85. 'code' => array
  86. (
  87. 'type' => 'varchar-32',
  88. 'name' => '认证码',
  89. 'default' => '',
  90. 'desc' => '认证码',
  91. 'match' => 'is_string',
  92. 'update' => 'text',
  93. 'search' => 'fulltext',
  94. 'list' => 'Dever::load("code/lib/manage.showCode", "{id}")',
  95. //'list' => true,
  96. ),
  97. 'type' => array
  98. (
  99. 'type' => 'int-11',
  100. 'name' => '使用状态',
  101. 'default' => '1',
  102. 'desc' => '使用状态',
  103. 'match' => 'is_numeric',
  104. 'option' => $type,
  105. 'search' => 'select',
  106. 'update' => 'select',
  107. 'list' => true,
  108. 'mul' => array(1 => '恢复使用', 4 => '已作废'),
  109. ),
  110. 'teacher_id' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => '使用者信息',
  114. 'default' => '0',
  115. 'desc' => '使用者信息',
  116. 'match' => 'is_numeric',
  117. 'list' => 'Dever::load("code/lib/manage.showUserInfo", "{teacher_id}", "{ldate}", "{type}")',
  118. ),
  119. 'state' => array
  120. (
  121. 'type' => 'tinyint-1',
  122. 'name' => '状态',
  123. 'default' => '1',
  124. 'desc' => '请选择状态',
  125. 'match' => 'is_numeric',
  126. ),
  127. 'ldate' => array
  128. (
  129. 'type' => 'int-11',
  130. 'name' => '领取时间',
  131. 'match' => 'option',
  132. 'default' => '',
  133. 'desc' => '',
  134. //'search' => 'date',
  135. ),
  136. 'cdate' => array
  137. (
  138. 'type' => 'int-11',
  139. 'name' => '生成时间',
  140. 'match' => array('is_numeric', time()),
  141. 'desc' => '',
  142. # 只有insert时才生效
  143. 'insert' => true,
  144. 'search' => 'date',
  145. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  146. ),
  147. ),
  148. 'manage' => array
  149. (
  150. 'excel' => true,
  151. 'delete' => false,
  152. 'edit' => false,
  153. 'insert' => false,
  154. 'mul' => '{type} == 1 || {type} == 4',
  155. # 自定义快捷新增和编辑
  156. 'button' => array
  157. (
  158. '新增认证码' => array('fast', 1, 'config&where_id=1'),
  159. ),
  160. 'list_button' => array
  161. (
  162. 'oper' => array('作废', 'code/lib/manage.drop?id={id}&course_id={product_id}&code={code}', '{type} == 1'),
  163. 'oper2' => array('恢复使用', 'code/lib/manage.recovery?id={id}&course_id={product_id}&code={code}', '{type} == 4'),
  164. ),
  165. ),
  166. 'request' => array
  167. (
  168. )
  169. );