data.php 12 KB

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