inbox.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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. 'update' => 'text',
  55. 'list' => true,
  56. ),
  57. 'from_uid' => array
  58. (
  59. 'type' => 'int-11',
  60. 'name' => '发件人',
  61. 'default' => '',
  62. 'desc' => '请填写发件人',
  63. 'match' => 'is_numeric',
  64. 'update' => 'text',
  65. 'list' => '{uid} > 0 ? {uid} : "系统"',
  66. ),
  67. 'name' => array
  68. (
  69. 'type' => 'varchar-30',
  70. 'name' => '发件标题',
  71. 'default' => '',
  72. 'desc' => '请填写发件标题',
  73. 'match' => 'is_string',
  74. 'update' => 'text',
  75. 'search' => 'fulltext',
  76. 'list' => true,
  77. ),
  78. 'content' => array
  79. (
  80. 'type' => 'text-255',
  81. 'name' => '发件内容',
  82. 'default' => '',
  83. 'desc' => '请填写发件内容',
  84. 'match' => 'is_string',
  85. 'update' => 'textarea',
  86. 'search' => 'fulltext',
  87. 'list' => true,
  88. ),
  89. 'type' => array
  90. (
  91. 'type' => 'int-11',
  92. 'name' => '消息类型',
  93. 'default' => '1',
  94. 'desc' => '消息类型',
  95. 'match' => 'is_numeric',
  96. 'option' => $type,
  97. 'update' => 'select',
  98. //'search' => 'select',
  99. 'list' => true,
  100. ),
  101. 'status' => array
  102. (
  103. 'type' => 'tinyint-1',
  104. 'name' => '已读状态',
  105. 'default' => '1',
  106. 'desc' => '请选择状态',
  107. 'match' => 'is_numeric',
  108. 'option' => $status,
  109. 'update' => 'radio',
  110. 'search' => 'select',
  111. 'list' => true,
  112. ),
  113. 'state' => array
  114. (
  115. 'type' => 'tinyint-1',
  116. 'name' => '状态',
  117. 'default' => '1',
  118. 'desc' => '请选择状态',
  119. 'match' => 'is_numeric',
  120. ),
  121. 'cdate' => array
  122. (
  123. 'type' => 'int-11',
  124. 'name' => '录入时间',
  125. 'match' => array('is_numeric', time()),
  126. 'desc' => '',
  127. # 只有insert时才生效
  128. 'insert' => true,
  129. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  130. ),
  131. ),
  132. 'manage' => array
  133. (
  134. ),
  135. # request 请求接口定义
  136. 'request' => array
  137. (
  138. # 获取列表页
  139. 'getAll' => array
  140. (
  141. # 匹配的正则或函数 选填项
  142. 'option' => array
  143. (
  144. //'name' => array('yes', 'like'),
  145. 'uid' => 'yes',
  146. 'status' => 'yes',
  147. 'state' => 1,
  148. ),
  149. 'type' => 'all',
  150. 'page' => array(15, 'list'),
  151. 'order' => array('id' => 'desc'),
  152. 'col' => '*',
  153. ),
  154. # 获取未读消息
  155. 'getInfo' => array
  156. (
  157. # 匹配的正则或函数 选填项
  158. 'where' => array
  159. (
  160. 'uid' => 'yes',
  161. 'status' => 'yes',
  162. 'type' => 'yes'
  163. ),
  164. 'type' => 'all',
  165. 'order' => array('id' => 'desc'),
  166. 'col' => '*',
  167. ),
  168. ),
  169. 'manage' => array
  170. (
  171. 'edit' => false,
  172. 'insert' => false,
  173. 'mul' => true,
  174. ),
  175. );