data.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $type = array(0 => '默认类型');
  9. $info = Dever::input('search_option_info_id');
  10. if ($info) {
  11. $info = Dever::load('module/info-one', $info);
  12. if (!$info) {
  13. echo 'error';die;
  14. }
  15. $info['name'] .= '下的数据推送';
  16. $info['col'] = explode(',', $info['col']);
  17. $preview = $info['preview'];
  18. $preview_height = $info['preview_height'] ? $info['preview_height'] : 500;
  19. $name_state = in_array(1, $info['col']);
  20. $link_state = in_array(2, $info['col']);
  21. $pic_state = in_array(3, $info['col']);
  22. $content_state = in_array(4, $info['col']);
  23. if ($info['data_type']) {
  24. $type = explode("\r\n", $info['data_type']);
  25. }
  26. } else {
  27. $info = array();
  28. $info['name'] = '模块数据管理';
  29. $info['col_pic'] = '100X100';
  30. $info['col_content'] = '30';
  31. $info['type'] = 1;
  32. $name_state = false;
  33. $link_state = false;
  34. $pic_state = false;
  35. $content_state = false;
  36. $preview = '';
  37. $preview_height = 0;
  38. }
  39. return array
  40. (
  41. # 表名
  42. 'name' => 'data',
  43. # 显示给用户看的名称
  44. 'lang' => $info['name'],
  45. 'order' => 7,
  46. 'menu' => false,
  47. //'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>',
  48. # 数据结构
  49. 'struct' => array
  50. (
  51. 'id' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => 'ID',
  55. 'default' => '',
  56. 'desc' => '',
  57. 'match' => 'is_numeric',
  58. //'search' => 'order',
  59. 'order' => 'desc',
  60. //'list' => true,
  61. ),
  62. 'info_id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '模块',
  66. 'default' => Dever::input('search_option_info_id', '1'),
  67. 'desc' => '模块',
  68. 'match' => 'is_numeric',
  69. 'update' => 'hidden',
  70. ),
  71. 'type' => array
  72. (
  73. 'type' => 'tinyint-1',
  74. 'name' => '数据类型',
  75. 'default' => '0',
  76. 'desc' => '请选择数据类型',
  77. 'match' => 'is_numeric',
  78. //'option' => $type,
  79. //'update' => 'radio',
  80. //'search' => 'select',
  81. //'list' => true,
  82. //'edit' => true,
  83. ),
  84. 'source_id' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '数据id',
  88. 'default' => '',
  89. 'desc' => '数据id',
  90. 'match' => $info['type'] == 3 ? 'is_numeric' : 'option',
  91. 'update' => $info['type'] == 3 ? 'text' : 'hidden',
  92. 'list' => $info['type'] == 3 ? true : false,
  93. ),
  94. 'name' => array
  95. (
  96. 'type' => 'varchar-60',
  97. 'name' => '标题-手动干扰项',
  98. 'default' => '',
  99. 'desc' => '请输入标题',
  100. 'match' => $name_state ? 'option' : 'option',
  101. 'update' => $name_state ? 'text' : 'hidden',
  102. 'search' => $name_state ? 'fulltext' : '',
  103. 'list' => $name_state ? '{source_id} > 0 ? ("{name}" ? "{name}" : Dever::load("sad/supply-one#name", {source_id})) : "{name}"' : false,
  104. 'edit' => $name_state ? true : false,
  105. ),
  106. 'link' => array
  107. (
  108. 'type' => 'varchar-200',
  109. 'name' => '链接-手动干扰项',
  110. 'default' => '',
  111. 'desc' => '请输入链接',
  112. 'match' => $link_state ? 'option' : 'option',
  113. 'update' => $link_state ? 'text' : 'hidden',
  114. 'search' => $link_state ? 'fulltext' : '',
  115. //'list' => $link_state ? true : false,
  116. 'edit' => $link_state ? true : false,
  117. ),
  118. 'pic' => array
  119. (
  120. 'type' => 'varchar-200',
  121. 'name' => '图片-手动干扰项,请上传,' . $info['col_pic'] . '大小的图片',
  122. 'default' => '',
  123. 'desc' => '请选择图片',
  124. 'match' => $pic_state ? 'option' : 'option',
  125. 'update' => $pic_state ? 'image' : 'hidden',
  126. 'search' => $pic_state ? 'fulltext' : '',
  127. //'list' => $pic_state ? true : false,
  128. 'key' => 1
  129. ),
  130. 'content' => array
  131. (
  132. 'type' => 'text-255',
  133. 'name' => '内容-手动干扰项,字数请不要超过' . $info['col_content'] . '个汉字,前台展示时会自动过滤',
  134. 'default' => '',
  135. 'desc' => '请输入内容',
  136. 'match' => $content_state ? 'option' : 'option',
  137. 'update' => $content_state ? 'editor' : 'hidden',
  138. ),
  139. 'reorder' => array
  140. (
  141. 'type' => 'int-11',
  142. 'name' => '排序(数值越大越靠前)',
  143. 'default' => '1',
  144. 'desc' => '请输入排序',
  145. 'match' => 'option',
  146. 'update' => 'text',
  147. 'search' => 'order',
  148. 'list_name' => '排序',
  149. 'list' => true,
  150. 'order' => 'desc',
  151. 'edit' => true,
  152. ),
  153. 'state' => array
  154. (
  155. 'type' => 'tinyint-1',
  156. 'name' => '状态',
  157. 'default' => '1',
  158. 'desc' => '请选择状态',
  159. 'match' => 'is_numeric',
  160. ),
  161. 'cdate' => array
  162. (
  163. 'type' => 'int-11',
  164. 'name' => '录入时间',
  165. 'match' => array('is_numeric', time()),
  166. 'desc' => '',
  167. # 只有insert时才生效
  168. 'insert' => true,
  169. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  170. ),
  171. ),
  172. # request 请求接口定义
  173. 'request' => array
  174. (
  175. # 获取列表页
  176. 'getAllByType' => array
  177. (
  178. # 匹配的正则或函数 选填项
  179. 'option' => array
  180. (
  181. 'type' => 'yes',
  182. 'info_id' => 'yes',
  183. 'state' => 1,
  184. ),
  185. 'type' => 'all',
  186. 'order' => array('reorder' => 'desc'),
  187. //'col' => '*|type|',
  188. 'col' => '*',
  189. ),
  190. ),
  191. );