info.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?php
  2. $config = function()
  3. {
  4. $array = array();
  5. $info = Dever::db('account/config')->state();
  6. if($info)
  7. {
  8. $array += $info;
  9. }
  10. return $array;
  11. };
  12. $project = function()
  13. {
  14. $array = array();
  15. $data = Dever::load('account/config_project-state');
  16. if($data)
  17. {
  18. $array += $data;
  19. }
  20. return $array;
  21. };
  22. $user = '用户ID';
  23. $search = 'fulltext';
  24. $config_id = Dever::input('search_option_config_id');
  25. if ($config_id) {
  26. $search_config = Dever::load('account/lib/info')->getSearch($config_id);
  27. if ($search_config) {
  28. $search = $search_config;
  29. $user = '用户名称';
  30. }
  31. }
  32. return array
  33. (
  34. # 表名
  35. 'name' => 'info',
  36. # 显示给用户看的名称
  37. 'lang' => '用户账户列表',
  38. 'order' => 100,
  39. # 数据结构
  40. 'struct' => array
  41. (
  42. 'id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => 'ID',
  46. 'default' => '',
  47. 'desc' => '',
  48. 'match' => 'is_numeric',
  49. //'list' => true,
  50. ),
  51. 'uid' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => $user,
  55. 'default' => '0',
  56. 'desc' => '用户名称',
  57. 'match' => 'is_numeric',
  58. 'search' => $search,
  59. 'list_name' => '用户名称',
  60. 'list' => 'Dever::load("account/lib/info.getName", {uid}, {config_id})',
  61. ),
  62. 'config_id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '账户名称',
  66. 'default' => '1',
  67. 'desc' => '账户名称',
  68. 'match' => 'is_numeric',
  69. 'update' => 'select',
  70. 'option' => $config,
  71. 'search' => 'select',
  72. 'list' => true,
  73. ),
  74. 'project_id' => array
  75. (
  76. 'type' => 'int-11',
  77. 'name' => '所属项目',
  78. 'default' => '1',
  79. 'desc' => '所属项目',
  80. 'match' => 'is_numeric',
  81. 'update' => 'radio',
  82. 'option' => $project,
  83. 'list' => true,
  84. ),
  85. 'cash' => array
  86. (
  87. 'type' => 'decimal-11,2',
  88. 'name' => '可用金额',
  89. 'default' => '0',
  90. 'desc' => '可用金额',
  91. 'match' => 'option',
  92. 'update' => 'text',
  93. 'list' => true,
  94. ),
  95. 'z_cash' => array
  96. (
  97. 'type' => 'decimal-11,2',
  98. 'name' => '总获取金额',
  99. 'default' => '0',
  100. 'desc' => '总获取金额',
  101. 'match' => 'option',
  102. 'update' => 'text',
  103. 'list' => true,
  104. ),
  105. 't_cash' => array
  106. (
  107. 'type' => 'decimal-11,2',
  108. 'name' => '总消耗金额',
  109. 'default' => '0',
  110. 'desc' => '总消耗金额',
  111. 'match' => 'option',
  112. 'update' => 'text',
  113. 'list' => true,
  114. ),
  115. 'state' => array
  116. (
  117. 'type' => 'tinyint-1',
  118. 'name' => '状态',
  119. 'default' => '1',
  120. 'desc' => '请选择状态',
  121. 'match' => 'is_numeric',
  122. ),
  123. 'cdate' => array
  124. (
  125. 'type' => 'int-11',
  126. 'name' => '录入时间',
  127. 'match' => array('is_numeric', time()),
  128. 'desc' => '',
  129. # 只有insert时才生效
  130. 'insert' => true,
  131. ),
  132. ),
  133. # 索引
  134. 'index' => array
  135. (
  136. 1 => array
  137. (
  138. 'search' => 'uid,config_id,project_id',
  139. ),
  140. # 版本号 更改版本号会更新当前表的索引
  141. 'version' => 1,
  142. ),
  143. 'manage' => array
  144. (
  145. 'delete' => false,
  146. 'edit' => false,
  147. 'insert' => false,
  148. # 列表
  149. 'list_button' => array
  150. (
  151. 'list' => array('账户流水', '"info_log&&project=account&search_option_uid={uid}&oper_parent=info&oper_project=account"'),
  152. ),
  153. ),
  154. # request 请求接口定义
  155. 'request' => array
  156. (
  157. # 更新
  158. 'inc' => array
  159. (
  160. 'type' => 'update',
  161. 'where' => array
  162. (
  163. 'id' => 'yes',
  164. ),
  165. 'set' => array
  166. (
  167. 'cash' => array('yes', '+='),
  168. 'col' => array('yes-z_cash', '+='),
  169. ),
  170. ),
  171. # 更新
  172. 'dec' => array
  173. (
  174. 'type' => 'update',
  175. 'where' => array
  176. (
  177. 'id' => 'yes',
  178. ),
  179. 'set' => array
  180. (
  181. 'cash' => array('yes', '+='),
  182. 'col' => array('yes-t_cash', '+='),
  183. ),
  184. ),
  185. )
  186. );