|
|
|
@ -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]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|