data.php 6.7 KB

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