invite.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. $table = Dever::config('base')->type;
  3. return array
  4. (
  5. # 表名
  6. 'name' => 'invite',
  7. # 显示给用户看的名称
  8. 'lang' => '邀请排行榜',
  9. # 是否显示在后台菜单
  10. 'order' => 1,
  11. 'menu' => false,
  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. 'source_uid' => array
  26. (
  27. 'type' => 'int-11',
  28. 'name' => '邀请者',
  29. 'default' => '',
  30. 'desc' => '邀请者',
  31. 'match' => 'option',
  32. 'search' => array
  33. (
  34. 'api' => 'passport/user-all',
  35. 'col' => 'username',
  36. 'result' => 'id',
  37. ),
  38. 'list' => '{source_uid} > 0 ? Dever::load("passport/user-one#username", {source_uid}) : "匿名用户"',
  39. ),
  40. 'type' => array
  41. (
  42. 'type' => 'tinyint-1',
  43. 'name' => '邀请类型',
  44. 'default' => '',
  45. 'desc' => '邀请类型',
  46. 'match' => 'option',
  47. 'update' => 'select',
  48. //'search' => 'select',
  49. 'option' => $table,
  50. 'list' => true,
  51. ),
  52. 'data_id' => array
  53. (
  54. 'type' => 'int-11',
  55. 'name' => '标题',
  56. 'default' => '',
  57. 'desc' => '标题',
  58. 'update' => 'text',
  59. 'match' => 'option',
  60. 'list' => 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
  61. ),
  62. 'uid' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '被邀请者',
  66. 'default' => '0',
  67. 'desc' => '被邀请者',
  68. 'match' => 'is_numeric',
  69. 'update' => 'text',
  70. //'search' => 'select',
  71. 'search' => array
  72. (
  73. 'api' => 'passport/user-all',
  74. 'col' => 'username',
  75. 'result' => 'id',
  76. ),
  77. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  78. ),
  79. 'state' => array
  80. (
  81. 'type' => 'tinyint-1',
  82. 'name' => '状态',
  83. 'default' => '1',
  84. 'desc' => '请选择状态',
  85. 'match' => 'is_numeric',
  86. ),
  87. 'cdate' => array
  88. (
  89. 'type' => 'int-11',
  90. 'name' => '时间',
  91. 'match' => array('is_numeric', time()),
  92. 'desc' => '',
  93. # 只有insert时才生效
  94. 'insert' => true,
  95. //'search' => 'date',
  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. # request 请求接口定义
  106. 'request' => array
  107. (
  108. 'getAll' => array
  109. (
  110. # 匹配的正则或函数 选填项
  111. 'option' => array
  112. (
  113. 'source_uid' => 'yes',
  114. 'uid' => 'yes',
  115. 'data_id' => 'yes',
  116. 'type' => 'yes',
  117. 'avatar' => array('yes-t_2.avatar', '!='),
  118. 'state' => 1,
  119. ),
  120. # 联表
  121. 'join' => array
  122. (
  123. array
  124. (
  125. 'table' => 'passport/user',
  126. 'type' => 'left join',
  127. 'on' => array('uid','id'),
  128. 'col' => 't_2.username,t_2.avatar',
  129. ),
  130. ),
  131. 'type' => 'all',
  132. 'order' => array('t_1.id' => 'desc'),
  133. 'page' => array(10, 'list'),
  134. 'col' => '*',
  135. ),
  136. )
  137. );