info.php 4.5 KB

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