like.php 2.3 KB

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