service.php 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <?php
  2. $audit = Dever::config('base')->audit;
  3. $status = array
  4. (
  5. 1 => '上架',
  6. 2 => '下架',
  7. );
  8. # 常用的col
  9. $col = 'id,name,pic_cover,num_add_view+num_view as num_view,content,`desc`';
  10. return array
  11. (
  12. # 表名
  13. 'name' => 'service',
  14. # 显示给用户看的名称
  15. 'lang' => '服务咨询',
  16. 'order' => 99,
  17. # 数据结构
  18. 'struct' => array
  19. (
  20. 'id' => array
  21. (
  22. 'type' => 'int-11',
  23. 'name' => 'ID',
  24. 'default' => '',
  25. 'desc' => '',
  26. 'match' => 'is_numeric',
  27. 'list' => true,
  28. ),
  29. 'name' => array
  30. (
  31. 'type' => 'varchar-80',
  32. 'name' => '标题',
  33. 'default' => '',
  34. 'desc' => '标题',
  35. 'match' => 'is_string',
  36. 'update' => 'text',
  37. 'list' => true,
  38. 'search' => 'fulltext',
  39. ),
  40. 'phone' => array
  41. (
  42. 'type' => 'varchar-80',
  43. 'name' => '咨询电话',
  44. 'default' => '',
  45. 'desc' => '咨询电话',
  46. 'match' => 'is_string',
  47. 'update' => 'text',
  48. ),
  49. 'desc' => array
  50. (
  51. 'type' => 'varchar-500',
  52. 'name' => '摘要',
  53. 'default' => '',
  54. 'desc' => '摘要',
  55. 'match' => 'is_string',
  56. 'update' => 'textarea',
  57. ),
  58. 'pic_cover' => array
  59. (
  60. 'type' => 'varchar-150',
  61. 'name' => '1:1封面图-图片尺寸380*380px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  62. 'default' => '',
  63. 'desc' => '封面图',
  64. 'match' => 'is_string',
  65. 'update' => 'image',
  66. 'key' => '1',
  67. 'place' => '150',
  68. //直接上传到云端
  69. //'upload' => 'qiniu',
  70. //上传大数据
  71. //'large' => true,
  72. ),
  73. 'num_add_view' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => '浏览量基数',
  77. 'default' => '0',
  78. 'desc' => '浏览量基数',
  79. 'match' => 'option',
  80. //'update' => 'text',
  81. ),
  82. 'num_view' => array
  83. (
  84. 'type' => 'int-11',
  85. 'name' => '浏览量',
  86. 'default' => '0',
  87. 'desc' => '请填写浏览量',
  88. 'match' => 'option',
  89. 'search' => 'order',
  90. 'list' => '{num_view}+{num_add_view}',
  91. ),
  92. 'buy_add_view' => array
  93. (
  94. 'type' => 'int-11',
  95. 'name' => '购买基数',
  96. 'default' => '0',
  97. 'desc' => '购买基数',
  98. 'match' => 'option',
  99. //'update' => 'text',
  100. ),
  101. 'buy_view' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '购买量',
  105. 'default' => '0',
  106. 'desc' => '购买量',
  107. 'match' => 'option',
  108. 'search' => 'order',
  109. 'list' => '{buy_view}+{buy_add_view}',
  110. ),
  111. 'pdate' => array
  112. (
  113. 'type' => 'int-11',
  114. 'name' => '发布时间',
  115. 'match' => array('is_numeric', time()),
  116. 'default' => '',
  117. 'desc' => '',
  118. 'update' => 'date',
  119. 'callback' => 'maketime',
  120. 'insert' => true,
  121. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  122. 'auth' => '"{pdate}" > 0',
  123. ),
  124. 'reorder' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '排序(数值越大越靠前)',
  128. 'default' => '1',
  129. 'desc' => '请输入排序',
  130. 'match' => 'option',
  131. 'update' => 'text',
  132. 'search' => 'order',
  133. 'list' => true,
  134. 'order' => 'desc',
  135. 'edit' => true,
  136. ),
  137. 'content' => array
  138. (
  139. 'type' => 'text-255',
  140. 'name' => '内容',
  141. 'default' => '',
  142. 'desc' => '请输入内容',
  143. 'match' => 'is_string',
  144. 'update' => 'editor',
  145. 'key' => '1',
  146. //'media' => '5',//下面的音视频已经做到了
  147. //直接上传到云端
  148. //'upload' => 'qiniu',
  149. //上传大数据
  150. //'large' => true,
  151. //自定义编辑器右侧按钮
  152. /*
  153. 'editor' => array
  154. (
  155. 'name' => '选择插入模块',
  156. 'button' => array
  157. (
  158. array
  159. (
  160. # 名称
  161. 'name' => '图片',
  162. # 资源库id
  163. 'key' => 1,
  164. # 类型
  165. 'type' => 'image',
  166. ),
  167. array
  168. (
  169. 'name' => '音频',
  170. 'key' => 5,
  171. 'type' => 'media',
  172. ),
  173. array
  174. (
  175. 'name' => '视频',
  176. 'key' => 'video/lib/core.vod',
  177. ),
  178. array
  179. (
  180. 'name' => '直播',
  181. 'key' => 'video/lib/core.live',
  182. ),
  183. array
  184. (
  185. 'name' => '小程序',
  186. 'key' => 'content/lib/applet.update',
  187. 'type' => 'update',
  188. ),
  189. ),
  190. ),
  191. */
  192. ),
  193. 'status' => array
  194. (
  195. 'type' => 'int-11',
  196. 'name' => '状态',
  197. 'default' => '1',
  198. 'desc' => '状态',
  199. 'match' => 'is_numeric',
  200. 'update' => 'radio',
  201. 'option' => $status,
  202. ),
  203. 'state' => array
  204. (
  205. 'type' => 'tinyint-1',
  206. 'name' => '状态',
  207. 'default' => '1',
  208. 'desc' => '请选择状态',
  209. 'match' => 'is_numeric',
  210. ),
  211. 'cdate' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '录入时间',
  215. 'match' => array('is_numeric', time()),
  216. 'desc' => '',
  217. # 只有insert时才生效
  218. 'insert' => true,
  219. ),
  220. ),
  221. # 管理功能
  222. 'manage' => array
  223. (
  224. ),
  225. # request 请求接口定义
  226. 'request' => array
  227. (
  228. 'search' => array
  229. (
  230. # 匹配的正则或函数 选填项
  231. 'option' => array
  232. (
  233. 'ids' => array('yes-id', 'in'),
  234. 'name' => array('yes', 'like'),
  235. 'id' => 'yes',
  236. 'status' => 1,
  237. 'state' => 1,
  238. ),
  239. 'type' => 'all',
  240. 'order' => array('reorder' => 'desc', 'pdate' => 'desc'),
  241. 'limit' => '0,1000',
  242. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  243. ),
  244. 'getAll' => array
  245. (
  246. # 匹配的正则或函数 选填项
  247. 'option' => array
  248. (
  249. 'id' => 'yes',
  250. 'status' => 1,
  251. 'state' => 1,
  252. ),
  253. 'type' => 'all',
  254. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  255. 'page' => array(10, 'list'),
  256. 'col' => $col,
  257. ),
  258. 'getList' => array
  259. (
  260. # 匹配的正则或函数 选填项
  261. 'option' => array
  262. (
  263. 'status' => 1,
  264. 'state' => 1,
  265. ),
  266. 'type' => 'all',
  267. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  268. 'limit' => '0,10',
  269. 'col' => $col,
  270. ),
  271. 'getRelation' => array
  272. (
  273. # 匹配的正则或函数 选填项
  274. 'option' => array
  275. (
  276. 'noid' => array('yes-id', '!='),
  277. 'status' => 1,
  278. 'state' => 1,
  279. ),
  280. 'type' => 'all',
  281. 'order' => array('reorder' => 'desc','pdate' => 'desc'),
  282. 'limit' => '0,4',
  283. 'col' => $col,
  284. ),
  285. 'getOne' => array
  286. (
  287. # 匹配的正则或函数 选填项
  288. 'where' => array
  289. (
  290. 'id' => 'yes',
  291. ),
  292. 'type' => 'one',
  293. 'col' => $col,
  294. ),
  295. # 更新浏览量
  296. 'addView' => array
  297. (
  298. 'type' => 'update',
  299. 'where' => array
  300. (
  301. 'id' => 'yes',
  302. ),
  303. 'set' => array
  304. (
  305. 'num_view' => array('1', '+='),
  306. ),
  307. ),
  308. ),
  309. );