user_child.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. $config = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('score/config')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. return array
  13. (
  14. # 表名
  15. 'name' => 'user_child',
  16. # 显示给用户看的名称
  17. 'lang' => '用户子积分列表',
  18. 'order' => 100,
  19. 'menu' => 'passport',
  20. 'menu' => false,
  21. # 数据结构
  22. 'struct' => array
  23. (
  24. 'id' => array
  25. (
  26. 'type' => 'int-11',
  27. 'name' => 'ID',
  28. 'default' => '',
  29. 'desc' => '',
  30. 'match' => 'is_numeric',
  31. //'list' => true,
  32. ),
  33. 'uid' => array
  34. (
  35. 'type' => 'int-11',
  36. 'name' => '用户名',
  37. 'default' => '0',
  38. 'desc' => '请选择用户',
  39. 'match' => 'is_numeric',
  40. //'update' => 'select',
  41. //'search' => 'select',
  42. 'search' => array
  43. (
  44. 'api' => 'passport/user-all',
  45. 'col' => 'username',
  46. 'result' => 'id',
  47. ),
  48. 'list' => '{uid} > 0 ? Dever::load("passport/user-one#username", {uid}) : "匿名用户"',
  49. ),
  50. 'config_id' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => '积分名称',
  54. 'default' => '1',
  55. 'desc' => '积分名称',
  56. 'match' => 'is_numeric',
  57. 'update' => 'select',
  58. 'option' => $config,
  59. 'search' => 'select',
  60. 'list' => true,
  61. ),
  62. 'config_child_id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '子积分名称',
  66. 'default' => '',
  67. 'desc' => '子积分名称',
  68. 'match' => 'is_numeric',
  69. 'list' => 'Dever::load("score/config_child#name", {config_child_id})',
  70. ),
  71. 'score' => array
  72. (
  73. 'type' => 'varchar-80',
  74. 'name' => '可用数量',
  75. 'default' => '0',
  76. 'desc' => '可用数量',
  77. 'match' => 'option',
  78. 'update' => 'text',
  79. 'search' => 'order',
  80. 'list' => true,
  81. ),
  82. 'no_score' => array
  83. (
  84. 'type' => 'varchar-80',
  85. 'name' => '冻结数量',
  86. 'default' => '0',
  87. 'desc' => '冻结数量',
  88. 'match' => 'option',
  89. 'update' => 'text',
  90. 'search' => 'order',
  91. 'list' => true,
  92. ),
  93. 'cdate' => array
  94. (
  95. 'type' => 'int-11',
  96. 'name' => '录入时间',
  97. 'match' => array('is_numeric', time()),
  98. 'desc' => '',
  99. # 只有insert时才生效
  100. 'insert' => true,
  101. ),
  102. ),
  103. # 索引
  104. 'index' => array
  105. (
  106. 1 => array
  107. (
  108. 'search' => 'uid,config_id,config_child_id',
  109. ),
  110. # 版本号 更改版本号会更新当前表的索引
  111. 'version' => 1,
  112. ),
  113. 'manage' => array
  114. (
  115. 'delete' => false,
  116. 'edit' => false,
  117. 'insert' => false,
  118. # 列表
  119. 'list_button' => array
  120. (
  121. 'list' => array('积分日志', '"user_child_log&&project=score&search_option_uid={uid}&oper_parent=user&oper_project=score&top_project=passport&top_parent=user"'),
  122. ),
  123. ),
  124. # request 请求接口定义
  125. 'request' => array
  126. (
  127. 'getScoreByConfig' => array
  128. (
  129. # 匹配的正则或函数 选填项
  130. 'option' => array
  131. (
  132. 'uid' => 'yes',
  133. ),
  134. 'type' => 'all',
  135. 'order' => array('id' => 'desc'),
  136. 'col' => 'id,uid,config_child_id,score|config_child_id',
  137. ),
  138. )
  139. );