data.php 8.7 KB

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