public function queryAction() { $club_id = get_club_id(); $user_id = I("user_id"); if (empty($user_id)) { $time = I("time"); if ($time == 0) { $start_time = I("start_time"); if (empty($start_time)) { $this->error("请输入开始时间!"); } $ret = McService::getInstance()->getOneMonthStatistics($club_id, $start_time); $this->ajaxReturn(array("status" => 1, "statistics" => $ret)); } else { $start_time = I("start_time"); if (empty($start_time)) { $this->error("请输入开始时间!"); } $end_time = I("end_time"); if (empty($end_time)) { $this->error("请输入终止时间!"); } $ret = McService::getInstance()->getMonthStatistics($club_id, $start_time, $end_time); $this->ajaxReturn(array("status" => 1, "statistics" => $ret)); } } else { $time = I("time"); if ($time == 0) { $start_time = I("start_time"); if (empty($start_time)) { $this->error("请输入开始时间!"); } $ret = McService::getInstance()->getUserOneMonthStatistics($user_id, $start_time); $this->ajaxReturn(array("status" => 1, "statistics" => $ret)); } else { $start_time = I("start_time"); if (empty($start_time)) { $this->error("请输入开始时间!"); } $end_time = I("end_time"); if (empty($end_time)) { $this->error("请输入终止时间!"); } $ret = McService::getInstance()->getUserMonthStatistics($user_id, $start_time, $end_time); $this->ajaxReturn(array("status" => 1, "statistics" => $ret)); } } }
public function indexAction() { $mcs = D("User")->getMc(); $club_id = get_club_id(); $start_time = date("Y-m"); $ret = array(); $followModel = M("McFollowUp"); foreach ($mcs as $key => $value) { $st = McService::getInstance()->getUserOneMonthStatistics($value['id'], $start_time); $v = array("name" => $value["name_cn"], "protential" => 0, "transform" => 0, "sale" => 0, "invit" => 0); if (!empty($st)) { $v["protential"] = $st[0]['protential_value']; $v["transform"] = $st[0]['transform_value']; } $v["invit"] = $followModel->where(array("mc_id" => $value['id'], "ret" => array("neq", 0)))->count(); $v["goodssale"] = McService::getInstance()->getThisMonthGoodsSale($value['id']); $v["cardsale"] = McService::getInstance()->getThisMonthCardsSale($value['id']); $sale[$key] = $v["goodssale"] + $v["cardsale"]; $ret[] = $v; } array_multisort($sale, SORT_DESC, $ret); $this->assign("heroes", $ret); $this->display(); }
public function indexAction() { $cPotentialNumber = McService::getInstance()->getThisMonthPotentialNumber(); $lPotentialNumber = McService::getInstance()->getLastMonthPotentialNumber(); $potential_ratio = $lPotentialNumber == 0 ? "+∞" : ceil(abs($lPotentialNumber - $cPotentialNumber) * 100 / $lPotentialNumber); $this->assign("potential_number", $cPotentialNumber); $this->assign("potential_ratio", $potential_ratio); $this->assign("pr_stat", $lPotentialNumber <= $cPotentialNumber ? "stat-success" : "stat-important"); $cMemberNumber = McService::getInstance()->getThisMonthMemberNumber(); $lMemberNumber = McService::getInstance()->getLastMonthMemberNumber(); $member_ratio = $lMemberNumber == 0 ? "+∞" : ceil(abs($lMemberNumber - $cMemberNumber) * 100 / $lMemberNumber); $this->assign("member_number", $cMemberNumber); $this->assign("member_ratio", $member_ratio); $this->assign("mr_stat", $lMemberNumber <= $cMemberNumber ? "stat-success" : "stat-important"); $cCardSale = McService::getInstance()->getThisMonthCardsSale(); $lCardSale = McService::getInstance()->getLastMonthCardsSale(); $cardsale_ratio = ceil(abs($lCardSale - $cCardSale) * 100 / $lCardSale); $this->assign("cardsale", $cCardSale); $this->assign("cardsale_ratio", $cardsale_ratio); $this->assign("cs_stat", $lCardSale <= $cCardSale ? "stat-success" : "stat-important"); $cGoodsSale = McService::getInstance()->getThisMonthGoodsSale(); $lGoodsSale = McService::getInstance()->getLastMonthGoodsSale(); $goodssale_ratio = $lGoodsSale == 0 ? "+∞" : ceil(abs($lGoodsSale - $cGoodsSale) * 100 / $lGoodsSale); $this->assign("goodssale", $cGoodsSale); $this->assign("goodssale_ratio", $goodssale_ratio); $this->assign("gs_stat", $lGoodsSale <= $cGoodsSale ? "stat-success" : "stat-important"); $cfn = McService::getInstance()->getThisMonthFollowupNumber(); $lfn = McService::getInstance()->getLastMonthFollowupNumber(); $fn_ratio = $lfn == 0 ? "+∞" : ceil(abs($lfn - $cfn) * 100 / $lfn); $this->assign("cfn", $cfn); $this->assign("fn_ratio", $fn_ratio); $this->assign("fn_stat", $lfn <= $cfn ? "stat-success" : "stat-important"); $cfsn = McService::getInstance()->getThisMonthFollowupSuccess(); $lfsn = McService::getInstance()->getLastMonthFollowupSuccess(); $fsn_ratio = $lfsn == 0 ? "+∞" : ceil(abs($lfsn - $cfsn) * 100 / $lfsn); $this->assign("cfsn", $cfsn); $this->assign("fsn_ratio", $fsn_ratio); $this->assign("fsn_stat", $lfsn <= $cfsn ? "stat-success" : "stat-important"); $csn = McService::getInstance()->getThisMonthService(); $lsn = McService::getInstance()->getLastMonthService(); $sn_ratio = $lsn == 0 ? "+∞" : ceil(abs($lsn - $csn) * 100 / $lsn); $this->assign("csn", $csn); $this->assign("sn_ratio", $sn_ratio); $this->assign("sn_stat", $lsn <= $csn ? "stat-success" : "stat-important"); $cssn = McService::getInstance()->getThisMonthServiceSuccess(); $lssn = McService::getInstance()->getLastMonthServiceSuccess(); $ssn_ratio = $lssn == 0 ? "+∞" : ceil(abs($lssn - $cssn) * 100 / $lssn); $this->assign("cssn", $cssn); $this->assign("ssn_ratio", $ssn_ratio); $this->assign("ssn_stat", $lssn <= $cssn ? "stat-success" : "stat-important"); $time = date('Y-m'); $club_id = get_club_id(); $plan = McService::getInstance()->getOneMonthStatistics($club_id, $time); $this->assign("finished", ceil($plan[0]['protential_value'] * 10000 / $plan[0]['protential_plan']) / 100); $mcs = D("User")->getMc(); $this->assign("mcs", $mcs); //recently member record $this->display(); }
protected function _initialize() { define('UID', is_user_login()); if (!UID) { // 还没登录 跳转到登录页面 $this->redirect('Home/Index/index'); } if (!IS_AJAX) { Cookie('__lastpage__', Cookie('__thispage__')); Cookie('__thispage__', $_SERVER['REQUEST_URI']); } $loginuser = getLoginUser(); $this->user = $loginuser['UserExtension']['name_cn']; $this->assign("useravatar", "/Public/uploads/em_avatar/" . $loginuser['UserExtension']['avatar']); $isMc = D("User")->isMc(UID); $isChannel = D("User")->isChannel(UID); $isReception = D("User")->isReception(UID); if (empty($isReception)) { $isReception = 0; } if ($isMc) { $start_time = date("Y-m"); $st = McService::getInstance()->getUserOneMonthStatistics(UID, $start_time); if (!empty($st)) { $this->mc_protential_persent = ceil($st[0]["protential_value"] * 10000 / $st[0]["protential_plan"]) / 100; $this->mc_transform_persent = ceil($st[0]["transform_value"] * 10000 / $st[0]["transform_plan"]) / 100; $this->mc_protential_value = $st[0]["protential_value"]; $this->mc_protential_plan = $st[0]["protential_plan"]; $this->mc_transform_value = $st[0]["transform_value"]; $this->mc_transform_plan = $st[0]["transform_plan"]; } else { $isMc = 0; } } if ($isChannel) { $start_time = date("Y-m"); $st = ChannelService::getInstance()->getUserOneMonthStatistics(UID, $start_time); if (!empty($st)) { $this->channel_protential_persent = ceil($st[0]["protential_value"] * 10000 / $st[0]["protential_plan"]) / 100; $this->channel_channel_persent = ceil($st[0]["channel_value"] * 10000 / $st[0]["channel_plan"]) / 100; $this->channel_channel_value = $st[0]["channel_value"]; $this->channel_channel_plan = $st[0]["channel_plan"]; $this->channel_protential_value = $st[0]["protential_value"]; $this->channel_protential_plan = $st[0]["protential_plan"]; } else { $isChannel = 0; } } $this->isReception = $isReception; $this->show_plan = $isMc || $isChannel; $this->isMc = $isMc; $this->uid = UID; $this->club_id = get_club_id(); $this->isChannel = $isChannel; $this->checkRole(); //通知 $model = D("Notice"); $brand_id = get_brand_id(); $ret = $model->getLatestNotice($brand_id); $this->notice = nl2br($ret['content']); if (!IS_AJAX) { $this->loadMenus(); } }