diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 656cd78a7..12e050ae8 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -101,14 +101,13 @@ unset($_REQUEST['parent_id']); } // $promote = D(self::model_name)->field('id,account')->where(['oa_associated' => 0])->order('id DESC')->select(); //只获取之前未关联 - $promote = D(self::model_name)->field('id,account')->order('id DESC')->select(); //全部重新获取 + $promote = D(self::model_name)->field('id,account,oa_associated')->order('id DESC')->select(); //全部重新获取 $oa_data = array_column($oa_data, 'platform_account'); foreach($promote as $k => $v) { $v['account'] = trim($v['account']); - if(in_array($v['account'], $oa_data)) { - M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => 1]); - } else { - M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => 0]); + $oa_val = (in_array($v['account'], $oa_data)) ? 1: 0; + if($v['oa_associated'] != $oa_val){ + M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $oa_val]); } } @@ -135,11 +134,12 @@ unset($_REQUEST['parent_id']); $re_data = json_decode($re_data,true)['data']; foreach($list_data as $k => $v) { - if(array_key_exists($v['account'], $re_data)) - { - $list_data[$k]['oa_associated'] = $re_data[$v['account']]; - M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]); + $oa_val = $re_data[trim($v['account'])]; + if($v['oa_associated'] != $oa_val){ + $list_data[$k]['oa_associated'] = $oa_val; + M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $oa_val]); } + } } } diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 43de91eaa..66598be29 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -831,9 +831,6 @@ class DownloadController extends BaseController { * @author sunke */ public function regist_data_export() { - if (empty(I('begtime')) || empty(I('endtime'))) { - $this->error('请选择起止时间'); - } $beginTime = strtotime(I('begtime') . ' 00:00:00'); $endtime = strtotime(I('endtime') . ' 23:59:59'); if (($endtime - $beginTime) > 31 * 24 * 3600) {