xuniren.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452
  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. 'beizhu' => array
  274. (
  275. 'type' => 'varchar-500',
  276. 'name' => '备注',
  277. 'default' => '',
  278. 'desc' => '备注',
  279. 'match' => 'option',
  280. 'update' => 'textarea',
  281. ),
  282. 'reorder' => array
  283. (
  284. 'type' => 'int-11',
  285. 'name' => '排序(数值越大越靠前)',
  286. 'default' => '1',
  287. 'desc' => '请输入排序',
  288. 'match' => 'option',
  289. //'update' => 'text',
  290. 'search' => 'order',
  291. 'list' => true,
  292. 'order' => 'desc',
  293. 'edit' => true,
  294. ),
  295. 'top' => array
  296. (
  297. 'type' => 'int-11',
  298. 'name' => '是否推荐到首页',
  299. 'default' => '1',
  300. 'desc' => '是否推荐到首页',
  301. 'match' => 'is_numeric',
  302. 'update' => 'select',
  303. 'option' => $top,
  304. 'search' => 'select',
  305. 'list' => true,
  306. 'edit' => true,
  307. ),
  308. 'status' => array
  309. (
  310. 'type' => 'int-11',
  311. 'name' => '登场状态',
  312. 'default' => '1',
  313. 'desc' => '登场状态',
  314. 'match' => 'is_numeric',
  315. 'update' => 'select',
  316. 'option' => $status,
  317. 'search' => 'select',
  318. 'list' => true,
  319. 'edit' => true,
  320. ),
  321. 'state' => array
  322. (
  323. 'type' => 'tinyint-1',
  324. 'name' => '状态',
  325. 'default' => '1',
  326. 'desc' => '请选择状态',
  327. 'match' => 'is_numeric',
  328. ),
  329. 'cdate' => array
  330. (
  331. 'type' => 'int-11',
  332. 'name' => '创建时间',
  333. 'match' => array('is_numeric', time()),
  334. 'desc' => '',
  335. # 只有insert时才生效
  336. 'insert' => true,
  337. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  338. 'search' => 'date',
  339. ),
  340. ),
  341. # 管理功能
  342. 'manage' => array
  343. (
  344. ),
  345. # 更新表结构
  346. 'alter' => array
  347. (
  348. ),
  349. # request 请求接口定义
  350. 'request' => array
  351. (
  352. 'search' => array
  353. (
  354. # 匹配的正则或函数 选填项
  355. 'option' => array
  356. (
  357. 'ids' => array('yes-id', 'in'),
  358. 'name' => array('yes', 'like'),
  359. 'id' => 'yes',
  360. 'status' => 1,
  361. 'state' => 1,
  362. ),
  363. 'type' => 'all',
  364. 'order' => array('reorder' => 'desc','cdate' => 'desc'),
  365. 'limit' => '0,1000',
  366. 'col' => 'name as name, id, id as value, "" as selected, "" as disabled|id',
  367. ),
  368. 'getHome' => array
  369. (
  370. # 匹配的正则或函数 选填项
  371. 'option' => array
  372. (
  373. 'ids' => array('yes-id', 'in'),
  374. 'name' => array('yes', 'like'),
  375. 'id' => 'yes',
  376. 'status' => 1,
  377. 'state' => 1,
  378. ),
  379. 'type' => 'all',
  380. 'order' => array('top' => 'desc', 'reorder' => 'desc', 'cdate' => 'desc'),
  381. 'limit' => '0,10',
  382. 'col' => '*',
  383. ),
  384. 'getAll' => array
  385. (
  386. # 匹配的正则或函数 选填项
  387. 'option' => array
  388. (
  389. 'status' => 'yes',
  390. 'state' => 1,
  391. ),
  392. 'type' => 'all',
  393. 'order' => array('shou' => 'asc', 'reorder' => 'desc', 'id' => 'desc'),
  394. 'col' => '*|shou|',
  395. ),
  396. 'getDataByCreater' => array
  397. (
  398. # 匹配的正则或函数 选填项
  399. 'option' => array
  400. (
  401. 'creater_id' => 'yes',
  402. 'status' => 1,
  403. 'state' => 1,
  404. ),
  405. 'type' => 'all',
  406. 'order' => array('reorder' => 'desc', 'id' => 'desc'),
  407. 'page' => array(100, 'list'),
  408. 'col' => '*',
  409. ),
  410. ),
  411. );