share.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. $table = array
  3. (
  4. 1 => '资讯',
  5. 2 => '课程',
  6. 3 => '会议',
  7. );
  8. $info = function()
  9. {
  10. $array = array();
  11. $info = Dever::load('set/info-state');
  12. if($info)
  13. {
  14. $array += $info;
  15. }
  16. return $array;
  17. };
  18. return array
  19. (
  20. # 表名
  21. 'name' => 'share',
  22. # 显示给用户看的名称
  23. 'lang' => '分享列表',
  24. # 是否显示在后台菜单
  25. 'order' => 70,
  26. # 数据结构
  27. 'struct' => array
  28. (
  29. 'id' => array
  30. (
  31. 'type' => 'int-11',
  32. 'name' => 'ID',
  33. 'default' => '',
  34. 'desc' => '',
  35. 'match' => 'is_numeric',
  36. 'order' => 'desc',
  37. //'list' => true,
  38. ),
  39. 'uid' => array
  40. (
  41. 'type' => 'int-11',
  42. 'name' => '用户',
  43. 'default' => '0',
  44. 'desc' => '请选择用户',
  45. 'match' => 'is_numeric',
  46. //'update' => 'select',
  47. //'search' => 'select',
  48. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#name", {uid}) : "匿名用户"',
  49. ),
  50. 'info_id' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => '所属小程序',
  54. 'default' => '1',
  55. 'desc' => '请选择所属小程序',
  56. 'match' => 'is_numeric',
  57. 'update' => 'select',
  58. 'option' => $info,
  59. 'search' => 'select',
  60. 'list' => '{info_id} > 0 ? Dever::load("set/info-one#name", {info_id}) : "未知"',
  61. ),
  62. 'source_table' => array
  63. (
  64. 'type' => 'tinyint-1',
  65. 'name' => '分享类别',
  66. 'default' => '',
  67. 'desc' => '分享类别',
  68. 'match' => 'option',
  69. 'option' => $table,
  70. 'list' => true,
  71. ),
  72. 'source_id' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '标题',
  76. 'default' => '',
  77. 'desc' => '标题',
  78. 'match' => 'option',
  79. 'list' => 'Dever::load("set/manage.load", "{source_table}", {source_id})',
  80. ),
  81. 'content' => array
  82. (
  83. 'type' => 'text-255',
  84. 'name' => '分享内容',
  85. 'update' => 'textarea',
  86. 'key' => 1,
  87. 'default' => '',
  88. 'desc' => '请输入内容',
  89. 'match' => 'is_string',
  90. 'search' => 'fulltext',
  91. 'list' => 'table',
  92. 'modal' => '查看详情',
  93. ),
  94. 'key' => array
  95. (
  96. 'type' => 'varchar-32',
  97. 'name' => '分享标识',
  98. 'default' => '',
  99. 'desc' => '请输入分享标识',
  100. 'match' => 'option',
  101. ),
  102. 'state' => array
  103. (
  104. 'type' => 'tinyint-1',
  105. 'name' => '状态',
  106. 'default' => '1',
  107. 'desc' => '请选择状态',
  108. 'match' => 'is_numeric',
  109. ),
  110. 'cdate' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => '录入时间',
  114. 'match' => array('is_numeric', time()),
  115. 'desc' => '',
  116. # 只有insert时才生效
  117. 'insert' => true,
  118. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  119. ),
  120. ),
  121. 'manage' => array
  122. (
  123. 'insert' => false,
  124. 'edit' => false,
  125. 'delete' => false,
  126. ),
  127. # request 请求接口定义
  128. 'request' => array
  129. (
  130. 'getAll' => array
  131. (
  132. # 匹配的正则或函数 选填项
  133. 'option' => array
  134. (
  135. 'info_id' => 'yes',
  136. 'source_table' => 'yes',
  137. 'source_id' => 'yes',
  138. ),
  139. 'type' => 'all',
  140. 'order' => array('cdate' => 'desc'),
  141. 'page' => array(10, 'list'),
  142. 'col' => '*',
  143. ),
  144. ),
  145. );