like.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. $table = Dever::config('base')->type;
  3. $table[11] = '评论';
  4. return array
  5. (
  6. # 表名
  7. 'name' => 'like',
  8. # 显示给用户看的名称
  9. 'lang' => '喜欢日志',
  10. # 是否显示在后台菜单
  11. 'order' => 79,
  12. 'menu' => false,
  13. # 数据结构
  14. 'struct' => array
  15. (
  16. 'id' => array
  17. (
  18. 'type' => 'int-11',
  19. 'name' => 'ID',
  20. 'default' => '',
  21. 'desc' => '',
  22. 'match' => 'is_numeric',
  23. 'order' => 'desc',
  24. //'list' => true,
  25. ),
  26. 'uid' => array
  27. (
  28. 'type' => 'int-11',
  29. 'name' => '用户名',
  30. 'default' => '0',
  31. 'desc' => '请选择用户',
  32. 'match' => 'is_numeric',
  33. //'update' => 'select',
  34. //'search' => 'select',
  35. 'search' => array
  36. (
  37. 'api' => 'passport/user-all',
  38. 'col' => 'username',
  39. 'result' => 'id',
  40. ),
  41. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  42. ),
  43. 'type' => array
  44. (
  45. 'type' => 'tinyint-1',
  46. 'name' => '喜欢类别',
  47. 'default' => '',
  48. 'desc' => '喜欢类别',
  49. 'match' => 'option',
  50. 'search' => 'select',
  51. 'option' => $table,
  52. 'list' => true,
  53. ),
  54. 'data_id' => array
  55. (
  56. 'type' => 'int-11',
  57. 'name' => '标题',
  58. 'default' => '',
  59. 'desc' => '标题',
  60. 'match' => 'option',
  61. 'list' => 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
  62. ),
  63. 'state' => array
  64. (
  65. 'type' => 'tinyint-1',
  66. 'name' => '状态',
  67. 'default' => '1',
  68. 'desc' => '请选择状态',
  69. 'match' => 'is_numeric',
  70. ),
  71. 'cdate' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '喜欢时间',
  75. 'match' => array('is_numeric', time()),
  76. 'desc' => '',
  77. # 只有insert时才生效
  78. 'insert' => true,
  79. 'search' => 'date',
  80. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  81. ),
  82. ),
  83. 'manage' => array
  84. (
  85. 'insert' => false,
  86. 'edit' => false,
  87. 'delete' => false,
  88. ),
  89. # request 请求接口定义
  90. 'request' => array
  91. (
  92. 'getAll' => array
  93. (
  94. # 匹配的正则或函数 选填项
  95. 'option' => array
  96. (
  97. 'uid' => 'yes',
  98. 'data_id' => 'yes',
  99. 'type' => array('yes', 'in'),
  100. 'state' => 1,
  101. ),
  102. 'type' => 'all',
  103. 'order' => array('id' => 'desc'),
  104. 'page' => array(15, 'list'),
  105. 'col' => 'uid,type,data_id,cdate',
  106. ),
  107. )
  108. );