data.php 9.3 KB

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