data.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $type = Dever::db('push/info')->config['func'];
  9. $type = $type();
  10. $list = function()
  11. {
  12. return Dever::db('push/info')->state();
  13. };
  14. $info = Dever::input('search_option_info_id', 1);
  15. Dever::setInput('search_option_info_id', $info);
  16. $type_default = -1;
  17. $data = array
  18. (
  19. 1 => '内容自定义',
  20. );
  21. $data_update = array();
  22. if ($info) {
  23. $info = Dever::db('push/info')->one($info);
  24. if (!$info) {
  25. return;
  26. }
  27. $function = explode(',', $info['func']);
  28. $type_id = array();
  29. foreach ($type as $k => $v) {
  30. if (!in_array($v['id'], $function)) {
  31. unset($type[$k]);
  32. } else {
  33. $type_default = $v['id'];
  34. if ($v['id'] > 0 && isset($v['type']) && $v['type'] == 1) {
  35. $type_id[] = $v['id'];
  36. }
  37. }
  38. }
  39. $type_id = implode(',', $type_id);
  40. $info['name'] .= '下的推送数据管理';
  41. $col = Dever::db('push/col')->getAll(array('id' => $info['col']));
  42. if ($col) {
  43. $pic_index = 0;
  44. if ($info['col_pic']) {
  45. $pic = $info['col_pic'];
  46. $pic_temp = explode("\r\n", $pic);
  47. }
  48. foreach ($col as $k => $v) {
  49. $place = $v['pic'];
  50. if ($info['col_pic'] && isset($pic_temp[$pic_index]) && $pic_temp[$pic_index]) {
  51. $place = $pic_temp[$pic_index];
  52. }
  53. if ($v['type'] == 1) {
  54. $update_type = 'text';
  55. } elseif ($v['type'] == 2) {
  56. $update_type = 'textarea';
  57. } elseif ($v['type'] == 3) {
  58. $update_type = 'editor';
  59. } elseif ($v['type'] == 4) {
  60. $update_type = 'image';
  61. $pic_index++;
  62. } elseif ($v['type'] == 5) {
  63. $update_type = 'images';
  64. $pic_index++;
  65. } elseif ($v['type'] == 6) {
  66. $update_type = 'radio';
  67. } elseif ($v['type'] == 7) {
  68. $update_type = 'checkbox';
  69. } elseif ($v['type'] == 8) {
  70. $update_type = 'day';
  71. }
  72. $data_update[] = array
  73. (
  74. 'col' => 'col_' . $v['id'],
  75. 'name' => $v['name'],
  76. 'default' => '',
  77. 'desc' => $v['name'],
  78. 'match' => 'is_string',
  79. 'update' => $update_type,
  80. 'place' => $place,
  81. 'key' => 1,
  82. );
  83. }
  84. }
  85. } else {
  86. $info = array();
  87. $info['name'] = '推送数据管理';
  88. $type_id = '0';
  89. }
  90. return array
  91. (
  92. # 表名
  93. 'name' => 'data',
  94. # 显示给用户看的名称
  95. 'lang' => $info['name'],
  96. 'order' => 20,
  97. //'menu' => false,
  98. //'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>',
  99. # 数据结构
  100. 'struct' => array
  101. (
  102. 'id' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => 'ID',
  106. 'default' => '',
  107. 'desc' => '',
  108. 'match' => 'is_numeric',
  109. //'search' => 'order',
  110. 'order' => 'desc',
  111. //'list' => true,
  112. ),
  113. 'info_id' => array
  114. (
  115. 'type' => 'int-11',
  116. 'name' => '所属推送位',
  117. 'default' => Dever::input('search_option_info_id', '1'),
  118. 'desc' => '推送位',
  119. 'match' => 'is_numeric',
  120. 'search' => 'select',
  121. 'update' => 'hidden',
  122. 'option' => $list,
  123. 'list' => true,
  124. 'value' => Dever::input('search_option_info_id', '1'),
  125. ),
  126. 'type' => array
  127. (
  128. 'type' => 'int-11',
  129. 'name' => '功能类型',
  130. 'default' => ''.$type_default.'',
  131. 'desc' => '请选择功能类型',
  132. 'match' => 'is_numeric',
  133. 'update' => 'radio',
  134. //'search' => 'select',
  135. 'option' => $type,
  136. 'control' => 'type',
  137. ),
  138. 'type_id' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '关联数据',
  142. 'default' => '',
  143. 'desc' => '关联数据',
  144. 'match' => 'option',
  145. 'update' => 'select',
  146. 'show' => 'type=' . $type_id,
  147. 'update_search' => 'push/lib/manage.search?{type}',
  148. ),
  149. 'data' => array
  150. (
  151. 'type' => 'text-1000',
  152. 'name' => '自定义数据项',
  153. 'default' => '',
  154. 'desc' => '自定义数据项',
  155. 'match' => 'is_string',
  156. 'option' => $data,
  157. 'update' => $data_update,
  158. 'list' => 'Dever::load("push/lib/manage.show", {id})',
  159. ),
  160. 'reorder' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '排序(数值越大越靠前)',
  164. 'default' => '1',
  165. 'desc' => '请输入排序',
  166. 'match' => 'option',
  167. 'update' => 'text',
  168. 'search' => 'order',
  169. 'list_name' => '排序',
  170. 'list' => true,
  171. 'order' => 'desc',
  172. 'edit' => true,
  173. ),
  174. 'state' => array
  175. (
  176. 'type' => 'tinyint-1',
  177. 'name' => '状态',
  178. 'default' => '1',
  179. 'desc' => '请选择状态',
  180. 'match' => 'is_numeric',
  181. ),
  182. 'cdate' => array
  183. (
  184. 'type' => 'int-11',
  185. 'name' => '录入时间',
  186. 'match' => array('is_numeric', time()),
  187. 'desc' => '',
  188. # 只有insert时才生效
  189. 'insert' => true,
  190. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  191. ),
  192. ),
  193. # request 请求接口定义
  194. 'request' => array
  195. (
  196. # 获取列表页
  197. 'getAll' => array
  198. (
  199. # 匹配的正则或函数 选填项
  200. 'option' => array
  201. (
  202. 'info_id' => 'yes',
  203. 'type_no' => array('yes-type', '!='),
  204. 'state' => 1,
  205. ),
  206. 'type' => 'all',
  207. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  208. 'limit' => '0,10',
  209. 'col' => '*',
  210. ),
  211. # 获取列表页 带有分页的
  212. 'getAllPage' => array
  213. (
  214. # 匹配的正则或函数 选填项
  215. 'option' => array
  216. (
  217. 'info_id' => 'yes',
  218. 'type_no' => array('yes-type', '!='),
  219. 'state' => 1,
  220. ),
  221. 'type' => 'all',
  222. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  223. 'page' => array(10, 'list'),
  224. 'col' => '*',
  225. ),
  226. ),
  227. );