xuniren.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <?php
  2. $status = array
  3. (
  4. 1 => '已登场',
  5. 2 => '未登场',
  6. );
  7. $top = array
  8. (
  9. 1 => '不推荐',
  10. 2 => '首页推荐',
  11. );
  12. $sex = array
  13. (
  14. 1 => '男',
  15. 2 => '女',
  16. 3 => '不详',
  17. );
  18. $creater = function()
  19. {
  20. $array = array();
  21. $info = Dever::db('content/creater')->state();
  22. if($info)
  23. {
  24. $array += $info;
  25. }
  26. return $array;
  27. };
  28. return array
  29. (
  30. # 表名
  31. 'name' => 'xuniren',
  32. # 显示给用户看的名称
  33. 'lang' => '虚拟人管理',
  34. 'order' => 99,
  35. 'end' => array
  36. (
  37. 'insert' => 'content/lib/manage.updateXnr',
  38. 'update' => 'content/lib/manage.updateXnr',
  39. ),
  40. # 同步更新另外一个或多个表的多条关联数据,以逗号隔开
  41. 'sync' => array
  42. (
  43. 'content/creater_xuniren' => array
  44. (
  45. # 更新时的条件,另外一个表的字段 => 本表的字段
  46. 'where' => array('xid', 'id'),
  47. # 要更新的数据
  48. 'update' => array('cid' => 'creater_ids'),
  49. # 同步更新的类型,delete为先删再插入,update为先查询是否存在,存在直接更新,不存在则插入, only为仅更新
  50. 'type' => 'delete',
  51. )
  52. ),
  53. # 数据结构
  54. 'struct' => array
  55. (
  56. 'id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => 'ID',
  60. 'default' => '',
  61. 'desc' => '',
  62. 'match' => 'is_numeric',
  63. 'list' => true,
  64. ),
  65. 'name' => array
  66. (
  67. 'type' => 'varchar-80',
  68. 'name' => '名称',
  69. 'default' => '',
  70. 'desc' => '名称',
  71. 'match' => 'is_string',
  72. 'update' => 'text',
  73. 'list' => true,
  74. 'search' => 'fulltext',
  75. ),
  76. 'ename' => array
  77. (
  78. 'type' => 'varchar-30',
  79. 'name' => '英文名称',
  80. 'default' => '',
  81. 'desc' => '英文名称',
  82. 'match' => 'is_string',
  83. 'update' => 'text',
  84. 'list' => true,
  85. 'search' => 'fulltext',
  86. ),
  87. 'shou' => array
  88. (
  89. 'type' => 'varchar-80',
  90. 'name' => '首字母',
  91. 'default' => '',
  92. 'desc' => '首字母',
  93. 'match' => 'is_string',
  94. ),
  95. 'pic' => array
  96. (
  97. 'type' => 'text-255',
  98. 'name' => '形象大图-可以上传多张,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  99. 'default' => '',
  100. 'desc' => '形象大图',
  101. 'match' => 'option',
  102. 'update' => 'images',
  103. 'key' => '1',
  104. 'place' => '1242*1863',
  105. ),
  106. 'sex' => array
  107. (
  108. 'type' => 'int-11',
  109. 'name' => '性别',
  110. 'default' => '1',
  111. 'desc' => '性别',
  112. 'match' => 'is_numeric',
  113. 'update' => 'select',
  114. 'option' => $sex,
  115. 'search' => 'select',
  116. 'list' => true,
  117. ),
  118. 'bdate' => array
  119. (
  120. 'type' => 'int-11',
  121. 'name' => '出生日期-将根据出生日期计算年龄,为空则展示不详',
  122. 'default' => '',
  123. 'desc' => '出生日期',
  124. 'match' => 'is_numeric',
  125. 'callback' => 'maketime',
  126. 'update' => 'time',
  127. 'list' => 'date("Y-m-d", {bdate})',
  128. ),
  129. 'city' => array
  130. (
  131. 'type' => 'varchar-500',
  132. 'name' => '诞生地',
  133. 'default' => '',
  134. 'desc' => '诞生地',
  135. 'match' => 'is_string',
  136. 'update' => 'text',
  137. ),
  138. 'creater_id' => array
  139. (
  140. 'type' => 'int-11',
  141. 'name' => '造物主-关联单个造物主,废弃',
  142. 'default' => '-1',
  143. 'desc' => '造物主',
  144. 'match' => 'is_numeric',
  145. //'update' => 'select',
  146. //'option' => $creater,
  147. //'search' => 'select',
  148. ),
  149. 'creater_ids' => array
  150. (
  151. 'type' => 'varchar-1000',
  152. 'name' => '造物主-直接输入造物主名称,将自动进行匹配出来,之后选择一个即可',
  153. 'default' => '',
  154. 'desc' => '造物主',
  155. 'match' => 'option',
  156. 'update' => 'text',
  157. 'search' => 'select',
  158. 'search' => array
  159. (
  160. 'api' => 'content/creater_xuniren-all',//接口地址,最好是获取多条数据的地址
  161. 'col' => 'cid',//要查询的字段
  162. 'result' => 'xid',//返回的字段
  163. 'search' => 'id',//本表的字段,默认为当前的字段
  164. 'option' => $creater,
  165. ),
  166. //如果要输入带有自动提示的,就打开这个,update=>'text'即可
  167. 'autocomplete' => array('content/lib/manage.getByCreaterName', 'id', 'content/creater-getData'),
  168. //'list' => true,
  169. //显示
  170. //'show' => 'cate=tag/manage.getByCate?cate=',
  171. ),
  172. 'waimao' => array
  173. (
  174. 'type' => 'varchar-500',
  175. 'name' => '外貌特征',
  176. 'default' => '',
  177. 'desc' => '外貌特征',
  178. 'match' => 'is_string',
  179. 'update' => 'textarea',
  180. ),
  181. 'aihao' => array
  182. (
  183. 'type' => 'varchar-500',
  184. 'name' => '爱好特长/职业',
  185. 'default' => '',
  186. 'desc' => '爱好特长/职业',
  187. 'match' => 'is_string',
  188. 'update' => 'textarea',
  189. ),
  190. 'info' => array
  191. (
  192. 'type' => 'varchar-500',
  193. 'name' => '简介',
  194. 'default' => '',
  195. 'desc' => '简介',
  196. 'match' => 'is_string',
  197. 'update' => 'textarea',
  198. ),
  199. 'news' => array
  200. (
  201. 'type' => 'text-1000',
  202. 'name' => '关联资讯',
  203. 'default' => '',
  204. 'desc' => '关联资讯',
  205. 'match' => 'is_string',
  206. 'update' => array
  207. (
  208. array
  209. (
  210. 'col' => 'name',
  211. 'name' => '资讯标题',
  212. 'default' => '',
  213. 'desc' => '资讯标题',
  214. 'match' => 'is_string',
  215. 'update' => 'text',
  216. ),
  217. array
  218. (
  219. 'col' => 'link',
  220. 'name' => '资讯链接',
  221. 'default' => '',
  222. 'desc' => '资讯链接',
  223. 'match' => 'is_string',
  224. 'update' => 'textarea',
  225. ),
  226. ),
  227. ),
  228. 'pdate' => array
  229. (
  230. 'type' => 'int-11',
  231. 'name' => '初登场时间',
  232. 'match' => 'is_numeric',
  233. 'default' => '',
  234. 'desc' => '',
  235. 'update' => 'time',
  236. 'callback' => 'maketime',
  237. //'list' => 'date("Y-m-d H:i:s", {pdate})',
  238. ),
  239. 'share_title' => array
  240. (
  241. 'type' => 'varchar-100',
  242. 'name' => '分享标题',
  243. 'default' => '',
  244. 'desc' => '分享标题',
  245. 'match' => 'option',
  246. 'update' => 'text',
  247. ),
  248. 'share_pic' => array
  249. (
  250. 'type' => 'varchar-150',
  251. 'name' => '分享图片-图片尺寸570*570px或等比尺寸,上传大小不能超过2M,支持JPG、PNG、GIF格式,建议上传JPG格式',
  252. 'default' => '',
  253. 'desc' => '分享图片',
  254. 'match' => 'option',
  255. 'update' => 'image',
  256. 'key' => '1',
  257. 'place' => '150',
  258. //'upload' => 'qiniu',
  259. //'large' => true,
  260. ),
  261. 'share_content' => array
  262. (
  263. 'type' => 'varchar-200',
  264. 'name' => '分享内容',
  265. 'default' => '',
  266. 'desc' => '分享内容',
  267. 'match' => 'option',
  268. 'update' => 'textarea',
  269. ),
  270. 'beizhu' => array
  271. (
  272. 'type' => 'varchar-500',
  273. 'name' => '备注',
  274. 'default' => '',
  275. 'desc' => '备注',
  276. 'match' => 'option',
  277. 'update' => 'textarea',
  278. ),
  279. 'reorder' => array
  280. (
  281. 'type' => 'int-11',
  282. 'name' => '排序(数值越大越靠前)',
  283. 'default' => '1',
  284. 'desc' => '请输入排序',
  285. 'match' => 'option',
  286. //'update' => 'text',
  287. 'search' => 'order',
  288. 'list' => true,
  289. 'order' => 'desc',
  290. 'edit' => true,
  291. ),
  292. 'top' => array
  293. (
  294. 'type' => 'int-11',
  295. 'name' => '是否推荐到首页',
  296. 'default' => '1',
  297. 'desc' => '是否推荐到首页',
  298. 'match' => 'is_numeric',
  299. 'update' => 'select',
  300. 'option' => $top,
  301. 'search' => 'select',
  302. 'list' => true,
  303. 'edit' => true,
  304. ),
  305. 'status' => array
  306. (
  307. 'type' => 'int-11',
  308. 'name' => '登场状态',
  309. 'default' => '1',
  310. 'desc' => '登场状态',
  311. 'match' => 'is_numeric',
  312. 'update' => 'select',
  313. 'option' => $status,
  314. 'search' => 'select',
  315. 'list' => true,
  316. 'edit' => true,
  317. ),
  318. 'state' => array
  319. (
  320. 'type' => 'tinyint-1',
  321. 'name' => '状态',
  322. 'default' => '1',
  323. 'desc' => '请选择状态',
  324. 'match' => 'is_numeric',
  325. ),
  326. 'cdate' => array
  327. (
  328. 'type' => 'int-11',
  329. 'name' => '创建时间',
  330. 'match' => array('is_numeric', time()),
  331. 'desc' => '',
  332. # 只有insert时才生效
  333. 'insert' => true,
  334. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  335. 'search' => 'date',
  336. ),
  337. ),
  338. # 管理功能
  339. 'manage' => array
  340. (
  341. ),
  342. # 更新表结构
  343. 'alter' => array
  344. (
  345. ),
  346. # request 请求接口定义
  347. 'request' => array
  348. (
  349. 'search' => array
  350. (
  351. # 匹配的正则或函数 选填项
  352. 'option' => array
  353. (
  354. 'ids' => array('yes-id', 'in'),
  355. 'name' => array('yes', 'like'),
  356. 'id' => 'yes',
  357. 'status' => 1,
  358. 'state' => 1,
  359. ),
  360. 'type' => 'all',
  361. 'order' => array('reorder' => 'desc','cdate' => 'desc'),
  362. 'limit' => '0,1000',
  363. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  364. ),
  365. 'getHome' => array
  366. (
  367. # 匹配的正则或函数 选填项
  368. 'option' => array
  369. (
  370. 'ids' => array('yes-id', 'in'),
  371. 'name' => array('yes', 'like'),
  372. 'id' => 'yes',
  373. 'status' => 1,
  374. 'state' => 1,
  375. ),
  376. 'type' => 'all',
  377. 'order' => array('top' => 'desc', 'reorder' => 'desc', 'cdate' => 'desc'),
  378. 'limit' => '0,10',
  379. 'col' => '*',
  380. ),
  381. 'getAll' => array
  382. (
  383. # 匹配的正则或函数 选填项
  384. 'option' => array
  385. (
  386. 'status' => 'yes',
  387. 'state' => 1,
  388. ),
  389. 'type' => 'all',
  390. 'order' => array('shou' => 'asc', 'reorder' => 'desc', 'id' => 'desc'),
  391. 'col' => '*|shou|',
  392. ),
  393. 'getDataByCreater' => array
  394. (
  395. # 匹配的正则或函数 选填项
  396. 'option' => array
  397. (
  398. 'creater_id' => 'yes',
  399. 'status' => 1,
  400. 'state' => 1,
  401. ),
  402. 'type' => 'all',
  403. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  404. 'page' => array(100, 'list'),
  405. 'col' => '*',
  406. ),
  407. ),
  408. );