data.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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' => 'content/lib/manage.search_article',
  118. ),
  119. 'olink' => array
  120. (
  121. 'type' => 'varchar-400',
  122. 'name' => '链接',
  123. 'default' => '',
  124. 'desc' => '请输入链接',
  125. 'match' => 'option',
  126. 'update' => 'text',
  127. 'show' => 'type=10',
  128. //'search' => 'fulltext',
  129. //'list' => true,
  130. ),
  131. 'name' => array
  132. (
  133. 'type' => 'varchar-60',
  134. 'name' => '标题-手动干扰项,如想修改当前推送位的标题请在此修改',
  135. 'default' => '',
  136. 'desc' => '请输入标题',
  137. 'match' => $name_state ? 'option' : 'option',
  138. 'update' => $name_state ? 'text' : 'hidden',
  139. 'search' => $name_state ? 'fulltext' : '',
  140. 'list' => $name_state ? 'Dever::load("push/lib/manage.name", {id})' : false,
  141. 'edit' => $name_state ? true : false,
  142. ),
  143. 'link' => array
  144. (
  145. 'type' => 'varchar-200',
  146. 'name' => '链接-手动干扰项,如想修改当前推送位的链接请在此修改',
  147. 'default' => '',
  148. 'desc' => '请输入链接',
  149. 'match' => $link_state ? 'option' : 'option',
  150. //'update' => $link_state ? 'text' : 'hidden',
  151. //'search' => $link_state ? 'fulltext' : '',
  152. //'list' => $link_state ? true : false,
  153. //'edit' => $link_state ? true : false,
  154. ),
  155. 'pic' => array
  156. (
  157. 'type' => 'varchar-200',
  158. 'name' => '图片或图标-手动干扰项,请上传' . $info['col_pic'] . '大小的图片',
  159. 'default' => '',
  160. 'desc' => '请选择图片',
  161. 'match' => $pic_state ? 'option' : 'option',
  162. 'update' => $pic_state ? 'image' : 'hidden',
  163. 'search' => $pic_state ? 'fulltext' : '',
  164. //'list' => $pic_state ? true : false,
  165. 'key' => 1
  166. ),
  167. 'content' => array
  168. (
  169. 'type' => 'text-255',
  170. 'name' => '描述-手动干扰项,字数请不要超过' . $info['col_content'] . '个汉字,前台展示时会自动过滤',
  171. 'default' => '',
  172. 'desc' => '请输入描述',
  173. 'match' => $content_state ? 'option' : 'option',
  174. //'update' => $content_state ? 'editor' : 'hidden',
  175. ),
  176. 'reorder' => array
  177. (
  178. 'type' => 'int-11',
  179. 'name' => '排序(数值越大越靠前)',
  180. 'default' => '1',
  181. 'desc' => '请输入排序',
  182. 'match' => 'option',
  183. 'update' => 'text',
  184. 'search' => 'order',
  185. 'list_name' => '排序',
  186. 'list' => true,
  187. 'order' => 'desc',
  188. 'edit' => true,
  189. ),
  190. 'state' => array
  191. (
  192. 'type' => 'tinyint-1',
  193. 'name' => '状态',
  194. 'default' => '1',
  195. 'desc' => '请选择状态',
  196. 'match' => 'is_numeric',
  197. ),
  198. 'cdate' => array
  199. (
  200. 'type' => 'int-11',
  201. 'name' => '录入时间',
  202. 'match' => array('is_numeric', time()),
  203. 'desc' => '',
  204. # 只有insert时才生效
  205. 'insert' => true,
  206. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  207. ),
  208. ),
  209. # request 请求接口定义
  210. 'request' => array
  211. (
  212. # 获取列表页
  213. 'getAll' => array
  214. (
  215. # 匹配的正则或函数 选填项
  216. 'option' => array
  217. (
  218. 'info_id' => 'yes',
  219. 'type_no' => array('yes-type', '!='),
  220. 'state' => 1,
  221. ),
  222. 'type' => 'all',
  223. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  224. 'limit' => '0,10',
  225. 'col' => 'name,pic,olink as link,type,article_id,cdate',
  226. ),
  227. # 获取列表页 带有分页的
  228. 'getAllPage' => array
  229. (
  230. # 匹配的正则或函数 选填项
  231. 'option' => array
  232. (
  233. 'info_id' => 'yes',
  234. 'type_no' => array('yes-type', '!='),
  235. 'state' => 1,
  236. ),
  237. 'type' => 'all',
  238. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  239. 'page' => array(10, 'list'),
  240. 'col' => 'name,pic,olink as link,type,article_id,cdate',
  241. ),
  242. ),
  243. );