info.php 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. <?php
  2. $audit = Dever::config('base')->audit;
  3. $status = Dever::config('base')->status;
  4. $poster_pay_type = array
  5. (
  6. 1 => '未支付',
  7. 2 => '已支付',
  8. );
  9. $config = array
  10. (
  11. # 表名
  12. 'name' => 'info',
  13. # 显示给用户看的名称
  14. 'lang' => '需求列表',
  15. 'order' => 200,
  16. 'auto' => 10000000,
  17. 'end' => array
  18. (
  19. 'insert' => 'demand/lib/manage.demandUpdate',
  20. 'update' => 'demand/lib/manage.demandUpdate',
  21. ),
  22. # 同步更新另外一个或多个表的数据,将数据同步到关联表中
  23. 'sync' => array
  24. (
  25. 'demand/info_category' => array
  26. (
  27. # 更新另外一个表的字段 => 本表的字段
  28. 'where' => array('info_id', 'id'),
  29. # 要更新的数据
  30. 'update' => array('category_id' => 'category'),
  31. # 同步更新的类型,delete为先删再插入,update为直接更新
  32. 'type' => 'delete',
  33. )
  34. ),
  35. # 数据结构 不同的字段放这里
  36. 'struct' => array
  37. (
  38. 'id' => array
  39. (
  40. 'type' => 'int-11',
  41. 'name' => 'ID',
  42. 'default' => '',
  43. 'desc' => '',
  44. 'match' => 'is_numeric',
  45. //'list' => true,
  46. ),
  47. 'name' => array
  48. (
  49. 'type' => 'varchar-800',
  50. 'name' => '标题/描述',
  51. 'default' => '',
  52. 'desc' => '标题',
  53. 'match' => 'is_string',
  54. 'update' => 'textarea',
  55. 'search' => 'fulltext',
  56. //'list' => true,
  57. //'edit' => true,
  58. ),
  59. 'category' => array
  60. (
  61. 'type' => 'varchar-500',
  62. 'name' => '分类',
  63. 'default' => '',
  64. 'desc' => '分类',
  65. 'match' => 'is_string',
  66. 'search' => 'linkage',
  67. 'update' => 'linkage',
  68. 'option' => Dever::url('api.get', 'category'),
  69. //'list' => 'Dever::load("category/api.string", "{category}")',
  70. ),
  71. # 以下几个分类其实在关联表中已经有了,放到这里是为了查询方便,一般只有三级分类,多了就从关联表查询吧
  72. 'top_category_id' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '顶级分类ID-顶级分类,用于分类查询',
  76. 'default' => '-1',
  77. 'desc' => '顶级分类ID',
  78. 'match' => 'is_numeric',
  79. ),
  80. 'second_category_id' => array
  81. (
  82. 'type' => 'int-11',
  83. 'name' => '二级分类ID-二级分类,用于分类查询',
  84. 'default' => '-1',
  85. 'desc' => '二级分类ID',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'category_id' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '子分类ID-最后一个级别的分类,用于分类查询',
  92. 'default' => '-1',
  93. 'desc' => '子分类ID',
  94. 'match' => 'is_numeric',
  95. ),
  96. 'pic_cover' => array
  97. (
  98. 'type' => 'varchar-150',
  99. 'name' => '封面图-图片尺寸300*300px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式,用户上传图片之后会自动进行居中裁剪',
  100. 'default' => '',
  101. 'desc' => '封面图',
  102. 'match' => 'option',
  103. 'update' => 'image',
  104. 'key' => '1',
  105. 'place' => '150',
  106. 'list_name' => '需求详情',
  107. 'list' => 'Dever::load("demand/lib/manage.demandInfo", "{id}")',
  108. ),
  109. 'pic' => array
  110. (
  111. 'type' => 'text-255',
  112. 'name' => '多张图片-图片尺寸随意,一般为用户上传,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  113. 'default' => '',
  114. 'desc' => '多张图片',
  115. 'match' => 'option',
  116. 'update' => 'images',
  117. 'key' => '1',
  118. ),
  119. 'view_price' => array
  120. (
  121. 'type' => 'float-11',
  122. 'name' => '信息服务费-直接填写数字,此处为空则直接使用“需求设置”中的信息服务费,默认为空,如果为负数,则本需求不需要信息服务费,用户可以直接查看信息',
  123. 'default' => '0',
  124. 'desc' => '查看需求价格',
  125. 'match' => 'is_string',
  126. 'update' => 'text',
  127. //'list' => true,
  128. ),
  129. 'num_view' => array
  130. (
  131. 'type' => 'int-11',
  132. 'name' => '阅读数',
  133. 'default' => '0',
  134. 'desc' => '请填写阅读数',
  135. 'match' => 'option',
  136. 'search' => 'order',
  137. 'list' => '{num_view}+{num_add_view}',
  138. ),
  139. 'num_add_view' => array
  140. (
  141. 'type' => 'int-11',
  142. 'name' => '阅读数基数',
  143. 'default' => '0',
  144. 'desc' => '阅读数基数',
  145. 'match' => 'option',
  146. //'update' => 'text',
  147. ),
  148. 'poster_uid' => array
  149. (
  150. 'type' => 'int-11',
  151. 'name' => '创建人名称',
  152. 'default' => '-1',
  153. 'desc' => '创建人名称',
  154. 'match' => 'is_numeric',
  155. //'update' => 'text',
  156. 'search' => array
  157. (
  158. 'api' => 'passport/user-all',
  159. 'col' => 'username',
  160. 'result' => 'id',
  161. ),
  162. ),
  163. 'poster_pay_type' => array
  164. (
  165. 'type' => 'tinyint-1',
  166. 'name' => '创建人是否支付',
  167. 'default' => '1',
  168. 'desc' => '创建人是否支付',
  169. 'match' => 'is_numeric',
  170. //'update' => 'select',
  171. 'option' => $poster_pay_type,
  172. 'search' => 'select',
  173. ),
  174. 'audit' => array
  175. (
  176. 'type' => 'tinyint-1',
  177. 'name' => '审核',
  178. 'default' => '2',
  179. 'desc' => '审核',
  180. 'match' => 'is_numeric',
  181. //'update' => 'select',
  182. 'option' => $audit,
  183. 'search' => 'select',
  184. 'list' => true,
  185. 'edit' => true,
  186. ),
  187. 'status' => array
  188. (
  189. 'type' => 'tinyint-1',
  190. 'name' => '状态',
  191. 'default' => '1',
  192. 'desc' => '状态',
  193. 'match' => 'is_numeric',
  194. //'update' => 'select',
  195. 'option' => $status,
  196. 'search' => 'select',
  197. 'list' => true,
  198. 'edit' => true,
  199. ),
  200. 'admin_editor' => array
  201. (
  202. 'type' => 'int-11',
  203. 'name' => '后台操作人',
  204. 'default' => '1',
  205. 'desc' => '后台操作人',
  206. 'match' => 'is_numeric',
  207. ),
  208. 'reorder' => array
  209. (
  210. 'type' => 'int-11',
  211. 'name' => '排序-数值越大越靠前,相当于置顶',
  212. 'default' => '1',
  213. 'desc' => '请输入排序',
  214. 'match' => 'option',
  215. //'update' => 'text',
  216. 'search' => 'order',
  217. 'list' => true,
  218. 'order' => 'desc',
  219. 'edit' => true,
  220. ),
  221. 'udate' => array
  222. (
  223. 'type' => 'int-11',
  224. 'name' => '更新时间',
  225. 'match' => array('is_numeric', time()),
  226. 'desc' => '',
  227. ),
  228. 'content' => array
  229. (
  230. 'type' => 'text-800',
  231. 'name' => '内容',
  232. 'default' => '',
  233. 'desc' => '内容',
  234. 'match' => 'is_string',
  235. //'update' => 'editor',
  236. 'key' => '1',
  237. ),
  238. 'state' => array
  239. (
  240. 'type' => 'tinyint-1',
  241. 'name' => '数据状态',
  242. 'default' => '1',
  243. 'desc' => '请选择状态',
  244. 'match' => 'is_numeric',
  245. ),
  246. 'cdate' => array
  247. (
  248. 'type' => 'int-11',
  249. 'name' => '发布时间',
  250. 'match' => array('is_numeric', time()),
  251. 'desc' => '',
  252. # 只有insert时才生效
  253. 'insert' => true,
  254. 'search' => 'date',
  255. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  256. ),
  257. ),
  258. # 索引
  259. 'index' => array
  260. (
  261. 1 => array
  262. (
  263. 'search' => 'poster_uid,category,top_category_id,second_category_id,category_id',
  264. ),
  265. # 版本号 更改版本号会更新当前表的索引
  266. 'version' => 1,
  267. ),
  268. # 管理功能
  269. 'manage' => array
  270. (
  271. //'insert' => false,
  272. //'delete' => false,
  273. 'mul' => true,
  274. # 自定义快捷新增和编辑
  275. 'button' => array
  276. (
  277. //'类别管理' => array('list', 'cate&project=demand&search_option_key=cate&search_option_tablename=类别&oper_parent=info&oper_project=demand'),
  278. ),
  279. # 列表里的按钮
  280. 'list_button' => array
  281. (
  282. 'add' => array('属性设置', '"info_attr
  283. &project=demand
  284. &search_option_info_id={id}
  285. &search_option_category={category}
  286. &oper_parent=info&oper_project=demand
  287. &oper_save_jump=info
  288. &where_id={id}"'),
  289. 'br1' => array('<br />'),
  290. 'delete' => '删除',
  291. ),
  292. ),
  293. # request 请求接口定义
  294. 'request' => array
  295. (
  296. # 后台搜索用到
  297. 'search' => array
  298. (
  299. # 匹配的正则或函数 选填项
  300. 'option' => array
  301. (
  302. 'ids' => array('yes-id', 'in'),
  303. 'name' => array('yes', 'like'),
  304. 'id' => 'yes',
  305. 'state' => 1,
  306. ),
  307. 'type' => 'all',
  308. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  309. 'limit' => '0,1000',
  310. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  311. ),
  312. # 列表
  313. 'getAll' => array
  314. (
  315. # 匹配的正则或函数 选填项
  316. 'option' => array
  317. (
  318. 'audit' => 2,
  319. 'category' => array('yes', 'like'),
  320. 'top_category_id' => 'yes',
  321. 'second_category_id' => 'yes',
  322. 'category_id' => 'yes',
  323. //'status' => 1,
  324. 'poster_pay_type' => 2,
  325. 'state' => 1,
  326. ),
  327. 'type' => 'all',
  328. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  329. 'limit' => '0,10',
  330. //'page' => array(10, 'list'),
  331. 'col' => '*',
  332. ),
  333. # 分页
  334. 'getPageAll' => array
  335. (
  336. # 匹配的正则或函数 选填项
  337. 'option' => array
  338. (
  339. 'poster_uid' => 'yes',
  340. 'name' => array('yes', 'like'),
  341. 'audit' => 2,
  342. 'category' => array('yes', 'like'),
  343. 'top_category_id' => 'yes',
  344. 'second_category_id' => 'yes',
  345. 'category_id' => 'yes',
  346. //'status' => 1,
  347. 'poster_pay_type' => 2,
  348. 'state' => 1,
  349. ),
  350. 'type' => 'all',
  351. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  352. 'page' => array(10, 'list'),
  353. 'col' => '*',
  354. ),
  355. # 更新浏览量
  356. 'addView' => array
  357. (
  358. 'type' => 'update',
  359. 'where' => array
  360. (
  361. 'id' => 'yes',
  362. ),
  363. 'set' => array
  364. (
  365. 'num_view' => array('1', '+='),
  366. ),
  367. ),
  368. ),
  369. );
  370. return $config;