vote.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '已赞',
  6. 2 => '取消赞',
  7. );
  8. $table = array
  9. (
  10. 1 => '主题',
  11. 2 => '评论',
  12. );
  13. return array
  14. (
  15. # 表名
  16. 'name' => 'vote',
  17. # 显示给用户看的名称
  18. 'lang' => '用户点赞管理',
  19. 'menu' => false,
  20. # 数据结构
  21. 'struct' => array
  22. (
  23. 'id' => array
  24. (
  25. 'type' => 'int-11',
  26. 'name' => 'ID',
  27. 'default' => '',
  28. 'desc' => '',
  29. 'match' => 'is_numeric',
  30. //'search' => 'order',
  31. //'list' => true,
  32. ),
  33. 'uid' => array
  34. (
  35. 'type' => 'int-11',
  36. 'name' => '用户',
  37. 'default' => '',
  38. 'desc' => '用户ID',
  39. 'match' => 'is_numeric',
  40. 'search' => 'order',
  41. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  42. ),
  43. 'source_table' => array
  44. (
  45. 'type' => 'tinyint-1',
  46. 'name' => '来源表',
  47. 'default' => '',
  48. 'desc' => '来源表',
  49. 'match' => 'option',
  50. 'option' => $table,
  51. ),
  52. 'source_id' => array
  53. (
  54. 'type' => 'int-11',
  55. 'name' => '主题',
  56. 'default' => '',
  57. 'desc' => '主题',
  58. 'match' => 'option',
  59. //'list' => '{source_table} == 1 ? Dever::load("main/jade-one#name", {source_id}) : Dever::load("main/master-one#name", {source_id})',
  60. ),
  61. 'ip' => array
  62. (
  63. 'type' => 'varchar-32',
  64. 'name' => 'IP',
  65. 'default' => '',
  66. 'desc' => '请输入IP',
  67. 'match' => 'option',
  68. 'update' => 'text',
  69. 'search' => 'fulltext',
  70. 'list' => true,
  71. ),
  72. 'state' => array
  73. (
  74. 'type' => 'tinyint-1',
  75. 'name' => '状态',
  76. 'default' => '1',
  77. 'desc' => '请选择状态',
  78. 'match' => 'is_numeric',
  79. 'option' => $option,
  80. //'update' => 'radio',
  81. 'list' => true,
  82. 'show' => 'yes',
  83. ),
  84. 'cdate' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '点赞时间',
  88. 'match' => array('is_numeric', time()),
  89. 'desc' => '',
  90. # 只有insert时才生效
  91. 'insert' => true,
  92. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  93. ),
  94. ),
  95. 'manage' => array
  96. (
  97. 'insert' => false,
  98. ),
  99. );