vote.php 2.1 KB

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