inbox.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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. 'link' => array
  96. (
  97. 'type' => 'varchar-30',
  98. 'name' => '链接-选填,如有链接,则点击消息跳转至该链接',
  99. 'default' => '',
  100. 'desc' => '链接',
  101. 'match' => 'option',
  102. 'search' => 'fulltext',
  103. 'update' => 'text',
  104. ),
  105. 'project_id' => array
  106. (
  107. 'type' => 'int-11',
  108. 'name' => '所属项目',
  109. 'default' => '1',
  110. 'desc' => '所属项目',
  111. 'match' => 'is_numeric',
  112. 'option' => $project,
  113. 'update' => 'select',
  114. //'search' => 'select',
  115. 'list' => true,
  116. ),
  117. 'type' => array
  118. (
  119. 'type' => 'int-11',
  120. 'name' => '消息类型',
  121. 'default' => '1',
  122. 'desc' => '消息类型',
  123. 'match' => 'is_numeric',
  124. 'option' => $type,
  125. 'update' => 'select',
  126. //'search' => 'select',
  127. 'list' => true,
  128. ),
  129. 'scope' => array
  130. (
  131. 'type' => 'tinyint-1',
  132. 'name' => '消息范围',
  133. 'default' => '1',
  134. 'desc' => '消息范围',
  135. 'match' => 'is_numeric',
  136. 'option' => $scope,
  137. 'update' => 'radio',
  138. 'search' => 'select',
  139. 'list' => true,
  140. ),
  141. 'param' => array
  142. (
  143. 'type' => 'varchar-800',
  144. 'name' => '传入参数-一般为json格式数据',
  145. 'default' => '',
  146. 'desc' => '传入参数',
  147. 'match' => 'is_string',
  148. ),
  149. 'status' => array
  150. (
  151. 'type' => 'tinyint-1',
  152. 'name' => '已读状态',
  153. 'default' => '1',
  154. 'desc' => '请选择状态',
  155. 'match' => 'is_numeric',
  156. 'option' => $status,
  157. 'update' => 'radio',
  158. 'search' => 'select',
  159. 'list' => true,
  160. ),
  161. 'state' => array
  162. (
  163. 'type' => 'tinyint-1',
  164. 'name' => '状态',
  165. 'default' => '1',
  166. 'desc' => '请选择状态',
  167. 'match' => 'is_numeric',
  168. ),
  169. 'cdate' => array
  170. (
  171. 'type' => 'int-11',
  172. 'name' => '录入时间',
  173. 'match' => array('is_numeric', time()),
  174. 'desc' => '',
  175. # 只有insert时才生效
  176. 'insert' => true,
  177. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  178. ),
  179. ),
  180. 'manage' => array
  181. (
  182. ),
  183. # request 请求接口定义
  184. 'request' => array
  185. (
  186. # 获取总数
  187. 'total' => array
  188. (
  189. # 匹配的正则或函数 选填项
  190. 'option' => array
  191. (
  192. //'name' => array('yes', 'like'),
  193. 'uid' => 'yes',
  194. 'project_id' => 'yes',
  195. 'type' => array('yes', 'in'),
  196. 'status' => 'yes',
  197. 'state' => 1,
  198. ),
  199. 'type' => 'count',
  200. 'col' => 'count(1) as total',
  201. ),
  202. # 获取列表页
  203. 'getAll' => array
  204. (
  205. # 匹配的正则或函数 选填项
  206. 'option' => array
  207. (
  208. //'name' => array('yes', 'like'),
  209. 'uid' => 'yes',
  210. 'project_id' => 'yes',
  211. 'type' => array('yes', 'in'),
  212. 'status' => 'yes',
  213. 'state' => 1,
  214. ),
  215. 'type' => 'all',
  216. 'page' => array(15, 'list'),
  217. 'order' => array('status' => 'asc', 'id' => 'desc'),
  218. 'col' => '*',
  219. ),
  220. # 获取未读消息
  221. 'getInfo' => array
  222. (
  223. # 匹配的正则或函数 选填项
  224. 'where' => array
  225. (
  226. 'project_id' => 'yes',
  227. 'uid' => 'yes',
  228. 'status' => 'yes',
  229. 'type' => 'yes'
  230. ),
  231. 'type' => 'all',
  232. 'order' => array('status' => 'asc', 'id' => 'desc'),
  233. 'col' => '*',
  234. ),
  235. ),
  236. 'manage' => array
  237. (
  238. 'edit' => false,
  239. 'insert' => false,
  240. 'mul' => true,
  241. ),
  242. );