focus.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?php
  2. $info = function()
  3. {
  4. $array = array();
  5. $info = Dever::load('set/info-state');
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $cate = function()
  13. {
  14. $array = array();
  15. $cate = Dever::load('set/cate-mainAll');
  16. if($cate)
  17. {
  18. $array += $cate;
  19. }
  20. return $array;
  21. };
  22. $cate_child = function()
  23. {
  24. $cate = Dever::load('set/cate-childAll');
  25. return $cate;
  26. };
  27. # 栏目
  28. $search_cate = function()
  29. {
  30. $array = array
  31. (
  32. -1 => array('id' => '-1', 'name' => '所有栏目'),
  33. );
  34. $cate = Dever::load('set/manage.cate');
  35. if($cate)
  36. {
  37. $array += $cate;
  38. }
  39. return $array;
  40. };
  41. return array
  42. (
  43. # 表名
  44. 'name' => 'focus',
  45. # 显示给用户看的名称
  46. 'lang' => '首页焦点图',
  47. 'order' => 50,
  48. 'menu' => false,
  49. # 数据结构
  50. 'struct' => array
  51. (
  52. 'id' => array
  53. (
  54. 'type' => 'int-11',
  55. 'name' => 'ID',
  56. 'default' => '',
  57. 'desc' => '',
  58. 'match' => 'is_numeric',
  59. 'search' => 'order',
  60. 'list' => true,
  61. ),
  62. 'name' => array
  63. (
  64. 'type' => 'varchar-80',
  65. 'name' => '标题',
  66. 'default' => '',
  67. 'desc' => '标题',
  68. 'match' => 'is_string',
  69. 'update' => 'text',
  70. 'search' => 'fulltext',
  71. 'list' => true,
  72. ),
  73. 'subname' => array
  74. (
  75. 'type' => 'varchar-80',
  76. 'name' => '子标题',
  77. 'default' => '',
  78. 'desc' => '子标题',
  79. 'match' => 'is_string',
  80. 'update' => 'text',
  81. //'search' => 'fulltext',
  82. //'list' => true,
  83. ),
  84. 'info_id' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '所属小程序',
  88. 'default' => '1',
  89. 'desc' => '请选择所属小程序',
  90. 'match' => 'is_numeric',
  91. 'update' => 'select',
  92. 'option' => $info,
  93. 'search' => 'select',
  94. 'list' => '{info_id} > 0 ? Dever::load("set/info-one#name", {info_id}) : "未知"',
  95. ),
  96. 'cate_id_parent' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '父级栏目',
  100. 'default' => '0',
  101. 'desc' => '请选择父级栏目',
  102. 'match' => 'is_numeric',
  103. 'update' => 'select',
  104. //'search' => 'order,select',
  105. //'list' => '{cate_id_parent} > 0 ? Dever::load("set/cate-one#name", {cate_id_parent}) : "临时栏目"',
  106. 'option' => $cate,
  107. # 当值改变时,执行下一步操作
  108. 'child_name' => 'cate_id',
  109. 'child' => $cate_child,
  110. 'child_value' => '{cate_id}',
  111. ),
  112. 'cate_id' => array
  113. (
  114. 'type' => 'int-11',
  115. 'name' => '子栏目',
  116. 'default' => '0',
  117. 'desc' => '请选择子栏目',
  118. 'match' => 'is_numeric',
  119. 'search' => 'group',
  120. 'option' => $search_cate,
  121. 'list_name' => '栏目',
  122. 'list' => '{cate_id} > 0 ? Dever::load("set/cate-one#name", {cate_id}) : "无子栏目"',
  123. ),
  124. 'pic' => array
  125. (
  126. 'type' => 'varchar-150',
  127. 'name' => '图片',
  128. 'default' => '',
  129. 'desc' => '图片',
  130. 'match' => 'is_string',
  131. 'update' => 'image',
  132. 'key' => '1',
  133. 'place' => '150',
  134. ),
  135. 'news_id' => array
  136. (
  137. 'type' => 'int-11',
  138. 'name' => '资讯id',
  139. 'default' => '',
  140. 'desc' => '资讯id',
  141. 'match' => 'is_numeric',
  142. 'update' => 'text',
  143. 'list_name' => '资讯名称',
  144. 'list' => '{news_id} > 0 ? Dever::load("content/news-one#name", {news_id}) : "未知"',
  145. ),
  146. 'reorder' => array
  147. (
  148. 'type' => 'int-11',
  149. 'name' => '排序(数值越大越靠前)',
  150. 'default' => '1',
  151. 'desc' => '请输入排序',
  152. 'match' => 'option',
  153. 'update' => 'text',
  154. 'search' => 'order',
  155. 'list_name' => '排序',
  156. 'list' => true,
  157. 'order' => 'desc',
  158. 'edit' => true,
  159. ),
  160. 'state' => array
  161. (
  162. 'type' => 'tinyint-1',
  163. 'name' => '状态',
  164. 'default' => '1',
  165. 'desc' => '请选择状态',
  166. 'match' => 'is_numeric',
  167. ),
  168. 'cdate' => array
  169. (
  170. 'type' => 'int-11',
  171. 'name' => '录入时间',
  172. 'match' => array('is_numeric', time()),
  173. 'desc' => '',
  174. # 只有insert时才生效
  175. 'insert' => true,
  176. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  177. ),
  178. ),
  179. # 索引
  180. 'index' => array
  181. (
  182. ),
  183. # 管理功能
  184. 'manage' => array
  185. (
  186. ),
  187. # request 请求接口定义
  188. 'request' => array
  189. (
  190. 'getAll' => array
  191. (
  192. # 匹配的正则或函数 选填项
  193. 'option' => array
  194. (
  195. 'info_id' => 'yes',
  196. 'cate_id_parent' => 'yes',
  197. 'cate_id' => 'yes',
  198. 'cate_ids' => array('yes-cate_id', 'in'),
  199. ),
  200. 'type' => 'all',
  201. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  202. 'limit' => '0,3',
  203. 'col' => '*',
  204. ),
  205. ),
  206. );