data.php 6.8 KB

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