xuniren.php 14 KB

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