Merge pull request 'feature/company_warning' (#606) from feature/company_warning into master

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/606
master
廖金灵 3 years ago
commit 57246f5e3f

@ -14,6 +14,7 @@ use Base\Task\Task;
use Base\Service\MarketService; use Base\Service\MarketService;
use Base\Tool\AggregateClient; use Base\Tool\AggregateClient;
use Base\Repository\GameRepository; use Base\Repository\GameRepository;
use Base\Service\PromoteCompanyService;
use Base\Tool\Redis; use Base\Tool\Redis;
use Think\Model; use Think\Model;
@ -861,4 +862,33 @@ class ConsoleController extends Think {
} }
return $hash; return $hash;
} }
public function generateCompanyMonthlyData($month = '')
{
$service = new PromoteCompanyService();
$service->generateCompanyMonthlyData($month);
}
public function generateCompanyMontlyDatahDaily()
{
$d = date('j');
$month = date('Y-m');
if ($d <= 7) {
$lastMonth = date('Y-m', strtotime("$month -1 month"));
$service = new PromoteCompanyService();
$service->generateCompanyMonthlyData($lastMonth);
}
$service->generateCompanyMonthlyData($month);
}
public function initCompanyMontlyIsWarning()
{
$month = '2019-09';
$lastMonth = '2021-12';
do {
$service = new PromoteCompanyService();
$service->setCompanyMontlyIsWarning($month);
$month = date('Y-m', strtotime("$month +1 month"));
} while ($month <= $lastMonth);
}
} }

@ -0,0 +1,230 @@
<?php
namespace Admin\Controller;
use Base\Service\PromoteCompanyService;
class PromoteCompanyWarningController extends ThinkController
{
private $modelName = 'PromoteCompanyWarning';
public function _initialize()
{
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
parent::_initialize();
}
public function monthly()
{
$this->search('monthly');
}
public function total()
{
$this->search('total');
}
public function search($type)
{
$month = I('month', '');
$companyId = I('company_id', 0);
$isExport = I('is_export', 0);
$isSignContact = I('is_sign_contact', -1);
$where = [
'_string' => '1=1 and b.company_id is not null',
'c.company_belong' => ['in', [1, 2]],
];
if ($type == 'monthly') {
$where['b.is_warning'] = 1;
}
if ($companyId != 0) {
$where['b.company_id'] = $companyId;
}
if ($isSignContact != -1) {
$where['c.is_sign_contact'] = $isSignContact;
}
if ($month != '') {
$monthNumber = date('Ym', strtotime($month.'-01'));
$where['b.month'] = $monthNumber;
}
$joinDataTable = 'tab_company_monthly_data';
$columns = ['b.company_id', 'c.company_name', 'c.is_sign_contact', 'b.pay_amount'];
$orderBy = 'b.company_id asc';
if ($type == 'total') {
$subSql = M('company_monthly_data', 'tab_')->field('company_id')->where(['is_warning' => 1])->select(false);
$warningAmount = C('PRO_COM_TOTAL_AMOUNT', null, 100000);
$tmpTable = M('company_monthly_data', 'tab_')
->field(['company_id', 'sum(pay_amount) pay_amount'])
->where(['_string' => 'company_id not in(' . $subSql . ')'])
->group('company_id')
->having('pay_amount >= ' . $warningAmount)
->select(false);
$joinDataTable = '(' . $tmpTable . ')';
} else {
$columns[] = 'b.month';
$orderBy = 'b.month desc, b.company_id asc';
}
$query = M('promote_company', 'tab_')->alias('c')
->field($columns)
->join('left join ' . $joinDataTable . ' b on b.company_id=c.id')
->where($where)
->order($orderBy);
$items = [];
$page = '';
if ($isExport) {
$items = $query->select();
} else {
[$items, $page, $count] = $this->paginate($query);
}
$companyPromotes = [];
$admins = [];
$adminDepartments = [];
if (count($items) > 0) {
$companyIds = array_column($items, 'company_id');
$promotes = M('promote', 'tab_')->field(['id', 'account', 'admin_id', 'company_id'])->where(['company_id' => ['in', $companyIds], 'level' => 1])->select();
$adminIds = array_column($promotes, 'admin_id');
$admins = M('member', 'sys_')->field(['uid', 'real_name'])->where(['uid' => ['in', $adminIds]])->select();
$adminDepartments = getAdminDepartmentList($adminIds);
$admins = index_by_column('uid', $admins);
foreach ($promotes as $promote) {
$companyPromotes[$promote['company_id']][] = $promote;
}
}
$records = [];
foreach ($items as $key => $item) {
$item['month'] = date('Y-m', strtotime($item['month'].'01'));
$item['is_sign_contact_text'] = $item['is_sign_contact'] == 1 ? '是' : '否';
$itemPromotes = $companyPromotes[$item['company_id']];
$promoteCount = count($itemPromotes);
$index = 0;
foreach ($itemPromotes as $promote) {
if ($index == 0) {
$item['rowspan'] = $promoteCount;
} else {
$item['rowspan'] = 0;
}
$item['market_department_name'] = $adminDepartments[$promote['admin_id']] ?? '无';
$admin = $admins[$promote['admin_id']] ?? null;
$item['market_user_name'] = $admin ? $admin['real_name'] : '无';
$item['account'] = $promote['account'];
$index ++;
$records[] = $item;
}
}
$records = [];
foreach ($items as $key => $item) {
if (isset($item['month'])) {
$item['month'] = date('Y-m', strtotime($item['month'].'01'));
}
$item['is_sign_contact_text'] = $item['is_sign_contact'] == 1 ? '是' : '否';
$itemPromotes = $companyPromotes[$item['company_id']];
$promoteCount = count($itemPromotes);
$index = 0;
foreach ($itemPromotes as $promote) {
if ($index == 0) {
$item['rowspan'] = $promoteCount;
} else {
$item['rowspan'] = 0;
}
$item['market_department_name'] = $adminDepartments[$promote['admin_id']] ?? '无';
$admin = $admins[$promote['admin_id']] ?? null;
$item['market_user_name'] = $admin ? $admin['real_name'] : '无';
$item['account'] = $promote['account'];
$index ++;
$records[] = $item;
}
}
$pageTypeNames = [
'monthly' => '合同签订当月流水预警',
'total' => '合同签订累计流水预警',
];
$pageTypeName = $pageTypeNames[$type];
$this->assign('records', $records);
$this->assign('pageType', $type);
$this->assign('pageTypeName', $pageTypeName);
if($isExport){
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出推广公司','url'=>U('PromoteCompany/lists'),'menu'=>'推广员-公司档案管理-' . $pageTypeName]);
$this->display("export");
return;
}
if($page) {
$this->assign('_page', $page);
}
$totalWarningAmount = C('PRO_COM_TOTAL_AMOUNT', null, 100000);
$monthlyWarningAmount = C('PRO_COM_MONTHLY_AMOUNT', null, 50000);
$this->assign('totalWarningAmount', $totalWarningAmount);
$this->assign('monthlyWarningAmount', $monthlyWarningAmount);
$companies = M('promote_company', 'tab_')->field(['company_name', 'id'])->where(['company_belong' => ['in', [1, 2]]])->select();
$this->assign('companies', $companies);
$this->display('records');
}
public function saveSetting()
{
$monthlyAmount = I('monthly_amount', 0);
$totalAmount = I('total_amount', 0);
$beforeTotalAmount = C('PRO_COM_TOTAL_AMOUNT');
$beforeMonthlyAmount = C('PRO_COM_MONTHLY_AMOUNT');
if (!is_numeric($monthlyAmount)) {
$this->ajaxReturn([
'status' => 0,
'message' => '月达标金额格式错误'
]);
}
if (!is_numeric($totalAmount)) {
$this->ajaxReturn([
'status' => 0,
'message' => '累计达标金额格式错误'
]);
}
if ($monthlyAmount < 0) {
$this->ajaxReturn([
'status' => 0,
'message' => '月达标金额需大于0'
]);
}
if ($totalAmount < 0) {
$this->ajaxReturn([
'status' => 0,
'message' => '累计达标金额需大于0'
]);
}
if ($monthlyAmount != $beforeMonthlyAmount) {
M('config', 'sys_')->where(['name' => 'PRO_COM_MONTHLY_AMOUNT'])->save(['value' => $monthlyAmount]);
S('DB_CONFIG_DATA', null);
$service = new PromoteCompanyService();
$month = date('Y-m');
$service->setCompanyMontlyIsWarning($month);
}
if ($totalAmount != $beforeTotalAmount) {
M('config', 'sys_')->where(['name' => 'PRO_COM_TOTAL_AMOUNT'])->save(['value' => $totalAmount]);
S('DB_CONFIG_DATA', null);
}
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'
]);
}
}

@ -0,0 +1,102 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>游戏登陆列表|----软件管理平台</title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/module.css">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script src="__STATIC__/table2excel.js"></script>
</head>
<style>
html {
min-width: 100%;
}
body {
padding: 0px;
}
</style>
<body>
<div style="margin:auto;font-size: 16px;color: red;line-height: 3;padding: 20px;">
导出进行中。。。<br />
如果导出成功你也可以手动关闭此页面
</div>
<table border="1" id="exporttable" style="opacity: 0;">
<!-- 表头 -->
<thead>
<tr>
<th>合作方名称</th>
<th>流水金额</th>
<?php if ($pageType=='monthly'):?>
<th>达标月份</th>
<?php endif;?>
<th>会长账号</th>
<th>市场专员</th>
<th>所属市场部</th>
<th>是否签约</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="records">
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="records" id="data">
<tr data-id="<?=$data['id']?>" <?php if($data['rowspan'] > 0):?>class="new_row"<?php endif;?>>
<?php if($data['rowspan']>0):?>
<td rowspan="{$data.rowspan}">{$data.company_name}</td>
<td rowspan="{$data.rowspan}">{$data.pay_amount}</td>
<?php if ($pageType=='monthly'):?>
<td rowspan="{$data.rowspan}">{$data.month}</td>
<?php endif;?>
<?php endif;?>
<td>{$data.account}</td>
<td>{$data.market_user_name}</td>
<td>{$data.market_department_name}</td>
<?php if($data['rowspan']>0):?>
<td rowspan="{$data.rowspan}">{$data.is_sign_contact_text}</td>
<?php endif;?>
</tr>
</volist>
</empty>
</tbody>
</table>
<script>
$(function () {
$("#exporttable").table2excel({
filename: "<?=$pageTypeName?>.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
//搜索功能
$("#search").click(function () {
console.log(222);
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.parent.reloadIframe(url);
parent.document.getElementsByTagName('iframe').src = url;
});
});
</script>
</body>
</html>

@ -0,0 +1,314 @@
<extend name="Public/base"/>
<block name="css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
<script src="__STATIC__/laydate/laydate.js"></script>
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.textarea-style {
width: 200px;
height: 80px;
border-radius: 5px;
padding: 5px;
}
.mustmark {
color: #FF0000;
font-style: normal;
margin: 0 3px;
}
.butnbox {
padding: 10px 0 10px;
}
.butnbox .butnlist .butn {
display: inline-block;
width: 120px;
height: 28px;
line-height: 28px;
text-align: center;
color: #FFF;
background: #3C95C8;
border-radius: 3px;
cursor: pointer;
}
.data_list table td .status-0 {
color: #e6a23c;
}
.data_list table td .status-1 {
color: #67c23a;
}
.data_list table td .status-2 {
color: #f56c6c;
}
.select2-container--open {
z-index: 1001;
}
.data_list table.specail-table tbody tr:nth-child(even) {
background: #fff;
}
.data_list table.specail-table tbody tr:hover {
background: #e5ebee;
}
.data_list table.specail-table tbody tr.new_row {
border-top: 1px solid #ebeef5;
border-bottom: 1px solid #ebeef5;
}
</style>
</block>
<block name="body">
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$pageTypeName}</h3>
</div>
<div class="cf top_nav_list" style="height: 38px; margin-bottom: 10px;">
<!-- 高级搜索 -->
<div class="jssearch cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select name="company_id" class="select_gallery" style="width:200px;">
<option value="0">推广公司</option>
<?php foreach($companies as $company):?>
<option value="<?=$company['id']?>"><?=$company['company_name']?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select name="is_sign_contact" class="select_gallery" style="width:120px;">
<option value="-1">是否签约</option>
<option value="0"></option>
<option value="1"></option>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PromoteCompanyWarning/' . $pageType)}">搜索</a>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="downloadexcel" url="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['is_export'=>1],I('get.')))}">导出excel</a>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="setting-add-btn">设置</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table class="specail-table">
<!-- 表头 -->
<thead>
<tr>
<th>合作方名称</th>
<th>流水金额</th>
<?php if ($pageType=='monthly'):?>
<th>达标月份</th>
<?php endif;?>
<th>会长账号</th>
<th>市场专员</th>
<th>所属市场部</th>
<th>是否签约</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name="records">
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="records" id="data">
<tr data-id="<?=$data['id']?>" <?php if($data['rowspan'] > 0):?>class="new_row"<?php endif;?>>
<?php if($data['rowspan']>0):?>
<td rowspan="{$data.rowspan}">{$data.company_name}</td>
<td rowspan="{$data.rowspan}">{$data.pay_amount}</td>
<?php if ($pageType=='monthly'):?>
<td rowspan="{$data.rowspan}">{$data.month}</td>
<?php endif;?>
<?php endif;?>
<td>{$data.account}</td>
<td>{$data.market_user_name}</td>
<td>{$data.market_department_name}</td>
<?php if($data['rowspan']>0):?>
<td rowspan="{$data.rowspan}">{$data.is_sign_contact_text}</td>
<?php endif;?>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
<!-- <a class="sch-btn export-btn"
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a> -->
{$_page|default=''}
</div>
<div id="setting-box" class="layer-box" style="display: none;">
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="">
<div class="form-group">
<label>当月流水达</label>
<div class="form-item" style="width:200px">
<input type="text" class="form-input" name="monthly_amount" style="width:115px" value="<?=$monthlyWarningAmount?>" placeholder="请输入金额">&nbsp;&nbsp;万元
</div>
</div>
<div class="form-group">
<label>累计流水达</label>
<div class="form-item" style="width:200px">
<input type="text" class="form-input" name="total_amount" style="width:115px" value="<?=$totalWarningAmount?>" placeholder="请输入金额">&nbsp;&nbsp;万元
</div>
</div>
<div class="form-group">
<label></label>
<a id="save-setting-submit" href="javascript:;" class="add-submit btn">保存</a>
</div>
</form>
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Query/withdraw">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('PromoteCompanyWarning/' . $pageType)}");
$(function(){
// 添加全部选项
var awardType = "{$awardType}"
if ('all' == "{:I('row', 0)}") {
$("#pagechange").prepend("<option value='all' selected>全部</option>");
} else {
$("#pagechange").prepend("<option value='all'>全部</option>");
}
$('.time-select').each(function(){
laydate.render({
elem: this,
type: 'date'
});
});
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
//query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
$('#setting-add-btn').click(function () {
var box = $('#setting-box')
layer.open({
title: '预警设置',
type: 1,
content: box,
area: ['500px', '300px'],
zIndex: 250,
})
$(".select_gallery").select2();
});
$('#save-setting-submit').on({
click: function () {
var box = $('#setting-box')
var data = {}
data.monthly_amount = box.find('[name=monthly_amount]').val()
data.total_amount = box.find('[name=total_amount]').val()
saveSetting(data)
}
})
function saveSetting(data) {
$.ajax({
url: "{:U('saveSetting')}",
type: "post",
data: data,
dataType: 'json',
success: function (result ) {
if (result.status == 1) {
layer.msg(result.message, function(){
window.location.href = window.location.href
})
} else {
layer.msg(result.message)
}
}
})
}
});
$("#downloadexcel").on("click",function(){
var url = $(this).attr("url");
var title = '<?=$pageTypeName?>导出,请耐心等待数据处理....';
var index = layer.load(2);
layer.open({
type: 2,
title: title,
shadeClose: false,
shade: 0.8,
area: ['40%', '30%'],
content: url,
success:function(){
layer.closeAll();
}
});
})
</script>
</block>

@ -321,4 +321,66 @@ class PromoteCompanyService
addOperationLog(['op_type'=>1, 'key'=> $application['id'], "op_name"=>"市场部审核", 'url'=>U('index')]); addOperationLog(['op_type'=>1, 'key'=> $application['id'], "op_name"=>"市场部审核", 'url'=>U('index')]);
return $application; return $application;
} }
public function statCompanyMonthlyAmount($month = null)
{
$conditions = ['pay_status' => 1];
if ($month) {
$firstDay = $month . '-01';
$lastDay = date('Y-m-d', strtotime("$month +1 month -1 day"));
$conditions['pay_time'] = ['between', [strtotime($firstDay . ' 00:00:00'), strtotime($lastDay . ' 23:59:59')]];
}
return M('spend', 'tab_')
->field(['IFNULL(company_id, 0) company_id', 'sum(pay_amount) pay_amount', 'FROM_UNIXTIME(pay_time, "%Y%m") month'])
->join('left join tab_promote on tab_spend.promote_id=tab_promote.id')
->where($conditions)
->group('company_id, month')
->order('month asc, company_id asc')
->select();
}
public function generateCompanyMonthlyData($month = null)
{
$records = $this->statCompanyMonthlyAmount($month);
if ($month) {
$monthNumber = date('Ym', strtotime($month.'-01'));
$monthData = M('company_monthly_data', 'tab_')->field(['concat(month, "_", company_id) unique_key'])->where(['month' => $monthNumber])->select();
if (count($monthData) > 0) {
$monthRows = [];
foreach ($monthData as $item) {
$monthRows[$item['unique_key']] = true;
}
foreach ($records as $index => $item) {
$uniqueKey = $item['month'] . '_' . $item['company_id'];
if (isset($monthRows[$uniqueKey])) {
unset($records[$index]);
M('company_monthly_data', 'tab_')->where(['month' => $item['month'], 'company_id' => $item['company_id']])->save($item);
}
}
$records = array_values($records);
}
}
if (count($records) > 0) {
M('company_monthly_data', 'tab_')->addAll($records);
}
}
public function setCompanyMontlyIsWarning($month)
{
$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