master
elf 3 years ago
parent 2c4fac54ad
commit 1b90124f81

@ -227,25 +227,4 @@ class PromoteCompanyWarningController extends ThinkController
'message' => '操作成功'
]);
}
public function setCompanyMontlyIsWarning($month = '')
{
if (!$month) {
$month = date('Y-m');
}
$monthNumber = date('Ym', strtotime($month.'-01'));
$conditions = ['_string' => '1=1'];
$conditions['month'] = $monthNumber;
$conditions['pay_amount'] = ['egt', C('PRO_COM_MONTHLY_AMOUNT', null, 50000)];
$subSql = M('company_monthly_data', 'tab_')->field('company_id')->where(['month' => ['lt', $monthNumber], 'is_warning' => 1])->select(false);
$conditions['_string'] .= ' and company_id not in(' . $subSql . ')';
M('company_monthly_data', 'tab_')->where(['month' => $monthNumber])->save(['is_warning' => 0]);
$rows = M('company_monthly_data', 'tab_')->field(['id'])->where($conditions)->select();
if (count($rows) > 0) {
M('company_monthly_data', 'tab_')->where(['id' => ['in', array_column($rows, 'id')]])->save(['is_warning' => 1]);
}
}
}

Loading…
Cancel
Save