info_attr.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. list($category, $attr, $table, $create) = getInfoAttr();
  3. //print_r($attr);die;
  4. $config = array
  5. (
  6. # 表名
  7. 'name' => 'info_attr' . $table,
  8. # 显示给用户看的名称
  9. 'lang' => '属性规格',
  10. 'order' => 100,
  11. 'menu' => false,
  12. 'create' => $create,
  13. 'attr' => $attr,
  14. 'auto' => 10000000,
  15. 'end' => array
  16. (
  17. 'insert' => 'attr/lib/manage.update',
  18. 'update' => 'attr/lib/manage.update',
  19. ),
  20. # 数据结构 不同的字段放这里
  21. 'struct' => array
  22. (
  23. 'id' => array
  24. (
  25. 'type' => 'int-11',
  26. 'name' => 'ID',
  27. 'default' => '',
  28. 'desc' => '',
  29. 'match' => 'is_numeric',
  30. 'search' => 'order',
  31. 'update' => 'hidden',
  32. 'value' => Dever::input('where_id')
  33. //'list' => true,
  34. ),
  35. 'info_id' => array
  36. (
  37. 'type' => 'int-11',
  38. 'name' => '资源',
  39. 'default' => '',
  40. 'desc' => '资源',
  41. 'match' => 'is_numeric',
  42. 'update' => 'hidden',
  43. 'value' => Dever::input('search_option_info_id')
  44. ),
  45. 'category' => array
  46. (
  47. 'type' => 'varchar-500',
  48. 'name' => '分类-直接继承主表的分类',
  49. 'default' => '',
  50. 'desc' => '分类',
  51. 'match' => 'is_string',
  52. 'update' => 'hidden',
  53. 'value' => $category
  54. ),
  55. 'cdate' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '发布时间',
  59. 'match' => array('is_numeric', time()),
  60. 'desc' => '',
  61. # 只有insert时才生效
  62. 'insert' => true,
  63. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  64. ),
  65. ),
  66. # 索引
  67. 'index' => array
  68. (
  69. 1 => array
  70. (
  71. 'search' => 'info_id',
  72. ),
  73. # 版本号 更改版本号会更新当前表的索引
  74. 'version' => 1,
  75. ),
  76. # 管理功能
  77. 'manage' => array
  78. (
  79. ),
  80. # request 请求接口定义
  81. 'request' => array
  82. (
  83. # 分页
  84. 'getPageAll' => array
  85. (
  86. # 匹配的正则或函数 选填项
  87. 'option' => array
  88. (
  89. 'audit' => array('yes-t_2.audit', 2),
  90. 'category' => array('yes-t_2.category', 'like'),
  91. 'top_category_id' => array('yes-t_2.top_category_id'),
  92. 'second_category_id' => array('yes-t_2.second_category_id'),
  93. 'category_id' => array('yes-t_2.category_id'),
  94. //'status' => 1,
  95. //'poster_pay_type' => array('yes-t_2.poster_pay_type', 2),
  96. 'state' => array('yes-t_2.state', 1),
  97. ),
  98. # 联表
  99. 'join' => array
  100. (
  101. array
  102. (
  103. 'table' => 'res/info',
  104. 'type' => 'left join',
  105. 'on' => array('info_id','id'),
  106. 'col' => 'info_id',
  107. ),
  108. ),
  109. 'type' => 'all',
  110. 'order' => array('reorder' => 'desc', 't_1.id' => 'desc'),
  111. 'page' => array(10, 'list'),
  112. 'col' => '*',
  113. ),
  114. ),
  115. );
  116. # 属性完全自定义吧。这种情况用dever就是方便了。其他框架都需要自己实现
  117. Dever::load('attr/api')->setDatabaseConfig($attr, $config);
  118. return $config;