inbox.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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-all');
  16. };
  17. return array
  18. (
  19. # 表名
  20. 'name' => 'inbox',
  21. # 显示给用户看的名称
  22. 'lang' => '收件箱',
  23. 'order' => 18,
  24. 'menu' => false,
  25. # 数据结构
  26. 'struct' => array
  27. (
  28. 'id' => array
  29. (
  30. 'type' => 'int-11',
  31. 'name' => 'ID',
  32. 'default' => '',
  33. 'desc' => '',
  34. 'match' => 'is_numeric',
  35. 'search' => 'fulltext',
  36. 'order' => 'desc',
  37. 'list' => true,
  38. ),
  39. 'oid' => array
  40. (
  41. 'type' => 'int-11',
  42. 'name' => '收件id',
  43. 'default' => '',
  44. 'desc' => '请填写收件id',
  45. 'match' => 'is_numeric',
  46. 'update' => 'text',
  47. //'list' => true,
  48. ),
  49. 'uid' => array
  50. (
  51. 'type' => 'int-11',
  52. 'name' => '收件人',
  53. 'default' => '',
  54. 'desc' => '请填写收件人',
  55. 'match' => 'is_numeric',
  56. 'update' => 'text',
  57. //'list' => true,
  58. ),
  59. 'from_uid' => array
  60. (
  61. 'type' => 'int-11',
  62. 'name' => '发件人',
  63. 'default' => '',
  64. 'desc' => '请填写发件人',
  65. 'match' => 'is_numeric',
  66. 'update' => 'text',
  67. //'list' => true,
  68. ),
  69. 'name' => array
  70. (
  71. 'type' => 'varchar-30',
  72. 'name' => '发件标题',
  73. 'default' => '',
  74. 'desc' => '请填写发件标题',
  75. 'match' => 'is_string',
  76. 'update' => 'text',
  77. //'list' => true,
  78. ),
  79. 'content' => array
  80. (
  81. 'type' => 'text-255',
  82. 'name' => '发件内容',
  83. 'default' => '',
  84. 'desc' => '请填写发件内容',
  85. 'match' => 'is_string',
  86. 'update' => 'textarea',
  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. 'option' => $option,
  121. 'update' => 'radio',
  122. 'search' => 'select',
  123. 'list' => true,
  124. ),
  125. 'cdate' => array
  126. (
  127. 'type' => 'int-11',
  128. 'name' => '录入时间',
  129. 'match' => array('is_numeric', time()),
  130. 'desc' => '',
  131. # 只有insert时才生效
  132. 'insert' => true,
  133. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  134. ),
  135. ),
  136. 'manage' => array
  137. (
  138. ),
  139. # request 请求接口定义
  140. 'request' => array
  141. (
  142. # 获取列表页
  143. 'getAll' => array
  144. (
  145. # 匹配的正则或函数 选填项
  146. 'option' => array
  147. (
  148. //'name' => array('yes', 'like'),
  149. 'uid' => 'yes',
  150. 'status' => 'yes',
  151. 'state' => 1,
  152. ),
  153. 'type' => 'all',
  154. 'page' => array(10, 'list'),
  155. 'order' => array('id' => 'desc'),
  156. 'col' => '*',
  157. ),
  158. # 获取未读消息
  159. 'getInfo' => array
  160. (
  161. # 匹配的正则或函数 选填项
  162. 'where' => array
  163. (
  164. 'uid' => 'yes',
  165. 'status' => 'yes',
  166. 'type' => 'yes'
  167. ),
  168. 'type' => 'all',
  169. 'order' => array('id' => 'desc'),
  170. 'col' => '*',
  171. ),
  172. # 获取列表页
  173. 'readYes' => array
  174. (
  175. # 匹配的正则或函数 选填项
  176. 'where' => array
  177. (
  178. 'uid' => 'yes',
  179. ),
  180. 'set' => array
  181. (
  182. 'status' => 2,
  183. ),
  184. 'type' => 'update',
  185. ),
  186. ),
  187. );