data.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <?php
  2. $audit = Dever::config('base')->audit;
  3. $copyright = array
  4. (
  5. 1 => '原创',
  6. 2 => '非原创',
  7. );
  8. $wechat = function()
  9. {
  10. $array = array();
  11. $info = Dever::db('spider/wechat')->state();
  12. if($info)
  13. {
  14. $array += $info;
  15. }
  16. return $array;
  17. };
  18. return array
  19. (
  20. # 表名
  21. 'name' => 'data',
  22. # 显示给用户看的名称
  23. 'lang' => '文章列表',
  24. 'order' => 100,
  25. 'end' => array
  26. (
  27. 'update' => 'spider/lib/get.up',
  28. 'update_audit' => 'spider/lib/get.up',
  29. ),
  30. # 同步更新另外一个或多个表的数据
  31. /*
  32. 'syncone' => array
  33. (
  34. 'audit/data' => array
  35. (
  36. # 更新另外一个表的字段 => 本表的字段
  37. 'where' => array('data_id' => 'id', 'type' => 1),
  38. # 要更新的数据
  39. 'update' => array('data_id' => 'id', 'type' => 1, 'pdate' => 'pdate', 'reorder' => 'reorder', 'name' => 'name', 'audit' => 'audit', 'status' => 'status', 'cate_id' => 'cate_id'),
  40. )
  41. ),
  42. */
  43. # 数据结构
  44. 'struct' => array
  45. (
  46. 'id' => array
  47. (
  48. 'type' => 'int-11',
  49. 'name' => 'ID',
  50. 'default' => '',
  51. 'desc' => '',
  52. 'match' => 'is_numeric',
  53. //'list' => true,
  54. ),
  55. 'wechat_id' => array
  56. (
  57. 'type' => 'int-11',
  58. 'name' => '所属公众号',
  59. 'default' => '1',
  60. 'desc' => '所属公众号',
  61. 'match' => 'is_numeric',
  62. //'update' => 'select',
  63. 'option' => $wechat,
  64. 'search' => 'select',
  65. 'list' => true,
  66. ),
  67. 'name' => array
  68. (
  69. 'type' => 'varchar-180',
  70. 'name' => '标题',
  71. 'default' => '',
  72. 'desc' => '标题',
  73. 'match' => 'is_string',
  74. 'update' => 'text',
  75. 'list' => true,
  76. //增加预览
  77. 'preview' => true,
  78. ),
  79. 'copyright' => array
  80. (
  81. 'type' => 'int-11',
  82. 'name' => '原创',
  83. 'default' => '1',
  84. 'desc' => '原创',
  85. 'match' => 'is_numeric',
  86. 'update' => 'select',
  87. 'option' => $copyright,
  88. 'search' => 'select',
  89. 'list' => true,
  90. ),
  91. 'cover' => array
  92. (
  93. 'type' => 'varchar-150',
  94. 'name' => '封面图',
  95. 'default' => '',
  96. 'desc' => '封面图',
  97. 'match' => 'option',
  98. 'update' => 'image',
  99. 'key' => '1',
  100. 'place' => '150',
  101. ),
  102. 'state' => array
  103. (
  104. 'type' => 'tinyint-1',
  105. 'name' => '状态',
  106. 'default' => '1',
  107. 'desc' => '请选择状态',
  108. 'match' => 'is_numeric',
  109. ),
  110. 'content' => array
  111. (
  112. 'type' => 'text-255',
  113. 'name' => '内容',
  114. 'default' => '',
  115. 'desc' => '请输入内容',
  116. 'match' => 'is_string',
  117. 'update' => 'editor',
  118. ),
  119. 'pdate' => array
  120. (
  121. 'type' => 'int-11',
  122. 'name' => '发布时间',
  123. 'match' => 'is_numeric',
  124. 'default' => '',
  125. 'desc' => '',
  126. 'update' => 'date',
  127. 'callback' => 'maketime',
  128. 'order' => 'desc',
  129. 'list' => 'date("Y-m-d H:i:s", {pdate})',
  130. ),
  131. 'audit' => array
  132. (
  133. 'type' => 'int-11',
  134. 'name' => '审核状态',
  135. 'default' => '1',
  136. 'desc' => '审核',
  137. 'match' => 'is_numeric',
  138. 'update' => 'select',
  139. 'option' => $audit,
  140. 'search' => 'select',
  141. 'list' => true,
  142. 'edit' => true,
  143. ),
  144. 'cdate' => array
  145. (
  146. 'type' => 'int-11',
  147. 'name' => '录入时间',
  148. 'match' => array('is_numeric', time()),
  149. 'desc' => '',
  150. # 只有insert时才生效
  151. 'insert' => true,
  152. ),
  153. ),
  154. # 管理功能
  155. 'manage' => array
  156. (
  157. 'insert' => false,
  158. ),
  159. # request 请求接口定义
  160. 'request' => array
  161. (
  162. ),
  163. );