data.php 10 KB

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