info.php 4.2 KB

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