From e9e66fa8a0388a732d6cda743360daf6aa6ccaaa Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Tue, 26 Nov 2019 09:53:58 +0800 Subject: [PATCH] =?UTF-8?q?oa=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 091cec58a..af1f3e999 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -106,32 +106,34 @@ unset($_REQUEST['parent_id']); } $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p,$row)->select(); $oa_data = []; - foreach($list_data as $k => $v) - { - if($v['oa_associated'] != 1) { - $oa_data[] = $v['account']; - } - } - if(!empty($oa_data)) - { - $arr['time'] = time(); - $arr['account'] = implode(",", $oa_data); - ksort($arr); - reset($arr); - $sign = md5(http_build_query($arr) . 'wmkjtx_kj213'); - $arr['sign'] = $sign; - $re_data = curl_post('http://oa.76ba.com/api/wanmeng/verifyBind',$arr); - $re_data = json_decode($re_data,true)['data']; + if(I('oa_associated',-1) == -1) { foreach($list_data as $k => $v) { - if(array_key_exists($v['account'], $re_data)) + if($v['oa_associated'] != 1) { + $oa_data[] = $v['account']; + } + } + if(!empty($oa_data)) + { + $arr['time'] = time(); + $arr['account'] = implode(",", $oa_data); + ksort($arr); + reset($arr); + $sign = md5(http_build_query($arr) . 'wmkjtx_kj213'); + $arr['sign'] = $sign; + $re_data = curl_post('http://oa.76ba.com/api/wanmeng/verifyBind',$arr); + $re_data = json_decode($re_data,true)['data']; + foreach($list_data as $k => $v) { - $list_data[$k]['oa_associated'] = $re_data[$v['account']]; - M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]); + 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']]]); + } } } } - $count = (I('oa_associated') || !is_null(I('oa_associated') )) ? D(self::model_name)->where($map)->count() : D(self::model_name)->count(); + $count = (I('oa_associated',-1) != -1) ? D(self::model_name)->where($map)->count() : D(self::model_name)->count(); $page = set_pagination($count,$row); if($page) {$this->assign('_page', $page);} $this->assign('list_data', $list_data);