inbox.php 4.3 KB

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