vote.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. $table = array
  3. (
  4. 1 => '资讯',
  5. 2 => '课程',
  6. 3 => '会议',
  7. 4 => '评论',
  8. );
  9. $info = function()
  10. {
  11. $array = array();
  12. $info = Dever::load('set/info-state');
  13. if($info)
  14. {
  15. $array += $info;
  16. }
  17. return $array;
  18. };
  19. return array
  20. (
  21. # 表名
  22. 'name' => 'vote',
  23. # 显示给用户看的名称
  24. 'lang' => '用户点赞管理',
  25. 'order' => 100,
  26. # 数据结构
  27. 'struct' => array
  28. (
  29. 'id' => array
  30. (
  31. 'type' => 'int-11',
  32. 'name' => 'ID',
  33. 'default' => '',
  34. 'desc' => '',
  35. 'match' => 'is_numeric',
  36. //'search' => 'order',
  37. 'list' => true,
  38. ),
  39. 'uid' => array
  40. (
  41. 'type' => 'int-11',
  42. 'name' => '用户',
  43. 'default' => '',
  44. 'desc' => '用户ID',
  45. 'match' => 'is_numeric',
  46. 'search' => 'order',
  47. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#name", {uid}) : "匿名用户"',
  48. ),
  49. 'info_id' => array
  50. (
  51. 'type' => 'int-11',
  52. 'name' => '所属小程序',
  53. 'default' => '1',
  54. 'desc' => '请选择所属小程序',
  55. 'match' => 'is_numeric',
  56. 'update' => 'select',
  57. 'option' => $info,
  58. 'search' => 'select',
  59. 'list' => '{info_id} > 0 ? Dever::load("set/info-one#name", {info_id}) : "未知"',
  60. ),
  61. 'source_table' => array
  62. (
  63. 'type' => 'tinyint-1',
  64. 'name' => '点赞类别',
  65. 'default' => '',
  66. 'desc' => '点赞类别',
  67. 'match' => 'option',
  68. 'option' => $table,
  69. 'list' => true,
  70. ),
  71. 'source_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '标题或内容',
  75. 'default' => '',
  76. 'desc' => '标题',
  77. 'match' => 'option',
  78. 'list' => 'Dever::load("set/manage.load", "{source_table}", {source_id})',
  79. ),
  80. 'state' => array
  81. (
  82. 'type' => 'tinyint-1',
  83. 'name' => '状态',
  84. 'default' => '1',
  85. 'desc' => '请选择状态',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'cdate' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '点赞时间',
  92. 'match' => array('is_numeric', time()),
  93. 'desc' => '',
  94. # 只有insert时才生效
  95. 'insert' => true,
  96. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  97. ),
  98. ),
  99. 'manage' => array
  100. (
  101. 'insert' => false,
  102. 'edit' => false,
  103. 'delete' => false,
  104. ),
  105. );