cate.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <?php
  2. # 获取分类权限
  3. $auth = Dever::tops();
  4. $status = Dever::config('base')->status;
  5. $type = array
  6. (
  7. # 默认类型
  8. 3 => '图文内容',
  9. 1 => '全屏图',
  10. # 2019-03-27 增加两个类型
  11. 7 => '长图(文字)',
  12. 8 => '横屏图',
  13. 2 => '长图',
  14. 9 => '无边框图片',
  15. 10 => '四宫格图片',
  16. # 2018-12-11 增加3个类型
  17. 4 => '全屏视频',
  18. 5 => '留言视频',
  19. 6 => '留言音频',
  20. # 2019-03-27 增加三个类型
  21. 21 => '对话模板',
  22. # 关联类型 > 10
  23. //11 => '关联图文',
  24. 12 => '关联视频',
  25. 13 => '关联直播',
  26. # 2019-07-26
  27. 31 => '电商产品',
  28. 32 => 'H5',
  29. );
  30. $type = array
  31. (
  32. # 图文
  33. 1 => '图文内容',
  34. 2 => '全屏图+文字',
  35. 3 => '长图+文字',
  36. 4 => '横屏图+文字',
  37. # 图片
  38. 11 => '长图',
  39. 12 => '无边框图片',
  40. 13 => '四宫格图片',
  41. # 音视频
  42. 21 => '全屏视频',
  43. 22 => '留言视频',
  44. 23 => '留言音频',
  45. # 交互
  46. 31 => '对话模板',
  47. # 电商
  48. 41 => '电商产品',
  49. # h5
  50. 51 => '链接地址',
  51. # 关联
  52. 61 => '关联图文',
  53. 62 => '关联视频',
  54. 63 => '关联直播',
  55. );
  56. $type = Dever::db('collection/type')->state();
  57. $list = array
  58. (
  59. # 匹配的正则或函数 选填项
  60. 'option' => array
  61. (
  62. 'name' => array('yes', 'like'),
  63. 'id' => array($auth, 'in'),
  64. 'state' => 'yes',
  65. ),
  66. 'type' => 'all',
  67. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  68. 'page' => array(20, 'list'),
  69. 'col' => '*|id',
  70. );
  71. $id = Dever::input('where_id');
  72. return array
  73. (
  74. # 表名
  75. 'name' => 'cate',
  76. # 显示给用户看的名称
  77. 'lang' => '分类设置',
  78. # 后台菜单排序
  79. 'order' => 1,
  80. 'gettype' => $type,
  81. 'end' => array
  82. (
  83. 'update' => array
  84. (
  85. 'passport/lib/manage.updateSystem',
  86. 'manage/top.sync',
  87. ),
  88. 'insert' => array
  89. (
  90. 'passport/lib/manage.updateSystem',
  91. 'manage/top.sync',
  92. )
  93. ),
  94. # 数据结构
  95. 'struct' => array
  96. (
  97. 'id' => array
  98. (
  99. 'type' => 'int-11',
  100. 'name' => 'ID',
  101. 'default' => '',
  102. 'desc' => '',
  103. 'match' => 'is_numeric',
  104. 'search' => 'order',
  105. 'list' => true,
  106. 'order' => 'desc',
  107. ),
  108. 'name' => array
  109. (
  110. 'type' => 'varchar-32',
  111. 'name' => '分类名称',
  112. 'default' => '',
  113. 'desc' => '请输入名称',
  114. 'match' => 'is_string',
  115. 'update' => 'text',
  116. 'search' => 'fulltext',
  117. 'list' => true,
  118. ),
  119. 'type' => array
  120. (
  121. 'type' => 'varchar-800',
  122. 'name' => '内容数据类型',
  123. 'default' => '',
  124. 'desc' => '内容数据类型',
  125. 'match' => 'is_numeric',
  126. 'update' => 'checkbox',
  127. 'option' => $type,
  128. ),
  129. 'logo' => array
  130. (
  131. 'type' => 'varchar-150',
  132. 'name' => 'logo图-图片尺寸100*100px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  133. 'default' => '',
  134. 'desc' => 'logo图',
  135. 'match' => 'option',
  136. 'update' => 'image',
  137. 'key' => '1',
  138. 'place' => '100*100',
  139. ),
  140. 'cover' => array
  141. (
  142. 'type' => 'varchar-150',
  143. 'name' => '封面图-图片尺寸460*759px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  144. 'default' => '',
  145. 'desc' => '封面图',
  146. 'match' => 'option',
  147. 'update' => 'image',
  148. 'key' => '1',
  149. 'place' => '460*759',
  150. ),
  151. 'desc' => array
  152. (
  153. 'type' => 'varchar-800',
  154. 'name' => '简介',
  155. 'default' => '',
  156. 'desc' => '简介',
  157. 'match' => 'option',
  158. 'update' => 'textarea',
  159. ),
  160. 'status' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '上线状态',
  164. 'default' => '2',
  165. 'desc' => '上线状态',
  166. 'match' => 'is_numeric',
  167. //'update' => 'select',
  168. 'option' => $status,
  169. 'search' => 'select',
  170. 'list' => true,
  171. 'edit' => true,
  172. ),
  173. 'reorder' => array
  174. (
  175. 'type' => 'int-11',
  176. 'name' => '排序(数值越大越靠前)',
  177. 'default' => '1',
  178. 'desc' => '请输入排序',
  179. 'match' => 'option',
  180. //'update' => 'text',
  181. 'search' => 'order',
  182. 'list' => true,
  183. 'order' => 'desc',
  184. 'edit' => true,
  185. ),
  186. 'state' => array
  187. (
  188. 'type' => 'tinyint-1',
  189. 'name' => '状态',
  190. 'default' => '1',
  191. 'desc' => '请选择状态',
  192. 'match' => 'is_numeric',
  193. ),
  194. 'cdate' => array
  195. (
  196. 'type' => 'int-11',
  197. 'name' => '录入时间',
  198. 'match' => array('is_numeric', time()),
  199. 'desc' => '',
  200. # 只有insert时才生效
  201. 'insert' => true,
  202. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  203. ),
  204. ),
  205. # 默认值
  206. /*
  207. 'default' => array
  208. (
  209. 'col' => 'name,state,cdate',
  210. 'value' => array
  211. (
  212. '"默认分类",1,' . time(),
  213. ),
  214. ),
  215. */
  216. 'manage' => array
  217. (
  218. //'insert' => false,
  219. //'edit' => false,
  220. 'delete' => false,
  221. # 自定义快捷新增和编辑
  222. 'button' => array
  223. (
  224. '数据类型管理' => array('list', 'type&project=collection&oper_parent=cate&oper_project=collection'),
  225. ),
  226. ),
  227. 'top' => array
  228. (
  229. # 数据来源
  230. 'data' => 'state',
  231. # 菜单名
  232. 'name' => '项目选择',
  233. # 默认值
  234. 'value' => 1,
  235. # 对应的字段值,设置这个之后,所有设置等于这个值的字段,都要遵循这个权限的控制
  236. 'key' => Dever::config('base')->top,
  237. # 本表中代表名称的字段
  238. 'col' => 'name',
  239. ),
  240. 'request' => array
  241. (
  242. 'list' => $list,
  243. 'getAll' => array
  244. (
  245. # 匹配的正则或函数 选填项
  246. 'option' => array
  247. (
  248. 'state' => 1,
  249. 'status' => 2,
  250. ),
  251. 'type' => 'all',
  252. 'order' => array('reorder' => 'desc','id' => 'desc'),
  253. 'col' => 'id,name,logo',
  254. ),
  255. 'getIds' => array
  256. (
  257. # 匹配的正则或函数 选填项
  258. 'option' => array
  259. (
  260. 'ids' => array('yes-id', 'in'),
  261. 'status' => 2,
  262. 'state' => 1,
  263. ),
  264. 'type' => 'all',
  265. 'order' => array('reorder' => 'desc','id' => 'desc'),
  266. 'col' => '*,id as value|id',
  267. ),
  268. ),
  269. );