data.php 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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',
  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. ),
  148. 'reorder' => array
  149. (
  150. 'type' => 'int-11',
  151. 'name' => '排序(数值越大越靠前)',
  152. 'default' => '1',
  153. 'desc' => '请输入排序',
  154. 'match' => 'option',
  155. 'update' => 'text',
  156. 'search' => 'order',
  157. 'list_name' => '排序',
  158. 'list' => true,
  159. 'order' => 'desc',
  160. 'edit' => true,
  161. ),
  162. 'state' => array
  163. (
  164. 'type' => 'tinyint-1',
  165. 'name' => '状态',
  166. 'default' => '1',
  167. 'desc' => '请选择状态',
  168. 'match' => 'is_numeric',
  169. ),
  170. 'cdate' => array
  171. (
  172. 'type' => 'int-11',
  173. 'name' => '录入时间',
  174. 'match' => array('is_numeric', time()),
  175. 'desc' => '',
  176. # 只有insert时才生效
  177. 'insert' => true,
  178. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  179. ),
  180. ),
  181. # request 请求接口定义
  182. 'request' => array
  183. (
  184. # 获取列表页
  185. 'getAll' => array
  186. (
  187. # 匹配的正则或函数 选填项
  188. 'option' => array
  189. (
  190. 'info_id' => 'yes',
  191. 'type_no' => array('yes-type', '!='),
  192. 'state' => 1,
  193. ),
  194. 'type' => 'all',
  195. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  196. 'limit' => '0,10',
  197. 'col' => '*',
  198. ),
  199. # 获取列表页 带有分页的
  200. 'getAllPage' => array
  201. (
  202. # 匹配的正则或函数 选填项
  203. 'option' => array
  204. (
  205. 'info_id' => 'yes',
  206. 'type_no' => array('yes-type', '!='),
  207. 'state' => 1,
  208. ),
  209. 'type' => 'all',
  210. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  211. 'page' => array(10, 'list'),
  212. 'col' => '*',
  213. ),
  214. ),
  215. );