Commit 4ec7ebb2 by 朱继来

调整用户金额脚本

parent db9b67c6
......@@ -47,15 +47,17 @@ class CronController extends Controller
$self_accounts = $this->filterFake($self_accounts_list); // 过滤数据
$self_accounts_amount = $this->countByCurrency($self_accounts, 'checkout_paid_amount'); // 统计金额
$resp = [];
// 合并用户
$resp = $this->mergeUser($pay_log_amount, $joint_offline_amount);
$resp = $this->mergeUser($resp, $self_accounts_amount);
// 保存用户金额数据
if (!empty($resp)) {
$cur_rate = $this->getRate();
foreach ($resp as $k=>$v) {
$data = [];
......@@ -67,7 +69,7 @@ class CronController extends Controller
$data['rmb_amount'] = isset($v['rmb']) ? $v['rmb'] : 0;
$data['usd_amount'] = isset($v['usd']) ? $v['usd'] : 0;
$data['cur_rate'] = $this->getRate();
$data['cur_rate'] = $cur_rate;
$data['amount'] = $data['rmb_amount'] + $data['usd_amount'] * $data['cur_rate'];
$res = $UserAmountModel->updateOrCreate(['user_id' => $k], $data);
......
......@@ -21,6 +21,7 @@ class PayLogModel extends Model
->leftJoin('lie_order as o', 'p.order_id', '=', 'o.order_id')
->where('p.is_paid', 1)
->whereBetween('p.pay_time', [$start_time, $end_time])
->where('o.status', '>', 2)
->where('o.is_type', 0)
->select($field)
// ->select('user_id', DB::raw('sum(pay_amount) as pay_amount'))
......
......@@ -89,8 +89,8 @@
// 猎芯活动用户金额统计时间
'lx_activity_time' => [
'start_time' => '2018-10-1',
'end_time' => '2018-10-31 23:59:59',
'start_time' => '2019-7-24',
'end_time' => '2019-10-31 23:59:59',
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment