cate.php 7.1 KB

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