add-sylive-plan
This commit is contained in:
@@ -539,55 +539,53 @@ class Syt extends CI_Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function order_info(){
|
||||
$this->load->model('market/market_sylive_user_model', 'user_model');
|
||||
$this->load->model('market/market_sylive_activity_user_model', 'act_user_model');
|
||||
$this->load->model('market/market_sylive_order_model','order_model');
|
||||
$this->load->model('market/market_sylive_activity_model');
|
||||
$this->load->model('market/market_sylive_activity_orders_model','mdSytActivityOrders');
|
||||
public function biz_order(){
|
||||
$this->load->model('market/market_sylive_activity_biz_model','mdSytActivityBiz');
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->library('market/sylive_entity');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'activityId' => 4,
|
||||
'status' => 1,
|
||||
'bizId' => 0,
|
||||
'areaId' => 0,
|
||||
];
|
||||
$rows = $this->order_model->select($where,'id asc',$page,$size);
|
||||
$rows = $this->mdSytActivityBiz->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
$user = $this->user_model->get(['userId'=>$item['userId']]);
|
||||
$act_user = $this->act_user_model->get(['userId'=>$item['userId'],'activityId'=>$item['activityId']]);
|
||||
$p_user = [];
|
||||
$act_user['channelId'] && $p_user = $this->act_user_model->get(['userId'=>$act_user['channelId']]);
|
||||
if(!$p_user){
|
||||
if($user['teamId']){ //团长
|
||||
$t_level_id = $this->sylive_entity->get_team_level($user['teamId']);
|
||||
$p_user = $t_level_id<3 ? $act_user : [];
|
||||
}
|
||||
if($user['organizationId']){ //顾问
|
||||
$group_id = $this->sylive_entity->get_level($user['organizationId']);
|
||||
$p_user = $group_id<4 ? $act_user : 0;
|
||||
}
|
||||
}
|
||||
$update = [];
|
||||
$p_user['teamId'] && $update['cfrom'] = 1;
|
||||
$p_user['areaId'] && $update['areaId'] = $p_user['areaId'];
|
||||
$p_user['bizId'] && $update['bizId'] = $p_user['bizId'];
|
||||
$p_user['userId'] && $update['cfUserId'] = $p_user['userId'];
|
||||
if($update){
|
||||
echo "订单id:{$item['id']},更新:".json_encode($update,JSON_UNESCAPED_UNICODE).'<br>';
|
||||
$this->order_model->update($update,['id'=>$item['id']]);
|
||||
}else{
|
||||
echo "订单id:{$item['id']},不存在上级<br>";
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$update = [
|
||||
'orderTotal' => $this->mdSytActivityKpiData->count(['activityId'=>4,'bizId'=>$val['bizId'],'kpi'=>'order','type'=>0])
|
||||
];
|
||||
$this->mdSytActivityBiz->update($update,['id'=>$val['id']]);
|
||||
echo "用户userid:{$val['userId']}<br>";
|
||||
echo "更新结果:".json_encode($update,JSON_UNESCAPED_UNICODE)."<br>";
|
||||
}
|
||||
}else{
|
||||
echo '更新完毕';
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
public function user_order(){
|
||||
$this->ci->load->model('market/market_sylive_activity_user_model', 'act_user_model');
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'activityId' => 4,
|
||||
'organizationId>' => 0
|
||||
];
|
||||
$rows = $this->act_user_model->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $key => $val) {
|
||||
$update = [
|
||||
'orderTotal' => $this->mdSytActivityKpiData->count(['activityId'=>4,'cfUserId'=>$val['userId'],'kpi'=>'order','type'=>0])
|
||||
];
|
||||
$this->act_user_model->update($update,['id'=>$val['id']]);
|
||||
echo "用户userid:{$val['userId']}<br>";
|
||||
echo "更新结果:".json_encode($update,JSON_UNESCAPED_UNICODE)."<br>";
|
||||
}
|
||||
}else{
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user