|
@@ -16,6 +16,7 @@ use app\jobs\order\ShareOrderJob;
|
|
|
use app\jobs\supplier\SupplierFinanceJob;
|
|
use app\jobs\supplier\SupplierFinanceJob;
|
|
|
use app\listener\order\Pay;
|
|
use app\listener\order\Pay;
|
|
|
use app\model\order\StoreOrder;
|
|
use app\model\order\StoreOrder;
|
|
|
|
|
+use app\model\user\UserExtract;
|
|
|
use app\model\user\UserIntegral;
|
|
use app\model\user\UserIntegral;
|
|
|
use app\model\user\User;
|
|
use app\model\user\User;
|
|
|
use app\services\activity\combination\StorePinkServices;
|
|
use app\services\activity\combination\StorePinkServices;
|
|
@@ -74,6 +75,46 @@ class PublicController extends BaseController
|
|
|
// foreach ($orders as $v) {
|
|
// foreach ($orders as $v) {
|
|
|
// SupplierFinanceJob::dispatch([$v['id'], 1]);
|
|
// SupplierFinanceJob::dispatch([$v['id'], 1]);
|
|
|
// }
|
|
// }
|
|
|
|
|
+ $list = UserExtract::where('uid', 'in', ['60', '72'])->order('id', 'asc')->select();
|
|
|
|
|
+ foreach ($list as $v) {
|
|
|
|
|
+ if ($v['id'] == 183) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $sum_money = UserExtract::where('uid', 'in', ['60', '72'])
|
|
|
|
|
+ ->whereTime('add_time', 'month')
|
|
|
|
|
+ ->where('user_type', 0)
|
|
|
|
|
+ ->where('extract_type', '<>', 'balance')
|
|
|
|
|
+ ->where('status', 1)->where('id', '<', $v['id'])->sum('extract_price');
|
|
|
|
|
+ $sum_fee = UserExtract::where('uid', 'in', ['60', '72'])
|
|
|
|
|
+ ->whereTime('add_time', 'month')
|
|
|
|
|
+ ->where('user_type', 0)
|
|
|
|
|
+ ->where('extract_type', '<>', 'balance')
|
|
|
|
|
+ ->where('status', 1)->where('id', '<', $v['id'])->sum('extract_fee');
|
|
|
|
|
+ $money_sum = bcadd(bcadd((string)$sum_money, (string)$sum_fee, 2), bcadd((string)$v['extract_price'], (string)$v['extract_fee'], 2), 2);
|
|
|
|
|
+ $max_range = 0;
|
|
|
|
|
+ $range = [];
|
|
|
|
|
+ $fee = sys_data('withdraw_fee');
|
|
|
|
|
+ foreach ($fee as $vv) {
|
|
|
|
|
+ if ($money_sum > $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)$money_sum, (string)$range['free']), '100', 2);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $free = $range['free'];
|
|
|
|
|
+ }
|
|
|
|
|
+ $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);
|
|
|
|
|
+ UserExtract::where('id', $v['id'])
|
|
|
|
|
+ ->update(['extract_fee' => $extract_fee, 'extract_price' => bcsub(bcadd((string)$v['extract_price'], (string)$v['extract_fee'], 2), $extract_fee, 2)]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function dealOrderIntegral($order)
|
|
public function dealOrderIntegral($order)
|