data.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $type = Dever::config('base')->type;
  9. $type[10] = '链接';
  10. $list = function()
  11. {
  12. return Dever::db('push/info')->state();
  13. };
  14. $info = Dever::input('search_option_info_id');
  15. if ($info) {
  16. $info = Dever::load('push/info-one', $info);
  17. if (!$info) {
  18. echo 'error';die;
  19. }
  20. $info['name'] .= '下的推送数据管理';
  21. $info['col'] = explode(',', $info['col']);
  22. /*
  23. $preview = $info['preview'];
  24. $preview_height = $info['preview_height'] ? $info['preview_height'] : 500;
  25. */
  26. $name_state = in_array(1, $info['col']);
  27. $link_state = in_array(2, $info['col']);
  28. $pic_state = in_array(3, $info['col']);
  29. $content_state = in_array(4, $info['col']);
  30. /*
  31. if ($info['data_type']) {
  32. $type = explode("\r\n", $info['data_type']);
  33. }
  34. */
  35. } else {
  36. $info = array();
  37. $info['name'] = '推送数据管理';
  38. $info['col_pic'] = '100X100';
  39. $info['col_content'] = '30';
  40. $info['type'] = 1;
  41. $name_state = true;
  42. $link_state = false;
  43. $pic_state = false;
  44. $content_state = false;
  45. $preview = '';
  46. $preview_height = 0;
  47. }
  48. return array
  49. (
  50. # 表名
  51. 'name' => 'data',
  52. # 显示给用户看的名称
  53. 'lang' => $info['name'],
  54. 'order' => 20,
  55. //'menu' => false,
  56. //'desc' => '预览地址:<br /><iframe id="preview" height="'.$preview_height.'" width="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes" src="'.$preview.'" ></iframe>',
  57. # 数据结构
  58. 'struct' => array
  59. (
  60. 'id' => array
  61. (
  62. 'type' => 'int-11',
  63. 'name' => 'ID',
  64. 'default' => '',
  65. 'desc' => '',
  66. 'match' => 'is_numeric',
  67. //'search' => 'order',
  68. 'order' => 'desc',
  69. //'list' => true,
  70. ),
  71. 'info_id' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '推送位',
  75. 'default' => Dever::input('search_option_info_id', '1'),
  76. 'desc' => '推送位',
  77. 'match' => 'is_numeric',
  78. 'search' => 'select',
  79. 'update' => 'select',
  80. 'option' => $list,
  81. 'list' => true,
  82. ),
  83. 'type' => array
  84. (
  85. 'type' => 'int-11',
  86. 'name' => '类型',
  87. 'default' => '1',
  88. 'desc' => '请选择类型',
  89. 'match' => 'is_numeric',
  90. 'update' => 'radio',
  91. 'search' => 'select',
  92. 'option' => $type,
  93. 'control' => 'type',
  94. ),
  95. 'article_id' => array
  96. (
  97. 'type' => 'int-11',
  98. 'name' => '关联图文',
  99. 'default' => '',
  100. 'desc' => '关联图文',
  101. 'match' => 'option',
  102. 'update' => 'select',
  103. 'show' => 'type=1',
  104. 'update_search' => 'journal/lib/manage.search_article',
  105. ),
  106. 'vod_id' => array
  107. (
  108. 'type' => 'int-11',
  109. 'name' => '关联视频',
  110. 'default' => '',
  111. 'desc' => '关联视频',
  112. 'match' => 'option',
  113. 'update' => 'select',
  114. 'show' => 'type=2',
  115. 'update_search' => 'journal/lib/manage.search_vod',
  116. ),
  117. 'live_id' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '关联直播',
  121. 'default' => '',
  122. 'desc' => '关联直播',
  123. 'match' => 'option',
  124. 'update' => 'select',
  125. 'show' => 'type=3',
  126. 'update_search' => 'journal/lib/manage.search_live',
  127. ),
  128. 'journal_id' => array
  129. (
  130. 'type' => 'int-11',
  131. 'name' => '关联小刊',
  132. 'default' => '',
  133. 'desc' => '关联小刊',
  134. 'match' => 'option',
  135. 'update' => 'select',
  136. 'show' => 'type=4',
  137. 'update_search' => 'journal/lib/manage.search_journal',
  138. ),
  139. 'olink' => array
  140. (
  141. 'type' => 'varchar-400',
  142. 'name' => '链接',
  143. 'default' => '',
  144. 'desc' => '请输入链接',
  145. 'match' => 'option',
  146. 'update' => 'text',
  147. 'show' => 'type=10',
  148. //'search' => 'fulltext',
  149. //'list' => true,
  150. ),
  151. 'name' => array
  152. (
  153. 'type' => 'varchar-60',
  154. 'name' => '标题-手动干扰项,如想在当前推送位的标题请在此修改',
  155. 'default' => '',
  156. 'desc' => '请输入标题',
  157. 'match' => $name_state ? 'option' : 'option',
  158. 'update' => $name_state ? 'text' : 'hidden',
  159. 'search' => $name_state ? 'fulltext' : '',
  160. 'list' => $name_state ? 'Dever::load("push/lib/manage.name", {id})' : false,
  161. 'edit' => $name_state ? true : false,
  162. ),
  163. 'link' => array
  164. (
  165. 'type' => 'varchar-200',
  166. 'name' => '链接-手动干扰项,如想在当前推送位的链接请在此修改',
  167. 'default' => '',
  168. 'desc' => '请输入链接',
  169. 'match' => $link_state ? 'option' : 'option',
  170. //'update' => $link_state ? 'text' : 'hidden',
  171. //'search' => $link_state ? 'fulltext' : '',
  172. //'list' => $link_state ? true : false,
  173. //'edit' => $link_state ? true : false,
  174. ),
  175. 'pic' => array
  176. (
  177. 'type' => 'varchar-200',
  178. 'name' => '图片-手动干扰项,请上传,' . $info['col_pic'] . '大小的图片',
  179. 'default' => '',
  180. 'desc' => '请选择图片',
  181. 'match' => $pic_state ? 'option' : 'option',
  182. 'update' => $pic_state ? 'image' : 'hidden',
  183. 'search' => $pic_state ? 'fulltext' : '',
  184. //'list' => $pic_state ? true : false,
  185. 'key' => 1
  186. ),
  187. 'content' => array
  188. (
  189. 'type' => 'text-255',
  190. 'name' => '描述-手动干扰项,字数请不要超过' . $info['col_content'] . '个汉字,前台展示时会自动过滤',
  191. 'default' => '',
  192. 'desc' => '请输入描述',
  193. 'match' => $content_state ? 'option' : 'option',
  194. 'update' => $content_state ? 'editor' : 'hidden',
  195. ),
  196. 'reorder' => array
  197. (
  198. 'type' => 'int-11',
  199. 'name' => '排序(数值越大越靠前)',
  200. 'default' => '1',
  201. 'desc' => '请输入排序',
  202. 'match' => 'option',
  203. 'update' => 'text',
  204. 'search' => 'order',
  205. 'list_name' => '排序',
  206. 'list' => true,
  207. 'order' => 'desc',
  208. 'edit' => true,
  209. ),
  210. 'state' => array
  211. (
  212. 'type' => 'tinyint-1',
  213. 'name' => '状态',
  214. 'default' => '1',
  215. 'desc' => '请选择状态',
  216. 'match' => 'is_numeric',
  217. ),
  218. 'cdate' => array
  219. (
  220. 'type' => 'int-11',
  221. 'name' => '录入时间',
  222. 'match' => array('is_numeric', time()),
  223. 'desc' => '',
  224. # 只有insert时才生效
  225. 'insert' => true,
  226. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  227. ),
  228. ),
  229. # request 请求接口定义
  230. 'request' => array
  231. (
  232. # 获取列表页
  233. 'getAllByType' => array
  234. (
  235. # 匹配的正则或函数 选填项
  236. 'option' => array
  237. (
  238. 'type' => 'yes',
  239. 'info_id' => 'yes',
  240. 'state' => 1,
  241. ),
  242. 'type' => 'all',
  243. 'order' => array('reorder' => 'desc'),
  244. //'col' => '*|type|',
  245. 'col' => '*',
  246. ),
  247. ),
  248. );