data.php 11 KB

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