inbox.php 3.7 KB

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