module.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <?php
  2. $func = function()
  3. {
  4. $array = array
  5. (
  6. -1 => array('id' => '-1', 'name' => '自定义',),
  7. );
  8. $info = Dever::db('page/func')->state();
  9. if($info)
  10. {
  11. $array += $info;
  12. }
  13. return $array;
  14. };
  15. $col = function()
  16. {
  17. $array = array
  18. (
  19. );
  20. $info = Dever::db('page/col')->state();
  21. if($info)
  22. {
  23. $array += $info;
  24. }
  25. return $array;
  26. };
  27. $page = function()
  28. {
  29. $array = array
  30. (
  31. );
  32. $info = Dever::db('page/page')->state();
  33. if($info)
  34. {
  35. $array += $info;
  36. }
  37. return $array;
  38. };
  39. $content = array
  40. (
  41. 1 => '显示',
  42. 2 => '不显示',
  43. );
  44. return array
  45. (
  46. # 表名
  47. 'name' => 'module',
  48. # 显示给用户看的名称
  49. 'lang' => '模块列表',
  50. 'order' => 2,
  51. 'func' => $func,
  52. 'sync' => array
  53. (
  54. 'page/page_module' => array
  55. (
  56. # 更新时的条件,另外一个表的字段 => 本表的字段
  57. 'where' => array('module_id', 'id'),
  58. # 要更新的数据
  59. 'update' => array('page_id' => 'page_id'),
  60. # 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新
  61. 'type' => 'delete',
  62. ),
  63. ),
  64. # 数据结构
  65. 'struct' => array
  66. (
  67. 'id' => array
  68. (
  69. 'type' => 'int-11',
  70. 'name' => '模块ID',
  71. 'default' => '',
  72. 'desc' => '',
  73. 'match' => 'is_numeric',
  74. //'search' => 'order',
  75. 'order' => 'desc',
  76. //'list' => true,
  77. ),
  78. 'name' => array
  79. (
  80. 'type' => 'varchar-60',
  81. 'name' => '模块标题',
  82. 'default' => '',
  83. 'desc' => '请输入模块标题',
  84. 'match' => 'is_string',
  85. 'update' => 'text',
  86. 'search' => 'fulltext',
  87. 'list' => true,
  88. 'edit' => true,
  89. ),
  90. 'key' => array
  91. (
  92. 'type' => 'varchar-60',
  93. 'name' => '模块标识',
  94. 'default' => '',
  95. 'desc' => '模块标识',
  96. 'match' => 'is_string',
  97. 'update' => 'text',
  98. 'search' => 'fulltext',
  99. 'list' => true,
  100. ),
  101. 'pic' => array
  102. (
  103. 'type' => 'varchar-150',
  104. 'name' => '模块图片',
  105. 'default' => '',
  106. 'desc' => '模块图片',
  107. 'match' => 'option',
  108. 'update' => 'image',
  109. 'key' => 1,
  110. ),
  111. 'desc' => array
  112. (
  113. 'type' => 'varchar-2000',
  114. 'name' => '模块描述',
  115. 'default' => '',
  116. 'desc' => '模块描述',
  117. 'match' => 'is_string',
  118. 'update' => 'editor',
  119. 'key' => 1,
  120. ),
  121. 'content' => array
  122. (
  123. 'type' => 'tinyint-1',
  124. 'name' => '是否显示内容',
  125. 'default' => '1',
  126. 'desc' => '是否显示内容',
  127. 'match' => 'is_numeric',
  128. 'update' => 'radio',
  129. 'option' => $content,
  130. 'control' => 'content',
  131. 'tab' => 1,
  132. ),
  133. 'num' => array
  134. (
  135. 'type' => 'int-11',
  136. 'name' => '内容显示条数-为空或小于0则取默认值10,只对前台有效,当有分页时,则为每页显示的条数',
  137. 'default' => '10',
  138. 'desc' => '内容显示条数',
  139. 'match' => 'is_numeric',
  140. 'update' => 'text',
  141. //'list' => true,
  142. //'edit' => true,
  143. 'tab' => 1,
  144. 'show' => 'content=1',
  145. ),
  146. 'page_id' => array
  147. (
  148. 'type' => 'varchar-100',
  149. 'name' => '所属页面',
  150. 'default' => '',
  151. 'desc' => '所属页面',
  152. 'match' => 'is_string',
  153. 'option' => $page,
  154. 'update' => 'checkbox',
  155. 'search' => 'select',
  156. 'list' => true,
  157. 'list_order' => -1,
  158. ),
  159. 'func' => array
  160. (
  161. 'type' => 'varchar-300',
  162. 'name' => '内容功能类型',
  163. 'default' => '',
  164. 'desc' => '功能类型',
  165. 'match' => 'is_string',
  166. 'option' => $func,
  167. 'update' => 'checkbox',
  168. 'tab' => 1,
  169. 'show' => 'content=1',
  170. ),
  171. 'col' => array
  172. (
  173. 'type' => 'varchar-300',
  174. 'name' => '内容启用的字段',
  175. 'default' => '',
  176. 'desc' => '请选择启用的字段',
  177. 'match' => 'is_string',
  178. 'option' => $col,
  179. 'update' => 'checkbox',
  180. 'tab' => 1,
  181. 'show' => 'content=1',
  182. ),
  183. 'col_pic' => array
  184. (
  185. 'type' => 'varchar-500',
  186. 'name' => '内容图片尺寸提醒-请直接输入提醒的文字即可,如100*100,如果有多个图片字段,请用换行隔开',
  187. 'default' => '',
  188. 'desc' => '图片尺寸提醒',
  189. 'match' => 'option',
  190. 'update' => 'textarea',
  191. 'tab' => 1,
  192. 'show' => 'content=1',
  193. ),
  194. 'reorder' => array
  195. (
  196. 'type' => 'int-11',
  197. 'name' => '排序(数值越大越靠前)',
  198. 'default' => '1',
  199. 'desc' => '请输入排序',
  200. 'match' => 'option',
  201. 'update' => 'text',
  202. 'search' => 'order',
  203. 'list_name' => '排序',
  204. 'list' => true,
  205. 'order' => 'desc',
  206. 'edit' => true,
  207. ),
  208. 'state' => array
  209. (
  210. 'type' => 'tinyint-1',
  211. 'name' => '状态',
  212. 'default' => '1',
  213. 'desc' => '请选择状态',
  214. 'match' => 'is_numeric',
  215. ),
  216. 'cdate' => array
  217. (
  218. 'type' => 'int-11',
  219. 'name' => '录入时间',
  220. 'match' => array('is_numeric', time()),
  221. 'desc' => '',
  222. # 只有insert时才生效
  223. 'insert' => true,
  224. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  225. ),
  226. ),
  227. # 权限精细控制 加入到该项目的详细权限中,注意与top的不同
  228. /*
  229. 'auth' => array
  230. (
  231. # 数据来源
  232. 'data' => 'all',
  233. # 所属项目
  234. 'project' => 'module',
  235. # 项目名称
  236. 'project_name' => '模块管理',
  237. ),
  238. */
  239. 'manage' => array
  240. (
  241. 'lang' => 'name,desc',
  242. 'tab' => array('基本配置', '内容配置'),
  243. 'delete' => false,
  244. //'edit' => false,
  245. //'insert' => $curPage ? true : false,
  246. 'list_button' => array
  247. (
  248. 'add' => array('新增内容', '"data&search_option_module_id={id}&oper_parent=module"', '{content} == 1'),
  249. 'list' => array('内容列表', '"data&search_option_module_id={id}&oper_parent=module"', '{content} == 1'),
  250. ),
  251. ),
  252. # request 请求接口定义
  253. 'request' => array
  254. (
  255. # 获取列表页
  256. 'getAll' => array
  257. (
  258. # 匹配的正则或函数 选填项
  259. 'option' => array
  260. (
  261. 'type' => 'yes',
  262. 'page_id' => 'yes',
  263. 'state' => 1,
  264. ),
  265. 'type' => 'all',
  266. 'order' => array('reorder' => 'desc'),
  267. 'col' => '*',
  268. ),
  269. ),
  270. );