inbox.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. # 定义几个常用的选项
  3. $option = array
  4. (
  5. 1 => '显示',
  6. 2 => '不显示',
  7. );
  8. $status = array
  9. (
  10. 1 => '未读',
  11. 2 => '已读',
  12. );
  13. $type = function()
  14. {
  15. return Dever::load('message/type-state');
  16. };
  17. return array
  18. (
  19. # 表名
  20. 'name' => 'inbox',
  21. # 显示给用户看的名称
  22. 'lang' => '收件箱',
  23. 'order' => 18,
  24. # 数据结构
  25. 'struct' => array
  26. (
  27. 'id' => array
  28. (
  29. 'type' => 'int-11',
  30. 'name' => 'ID',
  31. 'default' => '',
  32. 'desc' => '',
  33. 'match' => 'is_numeric',
  34. 'order' => 'desc',
  35. 'list' => true,
  36. ),
  37. 'oid' => 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. 'uid' => array
  48. (
  49. 'type' => 'int-11',
  50. 'name' => '收件人',
  51. 'default' => '',
  52. 'desc' => '请填写收件人',
  53. 'match' => 'is_numeric',
  54. 'search' => 'fulltext',
  55. 'update' => 'text',
  56. 'list' => true,
  57. ),
  58. 'from_uid' => array
  59. (
  60. 'type' => 'int-11',
  61. 'name' => '发件人',
  62. 'default' => '',
  63. 'desc' => '请填写发件人',
  64. 'match' => 'is_numeric',
  65. 'search' => 'fulltext',
  66. 'update' => 'text',
  67. 'list' => '{uid} > 0 ? {uid} : "系统"',
  68. ),
  69. 'name' => array
  70. (
  71. 'type' => 'varchar-30',
  72. 'name' => '发件标题',
  73. 'default' => '',
  74. 'desc' => '请填写发件标题',
  75. 'match' => 'is_string',
  76. 'update' => 'text',
  77. 'search' => 'fulltext',
  78. 'list' => true,
  79. ),
  80. 'content' => array
  81. (
  82. 'type' => 'text-255',
  83. 'name' => '发件内容',
  84. 'default' => '',
  85. 'desc' => '请填写发件内容',
  86. 'match' => 'is_string',
  87. 'update' => 'textarea',
  88. 'search' => 'fulltext',
  89. 'list' => true,
  90. ),
  91. 'type' => array
  92. (
  93. 'type' => 'int-11',
  94. 'name' => '消息类型',
  95. 'default' => '1',
  96. 'desc' => '消息类型',
  97. 'match' => 'is_numeric',
  98. 'option' => $type,
  99. 'update' => 'select',
  100. //'search' => 'select',
  101. 'list' => true,
  102. ),
  103. 'status' => array
  104. (
  105. 'type' => 'tinyint-1',
  106. 'name' => '已读状态',
  107. 'default' => '1',
  108. 'desc' => '请选择状态',
  109. 'match' => 'is_numeric',
  110. 'option' => $status,
  111. 'update' => 'radio',
  112. 'search' => 'select',
  113. 'list' => true,
  114. ),
  115. 'state' => array
  116. (
  117. 'type' => 'tinyint-1',
  118. 'name' => '状态',
  119. 'default' => '1',
  120. 'desc' => '请选择状态',
  121. 'match' => 'is_numeric',
  122. ),
  123. 'cdate' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '录入时间',
  127. 'match' => array('is_numeric', time()),
  128. 'desc' => '',
  129. # 只有insert时才生效
  130. 'insert' => true,
  131. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  132. ),
  133. ),
  134. 'manage' => array
  135. (
  136. ),
  137. # request 请求接口定义
  138. 'request' => array
  139. (
  140. # 获取列表页
  141. 'getAll' => array
  142. (
  143. # 匹配的正则或函数 选填项
  144. 'option' => array
  145. (
  146. //'name' => array('yes', 'like'),
  147. 'uid' => 'yes',
  148. 'status' => 'yes',
  149. 'state' => 1,
  150. ),
  151. 'type' => 'all',
  152. 'page' => array(15, 'list'),
  153. 'order' => array('id' => 'desc'),
  154. 'col' => '*',
  155. ),
  156. # 获取未读消息
  157. 'getInfo' => array
  158. (
  159. # 匹配的正则或函数 选填项
  160. 'where' => array
  161. (
  162. 'uid' => 'yes',
  163. 'status' => 'yes',
  164. 'type' => 'yes'
  165. ),
  166. 'type' => 'all',
  167. 'order' => array('id' => 'desc'),
  168. 'col' => '*',
  169. ),
  170. ),
  171. 'manage' => array
  172. (
  173. 'edit' => false,
  174. 'insert' => false,
  175. 'mul' => true,
  176. ),
  177. );