cate.php 8.0 KB

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