invite.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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' => '邀请者-填写uid',
  29. 'default' => '',
  30. 'desc' => '邀请者',
  31. 'match' => 'option',
  32. 'update' => 'text',
  33. 'search' => array
  34. (
  35. 'api' => 'passport/user-all',
  36. 'col' => 'username',
  37. 'result' => 'id',
  38. ),
  39. 'list' => '{source_uid} > 0 ? Dever::load("passport/user-one#username", {source_uid}) : "匿名用户"',
  40. ),
  41. 'type' => array
  42. (
  43. 'type' => 'tinyint-1',
  44. 'name' => '邀请类型',
  45. 'default' => '',
  46. 'desc' => '邀请类型',
  47. 'match' => 'option',
  48. 'update' => 'select',
  49. //'search' => 'select',
  50. 'option' => $table,
  51. 'list' => true,
  52. ),
  53. 'data_id' => array
  54. (
  55. 'type' => 'int-11',
  56. 'name' => '标题-填写id',
  57. 'default' => '',
  58. 'desc' => '标题',
  59. 'update' => 'text',
  60. 'match' => 'option',
  61. 'list' => '{type} >0 ? Dever::load("act/lib/manage.load", "{type}", "{data_id}") : "未知"',
  62. ),
  63. 'uid' => array
  64. (
  65. 'type' => 'int-11',
  66. 'name' => '被邀请者-填写uid',
  67. 'default' => '0',
  68. 'desc' => '被邀请者',
  69. 'match' => 'is_numeric',
  70. 'update' => 'text',
  71. //'search' => 'select',
  72. 'search' => array
  73. (
  74. 'api' => 'passport/user-all',
  75. 'col' => 'username',
  76. 'result' => 'id',
  77. ),
  78. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  79. ),
  80. 'state' => array
  81. (
  82. 'type' => 'tinyint-1',
  83. 'name' => '状态',
  84. 'default' => '1',
  85. 'desc' => '请选择状态',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'cdate' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '时间',
  92. 'match' => array('is_numeric', time()),
  93. 'desc' => '',
  94. # 只有insert时才生效
  95. 'insert' => true,
  96. //'search' => 'date',
  97. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  98. ),
  99. ),
  100. 'manage' => array
  101. (
  102. 'insert' => false,
  103. 'edit' => false,
  104. 'delete' => false,
  105. ),
  106. # request 请求接口定义
  107. 'request' => array
  108. (
  109. 'getAll' => array
  110. (
  111. # 匹配的正则或函数 选填项
  112. 'option' => array
  113. (
  114. 'source_uid' => 'yes',
  115. 'uid' => 'yes',
  116. 'data_id' => 'yes',
  117. 'type' => 'yes',
  118. 'avatar' => array('yes-t_2.avatar', '!='),
  119. 'state' => 1,
  120. ),
  121. # 联表
  122. 'join' => array
  123. (
  124. array
  125. (
  126. 'table' => 'passport/user',
  127. 'type' => 'left join',
  128. 'on' => array('uid','id'),
  129. 'col' => 't_2.username,t_2.avatar',
  130. ),
  131. ),
  132. 'type' => 'all',
  133. 'order' => array('t_1.id' => 'desc'),
  134. 'page' => array(50, 'list'),
  135. 'col' => '*',
  136. ),
  137. )
  138. );