subscribe.php 4.2 KB

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