admin_role.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | admin.php 管理员表
  5. |--------------------------------------------------------------------------
  6. */
  7. return array
  8. (
  9. # 表名
  10. 'name' => 'admin_role',
  11. # 显示给用户看的名称
  12. 'lang' => '管理员角色关联表',
  13. 'menu' => false,
  14. # 数据结构
  15. 'struct' => array
  16. (
  17. 'id' => array
  18. (
  19. 'type' => 'int-11',
  20. 'name' => 'ID',
  21. 'default' => '',
  22. 'desc' => '',
  23. 'match' => 'is_numeric',
  24. 'search' => 'order',
  25. 'list' => true,
  26. ),
  27. 'admin_id' => array
  28. (
  29. 'type' => 'int-11',
  30. 'name' => '管理员ID',
  31. 'default' => '',
  32. 'desc' => '管理员ID',
  33. 'match' => 'is_numeric',
  34. 'update' => 'text',
  35. 'list' => true,
  36. ),
  37. 'role_id' => array
  38. (
  39. 'type' => 'int-11',
  40. 'name' => '角色ID',
  41. 'default' => '',
  42. 'desc' => '角色ID',
  43. 'match' => 'is_numeric',
  44. 'update' => 'text',
  45. 'list' => true,
  46. ),
  47. 'cdate' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => '录入时间',
  51. 'match' => array('is_numeric', DEVER_TIME),
  52. 'desc' => '',
  53. # 只有insert时才生效
  54. 'insert' => true,
  55. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  56. ),
  57. ),
  58. # request 请求接口定义
  59. 'request' => array
  60. (
  61. '*getTest' => array
  62. (
  63. 'where' => array
  64. (
  65. 'id' => 'yes',
  66. ),
  67. 'type' => 'one',
  68. #join为临时解决方案,不建议用join,建议用relate,join仅支持mysql
  69. # 联表
  70. 'join' => array
  71. (
  72. array
  73. (
  74. 'table' => 'manage/admin',
  75. 'type' => 'left join',
  76. 'on' => array('admin_id','id'),
  77. 'col' => 'username',
  78. ),
  79. ),
  80. # 检索相关的数据
  81. 'relate' => array
  82. (
  83. 'manage/admin-one' => array
  84. (
  85. 'option_id' => 'admin_id'
  86. ),
  87. ),
  88. ),
  89. /*
  90. 'getAll' => array
  91. (
  92. 'where' => array
  93. (
  94. 'config' => 'yes',
  95. 'state' => 1,
  96. 't_2.cate_id_in' => array('yes-t_2.cate_id', 'in'),
  97. 't_2.cate_id' => 'yes',
  98. ),
  99. 'join' => array
  100. (
  101. array
  102. (
  103. 'table' => 'service/company',
  104. 'type' => 'left join',
  105. 'on' => array('company_id','id'),
  106. 'col' => 't_2.id as cid',
  107. ),
  108. ),
  109. 'type' => 'all',
  110. 'limit' => '0,5',
  111. 'order' => array('t_2.sdate' => 'desc','id' => 'desc'),
  112. 'col' => 'id,t_1.name,t_1.content,t_2.name as company_name',
  113. ),
  114. */
  115. # query测试
  116. '*getTest1' => array
  117. (
  118. 'query' => 'select * from {table} where id = ?',
  119. 'type' => 'one',
  120. ),
  121. 'getData' => array
  122. (
  123. # 匹配的正则或函数 选填项
  124. 'option' => array
  125. (
  126. 'role_id' => array('yes', 'in'),
  127. ),
  128. 'order' => array('id' => 'desc'),
  129. 'type' => 'all',
  130. 'col' => 'admin_id|admin_id',
  131. ),
  132. )
  133. );