|
@@ -13,6 +13,7 @@ declare (strict_types=1);
|
|
|
namespace app\services\user;
|
|
|
|
|
|
use app\jobs\system\CapitalFlowJob;
|
|
|
+use app\model\user\User;
|
|
|
use app\model\user\UserExtract;
|
|
|
use app\services\BaseServices;
|
|
|
use app\dao\user\UserExtractDao;
|
|
@@ -290,6 +291,67 @@ class UserExtractServices extends BaseServices
|
|
|
return $list;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 显示资源列表
|
|
|
+ * @return array
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function getExportInfoList($start, $end)
|
|
|
+ {
|
|
|
+ $uids = UserExtract::whereBetween('add_time', [$start, $end])->where('extract_type', '<>', 'balance')->where('user_type', 0)->where('status', 1)->column('uid');
|
|
|
+ $idcards = User::where('uid', 'in', $uids)->where('is_auth', 2)->column('card_id,real_name', 'card_id');
|
|
|
+ $list = [];
|
|
|
+ foreach ($idcards as $v) {
|
|
|
+ $uids = User::where('card_id', $v['card_id'])->where('is_auth', 2)->column('uid');
|
|
|
+ $sum_money = UserExtract::where('uid', 'in', $uids)
|
|
|
+ ->whereBetween('add_time', [$start, $end])
|
|
|
+ ->where('extract_type', '<>', 'balance')
|
|
|
+ ->where('user_type', 0)
|
|
|
+ ->where('status', 1)
|
|
|
+ ->sum('extract_price');
|
|
|
+ $fee = sys_data('withdraw_fee');
|
|
|
+ $max_range = 0;
|
|
|
+ $range = [];
|
|
|
+ foreach ($fee as $vv) {
|
|
|
+ if ($sum_money > $vv['month_number']) {
|
|
|
+ if ($max_range < $vv['month_number']) {
|
|
|
+ $range = $vv;
|
|
|
+ $max_range = $vv['month_number'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($range != []) {
|
|
|
+ if ($range['free_type'] == 1) {
|
|
|
+ $free = bcdiv(bcmul((string)$sum_money, (string)$range['free']), '100', 2);
|
|
|
+ } else {
|
|
|
+ $free = $range;
|
|
|
+ }
|
|
|
+ $the_fee = bcdiv(bcmul(bcsub((string)$sum_money, (string)$free, 2), (string)$range['fee']), '100', 2);
|
|
|
+ $the_fee = bcsub((string)$the_fee, (string)$range['dec'], 2);
|
|
|
+ }
|
|
|
+ $row['xingming'] = $v['card_id'];
|
|
|
+ $row['zhengjianhaoma'] = $v['real_name'];
|
|
|
+ $row['suodexiangmu'] = '一般劳务报酬所得';
|
|
|
+ $row['shouru'] = $sum_money;
|
|
|
+ $row['feiyong'] = $free ?? 0;
|
|
|
+ $row['mianshuishouru'] = 0;
|
|
|
+ $row['kouchuxiangmuheji'] = 0;
|
|
|
+ $row['yingnashuisuodee'] = bcsub((string)$sum_money, (string)($free ?? 0), 2);
|
|
|
+ $row['shuilv'] = $range['fee'];
|
|
|
+ $row['susuankouchushu'] = $range['dec'];
|
|
|
+ $row['yingnashuie'] = $the_fee ?? 0;
|
|
|
+ $row['jianmianshuie'] = 0;
|
|
|
+ $row['yingkoujiaoshuie'] = $the_fee ?? 0;
|
|
|
+ $row['yijiaoshuie'] = 0;
|
|
|
+ $row['yingbushuie'] = $the_fee ?? 0;
|
|
|
+ $list[] = $row;
|
|
|
+ }
|
|
|
+ return $list;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 显示编辑资源表单页.
|
|
|
*
|
|
@@ -487,10 +549,12 @@ class UserExtractServices extends BaseServices
|
|
|
krsort($fees, SORT_DESC);
|
|
|
$sum_money = UserExtract::where('uid', 'in', $uids)
|
|
|
->whereTime('add_time', 'month')
|
|
|
+ ->where('user_type', 0)
|
|
|
->where('extract_type', '<>', 'balance')
|
|
|
->where('status', 1)->sum('extract_price');
|
|
|
$sum_fee = UserExtract::where('uid', 'in', $uids)
|
|
|
->whereTime('add_time', 'month')
|
|
|
+ ->where('user_type', 0)
|
|
|
->where('extract_type', '<>', 'balance')
|
|
|
->where('status', 1)->sum('extract_fee');
|
|
|
$money = $data['money'];
|
|
@@ -514,6 +578,7 @@ class UserExtractServices extends BaseServices
|
|
|
$free = $range;
|
|
|
}
|
|
|
$the_fee = bcdiv(bcmul(bcsub((string)$money_sum, (string)$free, 2), (string)$range['fee']), '100', 2);
|
|
|
+ $the_fee = bcsub((string)$the_fee, (string)$range['dec'], 2);
|
|
|
$extract_fee = bcsub((string)$the_fee, (string)$sum_fee, 2);
|
|
|
}
|
|
|
}
|