UserExtractServices.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\services\user;
  13. use app\jobs\system\CapitalFlowJob;
  14. use app\model\user\UserExtract;
  15. use app\services\BaseServices;
  16. use app\dao\user\UserExtractDao;
  17. use app\services\order\StoreOrderCreateServices;
  18. use app\services\wechat\WechatUserServices;
  19. use crmeb\exceptions\AdminException;
  20. use crmeb\services\wechat\Payment;
  21. use crmeb\services\FormBuilder as Form;
  22. use crmeb\services\WithdrawService;
  23. use crmeb\traits\ServicesTrait;
  24. use FormBuilder\Factory\Iview;
  25. use think\exception\ValidateException;
  26. use think\facade\Route as Url;
  27. /**
  28. *
  29. * Class UserExtractServices
  30. * @package app\services\user
  31. * @mixin UserExtractDao
  32. */
  33. class UserExtractServices extends BaseServices
  34. {
  35. use ServicesTrait;
  36. /**
  37. * UserExtractServices constructor.
  38. * @param UserExtractDao $dao
  39. */
  40. public function __construct(UserExtractDao $dao)
  41. {
  42. $this->dao = $dao;
  43. }
  44. /**
  45. * 获取一条提现记录
  46. * @param int $id
  47. * @param array $field
  48. * @return array|\think\Model|null
  49. */
  50. public function getExtract(int $id, array $field = [])
  51. {
  52. return $this->dao->get($id, $field);
  53. }
  54. /**
  55. * 获取某个用户提现总数
  56. * @param int $uid
  57. * @return float
  58. */
  59. public function getUserExtract(int $uid)
  60. {
  61. return $this->dao->getWhereSum(['uid' => $uid, 'status' => [0, 1]]);
  62. }
  63. /**
  64. * 获取某些用户的提现总数列表
  65. * @param array $uids
  66. */
  67. public function getUsersSumList(array $uids)
  68. {
  69. return $this->dao->getWhereSumList(['uid' => $uids, 'status' => [0, 1]]);
  70. }
  71. public function getCount(array $where = [])
  72. {
  73. return $this->dao->getCount($where);
  74. }
  75. /**
  76. * 获取提现列表
  77. * @param array $where
  78. * @param string $field
  79. * @return array
  80. * @throws \think\db\exception\DataNotFoundException
  81. * @throws \think\db\exception\DbException
  82. * @throws \think\db\exception\ModelNotFoundException
  83. */
  84. public function getUserExtractList(array $where, string $field = '*')
  85. {
  86. [$page, $limit] = $this->getPageValue();
  87. $list = $this->dao->getExtractList($where, $field, $page, $limit);
  88. foreach ($list as &$item) {
  89. $item['nickname'] = $item['user']['nickname'] ?? '';
  90. }
  91. $count = $this->dao->count($where);
  92. return compact('list', 'count');
  93. }
  94. /**
  95. * 获取提现总数
  96. * @param array $where
  97. */
  98. public function getExtractSum(array $where)
  99. {
  100. return $this->dao->getExtractMoneyByWhere($where, 'extract_price');
  101. }
  102. /**
  103. * 拒绝提现申请
  104. * @param $id
  105. * @param $fail_msg
  106. * @return bool
  107. * @throws \think\db\exception\DataNotFoundException
  108. * @throws \think\db\exception\ModelNotFoundException
  109. * @throws \think\exception\DbException
  110. */
  111. public function changeFail(int $id, $userExtract, $message)
  112. {
  113. $fail_time = time();
  114. $extract_number = bcadd((string)$userExtract['extract_price'], (string)$userExtract['extract_fee'], 2);
  115. $mark = '提现失败,退回佣金' . $extract_number . '元';
  116. $uid = $userExtract['uid'];
  117. $status = -1;
  118. /** @var UserServices $userServices */
  119. $userServices = app()->make(UserServices::class);
  120. $user = $userServices->getUserInfo($uid);
  121. if (!$user) {
  122. throw new ValidateException('用户不存在');
  123. }
  124. /** @var UserBrokerageServices $userBrokerageServices */
  125. $userBrokerageServices = app()->make(UserBrokerageServices::class);
  126. $this->transaction(function () use ($user, $userBrokerageServices, $uid, $id, $extract_number, $message, $userServices, $status, $fail_time) {
  127. $now_brokerage = bcadd((string)$user['brokerage_price'], (string)$extract_number, 2);
  128. //增加佣金记录
  129. $userBrokerageServices->income('extract_fail', $uid, $extract_number, $now_brokerage, $id);
  130. //修改用户佣金
  131. if (!$userServices->update($uid, ['brokerage_price' => $now_brokerage], 'uid'))
  132. throw new AdminException('增加用户佣金失败');
  133. if (!$this->dao->update($id, ['fail_time' => $fail_time, 'fail_msg' => $message, 'status' => $status])) {
  134. throw new AdminException('修改失败');
  135. }
  136. });
  137. //消息推送
  138. event('notice.notice', [['uid' => $uid, 'userType' => strtolower($user['user_type']), 'extract_number' => $extract_number, 'nickname' => $user['nickname'], 'message' => $message], 'user_balance_change']);
  139. return true;
  140. }
  141. /**
  142. * 通过提现申请
  143. * @param $id
  144. * @return bool
  145. * @throws \think\db\exception\DataNotFoundException
  146. * @throws \think\db\exception\ModelNotFoundException
  147. * @throws \think\exception\DbException
  148. */
  149. public function changeSuccess(int $id, $userExtract)
  150. {
  151. $extractNumber = $userExtract['extract_price'];
  152. $this->transaction(function () use ($id, $userExtract, $extractNumber) {
  153. if ($userExtract['extract_type'] != 'bank') {
  154. if (!$this->dao->update($id, ['status' => 1])) {
  155. throw new AdminException('修改失败');
  156. }
  157. //配置开启自动到零钱
  158. if (sys_config('brokerage_type', 0)) {
  159. /** @var WechatUserServices $wechatServices */
  160. $wechatServices = app()->make(WechatUserServices::class);
  161. $openid = $wechatServices->getWechatOpenid((int)$userExtract['uid'], 'wechat');
  162. if ($openid) {//公众号用户
  163. $type = Payment::WEB;
  164. } else {//小程序用户
  165. $openid = $wechatServices->getWechatOpenid((int)$userExtract['uid'], 'routine');
  166. $type = Payment::MINI;
  167. }
  168. //app微信用户
  169. if (!$openid) {
  170. $openid = $wechatServices->getWechatOpenid((int)$userExtract['uid'], 'app');
  171. $type = Payment::APP;
  172. }
  173. if ($openid) {
  174. /** @var StoreOrderCreateServices $services */
  175. $services = app()->make(StoreOrderCreateServices::class);
  176. $wechat_order_id = $services->getNewOrderId();
  177. $res = Payment::merchantPay($openid, $wechat_order_id, $extractNumber, '提现佣金到零钱', $type);
  178. if (!$res) {
  179. throw new ValidateException('企业付款到零钱失败,请稍后再试');
  180. }
  181. } else {
  182. throw new ValidateException('该用户暂不支持企业付款到零钱,请手动转账');
  183. }
  184. }
  185. /** @var UserServices $userServices */
  186. $userServices = app()->make(UserServices::class);
  187. $userType = $userServices->value(['uid' => $userExtract['uid']], 'user_type');
  188. $nickname = $userServices->value(['uid' => $userExtract['uid']], 'nickname');
  189. $phone = $userServices->value(['uid' => $userExtract['uid']], 'phone');
  190. switch ($userExtract['extract_type']) {
  191. case 'bank':
  192. $order_id = $userExtract['bank_code'];
  193. break;
  194. case 'weixin':
  195. $order_id = $userExtract['wechat'];
  196. break;
  197. case 'alipay':
  198. $order_id = $userExtract['alipay_code'];
  199. break;
  200. default:
  201. $order_id = '';
  202. break;
  203. }
  204. //记录资金流水队列
  205. CapitalFlowJob::dispatch([['order_id' => $order_id, 'store_id' => 0, 'uid' => $userExtract['uid'], 'nickname' => $nickname, 'phone' => $phone, 'price' => $extractNumber, 'pay_type' => $userExtract['extract_type']], 'extract']);
  206. //消息推送
  207. event('notice.notice', [['uid' => $userExtract['uid'], 'userType' => strtolower($userType), 'extractNumber' => $extractNumber, 'nickname' => $nickname], 'user_extract']);
  208. } else {
  209. if (!$this->dao->update($id, ['status' => 2])) {
  210. throw new AdminException('修改失败');
  211. }
  212. // $userServices = app()->make(UserServices::class);
  213. // $userInfo = $userServices->get($userExtract['uid']);
  214. // if (!$userInfo['professional_id']) {
  215. // throw new ValidateException('用户未认证签约');
  216. // }
  217. // $bankInfo = WithdrawService::init()::contractInfo($userInfo['enterprise_professional_facilitator_id']);
  218. // if (!$bankInfo['sign_img']) throw new ValidateException('用户未签约');
  219. // $res = WithdrawService::init()::fastIssuing(
  220. // $userInfo['professional_id'],
  221. // $userExtract['id'],
  222. // $bankInfo['name'],
  223. // $bankInfo['cer_code'],
  224. // $bankInfo['mobile'],
  225. // $bankInfo['bank_code'],
  226. // $extractNumber,
  227. // '佣金提现'
  228. // );
  229. // if ($res) {
  230. // $this->dao->update($id, ['trade_number' => $res['trade_number']]);
  231. // }
  232. }
  233. });
  234. return true;
  235. }
  236. /**
  237. * 显示资源列表
  238. * @param array $where
  239. * @return array
  240. * @throws \think\db\exception\DataNotFoundException
  241. * @throws \think\db\exception\DbException
  242. * @throws \think\db\exception\ModelNotFoundException
  243. */
  244. public function index(array $where)
  245. {
  246. $list = $this->getUserExtractList($where);
  247. //待提现金额
  248. $where['status'] = 0;
  249. $extract_statistics['price'] = $this->getExtractSum($where);
  250. //已提现金额
  251. $where['status'] = 1;
  252. $extract_statistics['priced'] = $this->getExtractSum($where);
  253. //佣金总金额
  254. /** @var UserBrokerageServices $userBrokerageServices */
  255. $userBrokerageServices = app()->make(UserBrokerageServices::class);
  256. $extract_statistics['brokerage_count'] = $userBrokerageServices->getUsersBokerageSum(array_merge($where, ['pm' => 1, 'not_type' => ['extract_fail', 'refund']]));
  257. //未提现金额
  258. $extract_statistics['brokerage_not'] = $extract_statistics['brokerage_count'] > $extract_statistics['priced'] ? bcsub((string)$extract_statistics['brokerage_count'], (string)$extract_statistics['priced'], 2) : 0.00;
  259. return compact('extract_statistics', 'list');
  260. }
  261. /**
  262. * 显示编辑资源表单页.
  263. *
  264. * @param int $id
  265. * @return \think\Response
  266. */
  267. public function edit(int $id)
  268. {
  269. $UserExtract = $this->getExtract($id);
  270. if (!$UserExtract) {
  271. throw new AdminException('数据不存在!');
  272. }
  273. $f = array();
  274. $f[] = Form::input('real_name', '姓名', $UserExtract['real_name']);
  275. $f[] = Form::number('extract_price', '提现金额', (float)$UserExtract['extract_price'])->precision(2)->disabled(true);
  276. if ($UserExtract['extract_type'] == 'alipay') {
  277. $f[] = Form::input('alipay_code', '支付宝账号', $UserExtract['alipay_code']);
  278. } else if ($UserExtract['extract_type'] == 'weixin') {
  279. $f[] = Form::input('wechat', '微信号', $UserExtract['wechat']);
  280. } else {
  281. $f[] = Form::input('bank_code', '银行卡号', $UserExtract['bank_code']);
  282. $f[] = Form::input('bank_address', '开户行', $UserExtract['bank_address']);
  283. }
  284. $f[] = Form::input('mark', '备注', $UserExtract['mark'])->type('textarea');
  285. return create_form('编辑', $f, Url::buildUrl('/finance/extract/' . $id), 'PUT');
  286. }
  287. public function changeOrderStatusForm(int $id)
  288. {
  289. $f = array();
  290. $f[] = Form::radio('status', '审核意见', '1')->setOptions([['label' => '通过', 'value' => '1'], ['label' => '拒绝', 'value' => '5'],]);
  291. $f[] = Form::frameImage('icon', '具体结算清单', Url::buildUrl(config('admin.admin_prefix') . '/widget.images/index', array('fodder' => 'icon')))->icon('ios-add')->width('960px')->height('505px')->modal(['footer-hide' => true])->appendValidate(Iview::validateStr()->required()->message('请选择具体结算清单'));
  292. $f[] = Form::frameImage('image', '公章图片', Url::buildUrl(config('admin.admin_prefix') . '/widget.images/index', array('fodder' => 'image')))->icon('ios-add')->width('960px')->height('505px')->modal(['footer-hide' => true])->appendValidate(Iview::validateStr()->required()->message('请选择公章图片'));
  293. $f[] = Form::input('remarks', '备注')->type('textarea');
  294. return create_form('编辑', $f, Url::buildUrl('/finance/extract/order/' . $id), 'PUT');
  295. }
  296. public function update(int $id, array $data)
  297. {
  298. if (!$this->dao->update($id, $data))
  299. throw new AdminException('修改失败');
  300. else
  301. return true;
  302. }
  303. /**
  304. * 拒绝
  305. * @param $id
  306. * @return mixed
  307. */
  308. public function refuse(int $id, string $message)
  309. {
  310. $extract = $this->getExtract($id);
  311. if (!$extract) {
  312. throw new AdminException('操作记录不存在!');
  313. }
  314. if ($extract->status == 1) {
  315. throw new AdminException('已经提现,错误操作');
  316. }
  317. if ($extract->status == -1) {
  318. throw new AdminException('您的提现申请已被拒绝,请勿重复操作!');
  319. }
  320. $res = $this->changeFail($id, $extract, $message);
  321. if ($res) {
  322. return true;
  323. } else {
  324. throw new AdminException('操作失败!');
  325. }
  326. }
  327. /**
  328. * 通过
  329. * @param $id
  330. * @return mixed
  331. */
  332. public function adopt(int $id)
  333. {
  334. $extract = $this->getExtract($id);
  335. if (!$extract) {
  336. throw new AdminException('操作记录不存!');
  337. }
  338. if ($extract->status == 1 || $extract->status == 2) {
  339. throw new AdminException('您已提现,请勿重复提现!');
  340. }
  341. if ($extract->status == -1) {
  342. throw new AdminException('您的提现申请已被拒绝!');
  343. }
  344. if ($this->changeSuccess($id, $extract)) {
  345. return true;
  346. } else {
  347. throw new AdminException('操作失败!');
  348. }
  349. }
  350. /**待提现的数量
  351. * @return int
  352. */
  353. public function userExtractCount()
  354. {
  355. return $this->dao->count(['status' => 0]);
  356. }
  357. /**
  358. * 银行卡提现
  359. * @param int $uid
  360. * @return mixed
  361. */
  362. public function bank(int $uid)
  363. {
  364. /** @var UserServices $userService */
  365. $userService = app()->make(UserServices::class);
  366. $user = $userService->getUserInfo($uid);
  367. if (!$user) {
  368. throw new ValidateException('数据不存在');
  369. }
  370. /** @var UserBrokerageServices $userBrokerageServices */
  371. $userBrokerageServices = app()->make(UserBrokerageServices::class);
  372. $data['broken_commission'] = $userBrokerageServices->getUserFrozenPrice($uid);
  373. if ($data['broken_commission'] < 0)
  374. $data['broken_commission'] = '0';
  375. $data['brokerage_price'] = $user['brokerage_price'];
  376. //可提现佣金
  377. $data['commissionCount'] = bcsub((string)$data['brokerage_price'], (string)$data['broken_commission'], 2);
  378. $extractBank = sys_config('user_extract_bank') ?? []; //提现银行
  379. $extractBank = str_replace("\r\n", "\n", $extractBank);//防止不兼容
  380. $data['extractBank'] = explode("\n", is_array($extractBank) ? (isset($extractBank[0]) ? $extractBank[0] : $extractBank) : $extractBank);
  381. $data['minPrice'] = sys_config('user_extract_min_price');//提现最低金额
  382. $data['withdraw_fee'] = sys_config('withdraw_fee');//提现手续费
  383. $data['extract_wechat_type'] = sys_config('brokerage_type');//微信提现到账方式
  384. return $data;
  385. }
  386. /**
  387. * 提现申请
  388. * @param int $uid
  389. * @param array $data
  390. */
  391. public function cash(int $uid, array $data)
  392. {
  393. /** @var UserServices $userService */
  394. $userService = app()->make(UserServices::class);
  395. $user = $userService->getUserInfo($uid);
  396. if (!$user) {
  397. throw new ValidateException('数据不存在');
  398. }
  399. if (UserExtract::where('uid', $user['uid'])
  400. ->whereTime('add_time', 'month')
  401. ->where('status', 0)->find()) {
  402. throw new ValidateException('请等待上次提现申请通过');
  403. }
  404. // if (!$user['enterprise_professional_facilitator_id']) {
  405. // throw new ValidateException('签约未完成');
  406. // }
  407. // $bank_info = WithdrawService::init()::contractInfo($user['enterprise_professional_facilitator_id']);
  408. // if (!$bank_info['sign_img']) {
  409. // throw new ValidateException('签约未完成');
  410. // }
  411. // $data['cardnum'] = $bank_info['bank_code'];
  412. // $data['bankname'] = '灵活用工提现';
  413. /** @var UserBrokerageServices $userBrokerageServices */
  414. $userBrokerageServices = app()->make(UserBrokerageServices::class);
  415. $data['broken_commission'] = $userBrokerageServices->getUserFrozenPrice($uid);
  416. if ($data['broken_commission'] < 0)
  417. $data['broken_commission'] = 0;
  418. $data['brokerage_price'] = $user['brokerage_price'];
  419. //可提现佣金
  420. $commissionCount = (float)bcsub((string)$data['brokerage_price'], (string)$data['broken_commission'], 2);
  421. if ($data['money'] > $commissionCount) {
  422. throw new ValidateException('可提现佣金不足');
  423. }
  424. $extractPrice = $user['brokerage_price'];
  425. $userExtractMinPrice = sys_config('user_extract_min_price');
  426. if ($data['money'] < $userExtractMinPrice) {
  427. throw new ValidateException('提现金额不能小于' . $userExtractMinPrice . '元');
  428. }
  429. if ($extractPrice < 0) {
  430. throw new ValidateException('提现佣金不足' . $data['money']);
  431. }
  432. if ($data['money'] > $extractPrice) {
  433. throw new ValidateException('提现佣金不足' . $data['money']);
  434. }
  435. if ($data['money'] <= 0) {
  436. throw new ValidateException('提现佣金大于0');
  437. }
  438. $fee = sys_data('withdraw_fee');
  439. $fees = [];
  440. foreach ($fee as $v) {
  441. $fees[$v['month_number']] = (string)$v['fee'];
  442. }
  443. krsort($fees, SORT_DESC);
  444. $sum_money = UserExtract::where('uid', $user['uid'])
  445. ->whereTime('add_time', 'month')
  446. ->where('extract_type', '<>', 'balance')
  447. ->where('status', 1)->sum('extract_price');
  448. $money = $data['money'];
  449. $extract_fee = 0;
  450. $max = PHP_INT_MAX;
  451. foreach ($fees as $k => $v) {
  452. if ($sum_money > $max) {
  453. break;
  454. }
  455. $max = $k;
  456. if ($sum_money + $money > $k) {
  457. $extract_fee = bcadd($extract_fee, bcmul((string)($sum_money + $money - ($sum_money > $k ? $sum_money : $k)), bcdiv($v, '100', 4), 2));
  458. $money = $money - ($sum_money + $money - $k);
  459. }
  460. }
  461. $insertData = [
  462. 'uid' => $user['uid'],
  463. 'extract_type' => $data['extract_type'],
  464. 'extract_price' => bcsub((string)$data['money'], (string)$extract_fee, 2),
  465. 'extract_fee' => $extract_fee,
  466. 'add_time' => time(),
  467. 'balance' => $user['brokerage_price'],
  468. 'image' => $data['image'],
  469. 'status' => 0
  470. ];
  471. if (isset($data['name']) && strlen(trim($data['name']))) $insertData['real_name'] = $data['name'];
  472. else $insertData['real_name'] = $user['nickname'];
  473. if (isset($data['cardnum'])) $insertData['bank_code'] = $data['cardnum'];
  474. else $insertData['bank_code'] = '';
  475. if (isset($data['bankname'])) $insertData['bank_address'] = $data['bankname'];
  476. else $insertData['bank_address'] = '';
  477. if (isset($data['weixin'])) $insertData['wechat'] = $data['weixin'];
  478. else $insertData['wechat'] = $user['nickname'];
  479. if ($data['extract_type'] == 'alipay') {
  480. $insertData['alipay_code'] = $data['alipay_code'];
  481. $insertData['qrcode_url'] = $data['qrcode_url'];
  482. $mark = '使用支付宝';
  483. } else if ($data['extract_type'] == 'bank') {
  484. $mark = '使用银联卡' . $insertData['bank_code'];
  485. } else if ($data['extract_type'] == 'weixin') {
  486. $insertData['qrcode_url'] = $data['qrcode_url'];
  487. $mark = '使用微信提现';
  488. /** @var WechatUserServices $wechatServices */
  489. $wechatServices = app()->make(WechatUserServices::class);
  490. $openid = $wechatServices->getWechatOpenid($uid, 'wechat');
  491. if (sys_config('brokerage_type', 0) && $openid) {
  492. if ($insertData['extract_price'] < 1) {
  493. throw new ValidateException('扣除手续费后,提现金额不足1元;而企业微信付款到零钱最低金额为1元');
  494. }
  495. }
  496. }
  497. /** @var UserBrokerageServices $userBrokerageServices */
  498. $userBrokerageServices = app()->make(UserBrokerageServices::class);
  499. $res1 = $this->transaction(function () use ($insertData, $data, $uid, $userService, $user, $userBrokerageServices, $mark) {
  500. if (!$res1 = $this->dao->save($insertData)) {
  501. throw new ValidateException('提现失败');
  502. }
  503. //修改用户佣金
  504. $balance = bcsub((string)$user['brokerage_price'], (string)$data['money'], 2) ?? 0;
  505. if (!$userService->update($uid, ['brokerage_price' => $balance], 'uid')) {
  506. throw new ValidateException('修改用户信息失败');
  507. }
  508. //保存佣金记录
  509. $userBrokerageServices->income('extract', $uid, ['mark' => $mark, 'number' => $data['money']], $balance, $res1['id']);
  510. return $res1;
  511. });
  512. //用户申请体现事件
  513. event('user.extract', [$user, $data, $res1]);
  514. return true;
  515. }
  516. /**
  517. * @param array $where
  518. * @param string $SumField
  519. * @param string $selectType
  520. * @param string $group
  521. * @return float|mixed
  522. */
  523. public function getOutMoneyByWhere(array $where, string $SumField, string $selectType, string $group = "")
  524. {
  525. switch ($selectType) {
  526. case "sum" :
  527. return $this->dao->getWhereSumField($where, $SumField);
  528. case "group" :
  529. return $this->dao->getGroupField($where, $SumField, $group);
  530. }
  531. }
  532. }