subscribe.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <?php
  2. $table = Dever::config('base')->type;
  3. $source = array
  4. (
  5. 1 => '购买',
  6. 2 => '兑换码',
  7. 3 => '邀请活动',
  8. 4 => '免费阅读',
  9. );
  10. return array
  11. (
  12. # 表名
  13. 'name' => 'subscribe',
  14. # 显示给用户看的名称
  15. 'lang' => '订阅日志',
  16. # 是否显示在后台菜单
  17. 'order' => 68,
  18. # 数据结构
  19. 'struct' => array
  20. (
  21. 'id' => array
  22. (
  23. 'type' => 'int-11',
  24. 'name' => 'ID',
  25. 'default' => '',
  26. 'desc' => '',
  27. 'match' => 'is_numeric',
  28. 'order' => 'desc',
  29. //'list' => true,
  30. ),
  31. 'uid' => array
  32. (
  33. 'type' => 'int-11',
  34. 'name' => '用户名',
  35. 'default' => '0',
  36. 'desc' => '请选择用户',
  37. 'match' => 'is_numeric',
  38. 'update' => 'text',
  39. //'search' => 'select',
  40. 'search' => array
  41. (
  42. 'api' => 'passport/user-all',
  43. 'col' => 'username',
  44. 'result' => 'id',
  45. ),
  46. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  47. ),
  48. 'type' => array
  49. (
  50. 'type' => 'tinyint-1',
  51. 'name' => '订阅类别',
  52. 'default' => '',
  53. 'desc' => '订阅类别',
  54. 'match' => 'option',
  55. 'update' => 'select',
  56. //'search' => 'select',
  57. 'option' => $table,
  58. //'list' => true,
  59. ),
  60. 'data_id' => array
  61. (
  62. 'type' => 'int-11',
  63. 'name' => '标题',
  64. 'default' => '',
  65. 'desc' => '标题',
  66. 'update' => 'text',
  67. 'match' => 'option',
  68. 'list' => 'Dever::load("act/lib/manage.load", "{type}", {data_id})',
  69. ),
  70. 'source' => array
  71. (
  72. 'type' => 'tinyint-1',
  73. 'name' => '来源',
  74. 'default' => '',
  75. 'desc' => '来源',
  76. 'match' => 'option',
  77. 'update' => 'select',
  78. 'search' => 'select',
  79. 'option' => $source,
  80. 'list' => true,
  81. ),
  82. 'state' => array
  83. (
  84. 'type' => 'tinyint-1',
  85. 'name' => '状态',
  86. 'default' => '1',
  87. 'desc' => '请选择状态',
  88. 'match' => 'is_numeric',
  89. ),
  90. 'cdate' => array
  91. (
  92. 'type' => 'int-11',
  93. 'name' => '喜欢时间',
  94. 'match' => array('is_numeric', time()),
  95. 'desc' => '',
  96. # 只有insert时才生效
  97. 'insert' => true,
  98. 'search' => 'date',
  99. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  100. ),
  101. ),
  102. 'manage' => array
  103. (
  104. 'insert' => false,
  105. 'edit' => false,
  106. 'delete' => false,
  107. ),
  108. # request 请求接口定义
  109. 'request' => array
  110. (
  111. 'getAll' => array
  112. (
  113. # 匹配的正则或函数 选填项
  114. 'option' => array
  115. (
  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_2.id' => 'desc'),
  134. 'page' => array(6, 'list'),
  135. 'col' => '*',
  136. ),
  137. 'getMyAll' => array
  138. (
  139. # 匹配的正则或函数 选填项
  140. 'option' => array
  141. (
  142. 'data_id' => 'yes',
  143. 'type' => 'yes',
  144. 'source' => array('yes', 'in'),
  145. 'cate_id' => 'yes-t_2.cate_id',
  146. 'state' => 1,
  147. ),
  148. # 联表
  149. 'join' => array
  150. (
  151. array
  152. (
  153. 'table' => 'journal/info',
  154. 'type' => 'left join',
  155. 'on' => array('data_id','id'),
  156. ),
  157. ),
  158. 'type' => 'all',
  159. 'order' => array('t_1.id' => 'desc'),
  160. 'page' => array(1, 'list'),
  161. 'col' => '*,t_2.*,t_2.num_add_view+t_2.num_view as num_view,ROUND((t_2.num_ding+t_2.num_add_ding)*t_2.num_ratio_ding) as num_ding',
  162. ),
  163. )
  164. );