diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index f4d55f041..3c264ca95 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -69,25 +69,38 @@ unset($_REQUEST['parent_id']); $this->m_title = '推广员列表'; $this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find()); if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + + if(!empty(I('oa_associated'))) { + $oa_data = []; + for($i = 1; $i > 0; $i++) { + $arr['time'] = time(); + $arr['page'] = $i; + $arr['pageSize'] = 1000; + 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/platformAccount',$arr); + $re_data = json_decode($re_data,true); + if($re_data['code'] == 1) { + $oa = $re_data['data']; + $oa_data = array_merge($oa_data,$oa); + + } else { + break; + } + } + + $promote = D(self::model_name)->field('id,account')->where(['oa_associated' => 0])->order('id DESC')->select(); + $oa_data = array_column($oa_data, 'platform_account'); + foreach($promote as $k => $v) { + if(in_array($v['account'], $oa_data)) { + M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => 1]); + } + } + + } $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p,$row)->select(); - // $arr['time'] = time(); - // $arr['page'] = 1; - // $arr['pageSize'] = 1000; - // ksort($arr); - // reset($arr); - // $sign = md5(http_build_query($arr) . 'wmkjtx_kj213'); - // $arr['sign'] = $sign; - // $reData = curl_post('http://oa.76ba.com/api/wanmeng/platformAccount',$arr); - // $reData = json_decode($reData,true)['data']; - // $oa = array_column($reData, 'platform_account'); - // foreach($list_data as $k => $v) - // { - // if($v['oa_associated'] != 1) { - // $oa_val = in_array($v['account'], $oa) ? 1 : 0; - // $list_data[$k]['oa_associated'] = $oa_val; - // M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $oa_val]); - // } - // } $oa_data = []; foreach($list_data as $k => $v) { @@ -103,14 +116,14 @@ unset($_REQUEST['parent_id']); reset($arr); $sign = md5(http_build_query($arr) . 'wmkjtx_kj213'); $arr['sign'] = $sign; - $reData = curl_post('http://oa.76ba.com/api/wanmeng/verifyBind',$arr); - $reData = json_decode($reData,true)['data']; + $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) { - if(in_array($v['account'], $reData)) + if(in_array($v['account'], $re_data)) { - $list_data[$k]['oa_associated'] = $reData[$v['account']]; - M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $reData[$v['account']]]); + $list_data[$k]['oa_associated'] = $re_data[$v['account']]; + M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]); } } } diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index 7d94de0d4..95b87420d 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -126,7 +126,14 @@ - + +
+ +
+
+ +