info_attr.php 3.8 KB

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