data.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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,13',
  147. 'update_search' => 'journal/lib/manage.search_journal',
  148. ),
  149. 'feature_id' => array
  150. (
  151. 'type' => 'int-11',
  152. 'name' => '关联专题-如不选择,则点击进入专题列表',
  153. 'default' => '',
  154. 'desc' => '关联专题',
  155. 'match' => 'option',
  156. 'update' => 'select',
  157. 'show' => 'type=6',
  158. 'update_search' => 'journal/lib/manage.search_feature',
  159. ),
  160. 'applet_id' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '关联小程序',
  164. 'default' => '',
  165. 'desc' => '关联小程序',
  166. 'match' => 'option',
  167. 'update' => 'select',
  168. 'show' => 'type=7',
  169. 'update_search' => 'journal/lib/manage.search_applet',
  170. ),
  171. 'olink' => array
  172. (
  173. 'type' => 'varchar-400',
  174. 'name' => '链接',
  175. 'default' => '',
  176. 'desc' => '请输入链接',
  177. 'match' => 'option',
  178. 'update' => 'text',
  179. 'show' => 'type=10',
  180. //'search' => 'fulltext',
  181. //'list' => true,
  182. ),
  183. 'name' => array
  184. (
  185. 'type' => 'varchar-60',
  186. 'name' => '标题-手动干扰项,如想修改当前推送位的标题请在此修改',
  187. 'default' => '',
  188. 'desc' => '请输入标题',
  189. 'match' => $name_state ? 'option' : 'option',
  190. 'update' => $name_state ? 'text' : 'hidden',
  191. 'search' => $name_state ? 'fulltext' : '',
  192. 'list' => $name_state ? 'Dever::load("push/lib/manage.name", {id})' : false,
  193. 'edit' => $name_state ? true : false,
  194. ),
  195. 'link' => array
  196. (
  197. 'type' => 'varchar-200',
  198. 'name' => '链接-手动干扰项,如想修改当前推送位的链接请在此修改',
  199. 'default' => '',
  200. 'desc' => '请输入链接',
  201. 'match' => $link_state ? 'option' : 'option',
  202. //'update' => $link_state ? 'text' : 'hidden',
  203. //'search' => $link_state ? 'fulltext' : '',
  204. //'list' => $link_state ? true : false,
  205. //'edit' => $link_state ? true : false,
  206. ),
  207. 'pic' => array
  208. (
  209. 'type' => 'varchar-200',
  210. 'name' => '图片或图标-手动干扰项,请上传' . $info['col_pic'] . '大小的图片',
  211. 'default' => '',
  212. 'desc' => '请选择图片',
  213. 'match' => $pic_state ? 'option' : 'option',
  214. 'update' => $pic_state ? 'image' : 'hidden',
  215. 'search' => $pic_state ? 'fulltext' : '',
  216. //'list' => $pic_state ? true : false,
  217. 'key' => 1
  218. ),
  219. 'content' => array
  220. (
  221. 'type' => 'text-255',
  222. 'name' => '描述-手动干扰项,字数请不要超过' . $info['col_content'] . '个汉字,前台展示时会自动过滤',
  223. 'default' => '',
  224. 'desc' => '请输入描述',
  225. 'match' => $content_state ? 'option' : 'option',
  226. //'update' => $content_state ? 'editor' : 'hidden',
  227. ),
  228. 'reorder' => array
  229. (
  230. 'type' => 'int-11',
  231. 'name' => '排序(数值越大越靠前)',
  232. 'default' => '1',
  233. 'desc' => '请输入排序',
  234. 'match' => 'option',
  235. 'update' => 'text',
  236. 'search' => 'order',
  237. 'list_name' => '排序',
  238. 'list' => true,
  239. 'order' => 'desc',
  240. 'edit' => true,
  241. ),
  242. 'state' => array
  243. (
  244. 'type' => 'tinyint-1',
  245. 'name' => '状态',
  246. 'default' => '1',
  247. 'desc' => '请选择状态',
  248. 'match' => 'is_numeric',
  249. ),
  250. 'cdate' => array
  251. (
  252. 'type' => 'int-11',
  253. 'name' => '录入时间',
  254. 'match' => array('is_numeric', time()),
  255. 'desc' => '',
  256. # 只有insert时才生效
  257. 'insert' => true,
  258. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  259. ),
  260. ),
  261. # request 请求接口定义
  262. 'request' => array
  263. (
  264. # 获取列表页
  265. 'getAll' => array
  266. (
  267. # 匹配的正则或函数 选填项
  268. 'option' => array
  269. (
  270. 'info_id' => 'yes',
  271. 'type_no' => array('yes-type', '!='),
  272. 'state' => 1,
  273. ),
  274. 'type' => 'all',
  275. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  276. 'limit' => '0,10',
  277. 'col' => 'name,pic,olink as link,type,article_id,vod_id,live_id,journal_id,feature_id,applet_id,cdate',
  278. ),
  279. # 获取列表页 带有分页的
  280. 'getAllPage' => array
  281. (
  282. # 匹配的正则或函数 选填项
  283. 'option' => array
  284. (
  285. 'info_id' => 'yes',
  286. 'type_no' => array('yes-type', '!='),
  287. 'state' => 1,
  288. ),
  289. 'type' => 'all',
  290. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  291. 'page' => array(10, 'list'),
  292. 'col' => 'name,pic,olink as link,type,article_id,vod_id,live_id,journal_id,feature_id,applet_id,cdate',
  293. ),
  294. ),
  295. );