subscribe.php 4.2 KB

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