edit-sylive-group_list
This commit is contained in:
@@ -370,103 +370,6 @@ class Syt extends CI_Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
//更新活动用户表信息
|
||||
public function tmp(){
|
||||
$this->load->library('market/sylive_entity');
|
||||
$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_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'activityId>' => 0,
|
||||
'userId>' => 0
|
||||
];
|
||||
$total = $this->act_user_model->count($where);
|
||||
$filed = 'id,userId,activityId';
|
||||
$rows = $this->act_user_model->select($where,'id asc',$page,$size,$filed);
|
||||
if(!$rows){
|
||||
echo "执行完毕";exit;
|
||||
}
|
||||
echo $total.'<br>';
|
||||
$user_ids = implode(',',array_column($rows,'userId'));
|
||||
$where = ["userId in ({$user_ids})"=>null];
|
||||
$users = $this->user_model->map('userId','',$where);
|
||||
foreach ($rows as $item) {
|
||||
$user = $users[$item['userId']] ? $users[$item['userId']][0] : [];
|
||||
if($user){
|
||||
$update = [
|
||||
'organizationId' => $user['organizationId'],
|
||||
'teamId' => $user['teamId'],
|
||||
];
|
||||
if($update['organizationId']){
|
||||
$level_lists = $this->sylive_entity->get_level_lists($update['organizationId']);
|
||||
if($level_lists){
|
||||
$area_id = $level_lists[1]['organizationId'];//获取大区id
|
||||
$biz_id = $level_lists[2]['organizationId'];//获取店铺id
|
||||
}
|
||||
$type = 0;
|
||||
}
|
||||
if($update['teamId']){
|
||||
$team_lists = $this->sylive_entity->get_team_lists($update['teamId']);
|
||||
if($team_lists) {
|
||||
$area_id = $team_lists[0]['teamId']; //大团长id
|
||||
$biz_id = $team_lists[1]['teamId']; //团长id
|
||||
}
|
||||
$type = 1;
|
||||
}
|
||||
if($update['teamId']||$update['organizationId']){
|
||||
$where = [
|
||||
'type' => $type,
|
||||
'activityId' => $item['activityId'],
|
||||
'cfUserId' => $item['userId']
|
||||
];
|
||||
$where['kpi'] = 'browse';
|
||||
$browse = $this->mdSytActivityKpiData->count($where);
|
||||
$where['kpi'] = 'subscribe';
|
||||
$subscribe = $this->mdSytActivityKpiData->count($where);
|
||||
$where['kpi'] = 'order';
|
||||
$orderTotal = $this->mdSytActivityKpiData->count($where);
|
||||
$where['kpi'] = 'watch';
|
||||
$watch = $this->mdSytActivityKpiData->count($where);
|
||||
}
|
||||
$area_id && $update['areaId'] = $area_id;
|
||||
$biz_id && $update['bizId'] = $biz_id;
|
||||
$browse && $update['browse'] = $browse;
|
||||
$subscribe && $update['subscribe'] = $subscribe;
|
||||
$orderTotal && $update['orderTotal'] = $orderTotal;
|
||||
$watch && $update['watch'] = $watch;
|
||||
$this->act_user_model->update($update,['userId'=>$item['userId']]);
|
||||
echo "用户id:{$item['userId']}更新成功:".json_encode($update,JSON_UNESCAPED_UNICODE)."<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
//临时更新kpi时间
|
||||
public function tmp_day(){
|
||||
$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 = 100;
|
||||
$where = [
|
||||
'createTime>' => 0,
|
||||
'day' => '0000-00-00',
|
||||
];
|
||||
$total = $this->mdSytActivityKpiData->count($where);
|
||||
echo '总数:'.$total.'<br>';
|
||||
if($total){
|
||||
$rows = $this->mdSytActivityKpiData->select($where,'id asc',$page,$size,'id,createTime');
|
||||
foreach ($rows as $item) {
|
||||
$update = [
|
||||
'day' => date('Y-m-d',$item['createTime']),
|
||||
];
|
||||
$this->mdSytActivityKpiData->update($update,['id'=>$item['id']]);
|
||||
}
|
||||
}
|
||||
echo '更新完成';
|
||||
}
|
||||
|
||||
//更新经销商地址
|
||||
public function tem_bizinfo(){
|
||||
@@ -514,173 +417,6 @@ class Syt extends CI_Controller
|
||||
echo "更新成功,黑名单列表:".json_encode($mobile_list,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function up_order(){
|
||||
$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');
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->library('market/sylive_entity');
|
||||
$id = $this->input->get('id');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'activityId' => 4,
|
||||
'status' => 1
|
||||
];
|
||||
$id && $where['id'] = $id;
|
||||
$rows = $this->order_model->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
$where = [
|
||||
"activityId" => 4,
|
||||
'kpi' => 'order',
|
||||
'tagId' => $item['id']
|
||||
];
|
||||
$is_add = $this->mdSytActivityKpiData->get($where);
|
||||
if($is_add){
|
||||
echo "订单id:{$item['id']},已添加过<br>";
|
||||
}else{
|
||||
$act_user = $this->act_user_model->get(['userId'=>$item['userId'],'activityId'=>$item['activityId']]);
|
||||
$params = [
|
||||
'a_id' => $item['activityId'],
|
||||
'uid' => $item['userId'],
|
||||
'cf_uid' => $act_user['channelId'],
|
||||
'kpi' => 'order',
|
||||
'tagId' => $item['id'],
|
||||
'jsondata'=> ['order_id'=>$item['id'],'sid'=>$item['sid']]
|
||||
];
|
||||
$sy_res = $this->sylive_entity->kpi_log($params);
|
||||
echo "订单id:{$item['id']},执行结果:".json_encode($sy_res,JSON_UNESCAPED_UNICODE)."<br>";
|
||||
}
|
||||
}
|
||||
}else{
|
||||
echo '更新完毕';
|
||||
}
|
||||
}
|
||||
|
||||
public function biz_order(){
|
||||
$this->load->model('market/market_sylive_activity_biz_model','mdSytActivityBiz');
|
||||
$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,
|
||||
];
|
||||
$rows = $this->mdSytActivityBiz->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $key => $val) {
|
||||
$update = [
|
||||
'browse' => $this->mdSytActivityKpiData->count(['activityId'=>4,'bizId'=>$val['bizId'],'kpi'=>'browse','type'=>0]),
|
||||
'subscribe' => $this->mdSytActivityKpiData->count(['activityId'=>4,'bizId'=>$val['bizId'],'kpi'=>'subscribe','type'=>0]),
|
||||
'orderTotal' => $this->mdSytActivityKpiData->count(['activityId'=>4,'bizId'=>$val['bizId'],'kpi'=>'order','type'=>0]),
|
||||
'watch' => $this->mdSytActivityKpiData->count(['activityId'=>4,'bizId'=>$val['bizId'],'kpi'=>'watch','type'=>0]),
|
||||
];
|
||||
$this->mdSytActivityBiz->update($update,['id'=>$val['id']]);
|
||||
echo "id:{$val['id']}原来订单数".json_encode($val,JSON_UNESCAPED_UNICODE)."<br>,更新结果:".json_encode($update,JSON_UNESCAPED_UNICODE)."<br>";
|
||||
}
|
||||
}else{
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
public function user_order(){
|
||||
$this->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 = [
|
||||
'browse' => $this->mdSytActivityKpiData->count(['activityId'=>4,'cfUserId'=>$val['userId'],'kpi'=>'browse','type'=>0]),
|
||||
'subscribe' => $this->mdSytActivityKpiData->count(['activityId'=>4,'cfUserId'=>$val['userId'],'kpi'=>'subscribe','type'=>0]),
|
||||
'orderTotal' => $this->mdSytActivityKpiData->count(['activityId'=>4,'cfUserId'=>$val['userId'],'kpi'=>'order','type'=>0]),
|
||||
'watch' => $this->mdSytActivityKpiData->count(['activityId'=>4,'cfUserId'=>$val['userId'],'kpi'=>'watch','type'=>0])
|
||||
];
|
||||
$this->act_user_model->update($update,['id'=>$val['id']]);
|
||||
echo "id:{$val['id']}原来订单数".json_encode($val,JSON_UNESCAPED_UNICODE)."<br>,更新结果:".json_encode($update,JSON_UNESCAPED_UNICODE)."<br>";
|
||||
}
|
||||
}else{
|
||||
echo '执行结束';
|
||||
}
|
||||
}
|
||||
|
||||
public function up_kpi_jsondata(){
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->model('market/market_sylive_order_model','order_model');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'activityId' => 4,
|
||||
'tagId>' => 0,
|
||||
'jsondata is null' => null,
|
||||
'kpi' => 'order'
|
||||
];
|
||||
$rows = $this->mdSytActivityKpiData->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
$order = $this->order_model->get(['id'=>$item['tagId']]);
|
||||
if($order){
|
||||
$jsondata = $item['jsondata'] ? json_decode($item['jsondata'],true) : [];
|
||||
$jsondata['order_id'] = $order['id'];
|
||||
$jsondata['sid'] = $order['sid'];
|
||||
$update = [
|
||||
'jsondata' => json_encode($jsondata,JSON_UNESCAPED_UNICODE)
|
||||
];
|
||||
$this->mdSytActivityKpiData->update($update,['id'=>$item['id']]);
|
||||
echo "更新成功:".json_encode($update,JSON_UNESCAPED_UNICODE).",kpidata id:{$item['id']}<br>";
|
||||
}else{
|
||||
echo "找不到订单:{$item['tagId']},kpidata id:{$item['id']}<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo $this->mdSytActivityKpiData->db->last_query();exit;
|
||||
print_r($rows);
|
||||
}
|
||||
//更新kpi itemId
|
||||
public function up_kpi_order(){
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->model('market/market_sylive_order_model','order_model');
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
$where = [
|
||||
'activityId' => 5,
|
||||
'tagId>' => 0,
|
||||
'itemId' => 0,
|
||||
'kpi' => 'order'
|
||||
];
|
||||
$rows = $this->mdSytActivityKpiData->select($where,'id asc',$page,$size);
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
$order = $this->order_model->get(['id'=>$item['tagId']]);
|
||||
if($order){
|
||||
$update = [
|
||||
'itemId' => $order['itemId']
|
||||
];
|
||||
$this->mdSytActivityKpiData->update($update,['id'=>$item['id']]);
|
||||
echo "更新成功:".json_encode($update,JSON_UNESCAPED_UNICODE).",kpidata id:{$item['id']}<br>";
|
||||
}else{
|
||||
echo "找不到订单:{$item['tagId']},kpidata id:{$item['id']}<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '执行结束';
|
||||
}
|
||||
|
||||
public function kpi(){
|
||||
$this->load->model('market/market_sylive_activity_kpidata_model','mdSytActivityKpiData');
|
||||
$this->load->model('market/market_sylive_order_model','order_model');
|
||||
|
||||
@@ -424,7 +424,7 @@ class Stic extends Admin{
|
||||
public function group_lists(){
|
||||
$params = $this->input->get();
|
||||
$page = $params['page'] ? $params['page'] : 1;
|
||||
$size = 20;
|
||||
$size = 100;
|
||||
|
||||
$disk = $this->sylive2_entity->level_disk($this->a_id);
|
||||
$where = [
|
||||
@@ -433,7 +433,7 @@ class Stic extends Admin{
|
||||
'status' => 0
|
||||
];
|
||||
$total = $this->groups_model->count($where);
|
||||
$rows = $this->groups_model->select($where,'sortNumber desc',$page,$size);
|
||||
$rows = $this->groups_model->select($where,'sortNumber desc',$page,$size,'groupsId,ifBiz,groupsLevel,groupsName');
|
||||
$lists = [];
|
||||
if($rows){
|
||||
foreach ($rows as $item) {
|
||||
|
||||
Reference in New Issue
Block a user