info.php 4.7 KB

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