edit-sylive-kpidata
This commit is contained in:
@@ -680,4 +680,54 @@ class Syt extends CI_Controller
|
||||
}
|
||||
echo '执行结束';
|
||||
}
|
||||
|
||||
public function kpi(){
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->model('market/market_sylive_order_model','order_model');
|
||||
$this->load->model('market/market_sylive_activity_user_model', 'act_user_model');
|
||||
$this->load->model('market/market_sylive_groups_user_model', 'groups_user_model');
|
||||
$this->load->model('market/market_sylive_subscribemsg_model', 'mdSytSubscribemsg');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'activityId' => 6,
|
||||
'id<=' => 91939,
|
||||
'pid>' => 0,
|
||||
"pid != channelId" => null
|
||||
];
|
||||
$rows = $this->act_user_model->select($where,'id desc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $key => $val) {
|
||||
//查找是否是管理员
|
||||
$group_user = $this->groups_user_model->get(['status'=>0,'activityId'=>6,'userId'=>$val['userId']]);
|
||||
if($group_user){
|
||||
if($group_user['userId']!=$val['channelId']){
|
||||
$this->act_user_model->update(['channelId'=>$group_user['userId']],['id'=>$val['id']]);
|
||||
echo "管理员更新成功:{$val['id']},".json_encode(['channelId'=>$group_user['userId']])."\n";
|
||||
}else{
|
||||
echo "无需更新:{$val['id']}\n";
|
||||
}
|
||||
}else{
|
||||
//查找上级
|
||||
$p_act_user = $this->act_user_model->get(['userId'=>$val['pid'],'activityId'=>6]);
|
||||
$update = [];
|
||||
if($p_act_user['channelId']){
|
||||
$update['channelId'] = $p_act_user['channelId'];
|
||||
}else{
|
||||
$p_act_user['groupsId'] && $update['channelId'] = $p_act_user['userId'];
|
||||
}
|
||||
if($update && $update['channelId']!=$val['channelId']){
|
||||
$this->act_user_model->update($update,['id'=>$val['id']]);
|
||||
echo "更新成功:{$val['id']},".json_encode($update)."\n";
|
||||
}else{
|
||||
echo "无需更新:{$val['id']}\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user