<?php
|
//分页信息
|
$page=empty($_REQUEST['page'])!=false ? 1 : $_REQUEST['page'];
|
$QuantityInt = 20; //每页显示数量
|
$acc1=$page; //当前页数
|
$acc2=0; //总页数
|
$acc3=0; //总记录数
|
|
//查询条件
|
$searchSql="";
|
/*
|
$searchTXT=empty($searchTXT)!=false ? "" : $searchTXT;
|
if ($searchTXT!=""){
|
$searchSql=" and (OA_Name like '%$searchTXT%') ";
|
}else{
|
$searchSql="";
|
}
|
*/
|
|
$orderby=empty($orderby)!=false ? "" : $orderby;
|
If (strrpos($orderby," desc")>1){
|
$orderbydesc="";
|
$descTXT="↓";
|
}else{
|
$orderbydesc=" desc";
|
$descTXT="↑";
|
}
|
|
If ($orderby=="") {
|
$orderby="OA_DepartmentID,OA_User_ID";
|
$descTXT="↓";
|
}
|
|
//查询开始
|
$SqlOrdDateType=empty($SqlOrdDateType)!=false ? "" : $SqlOrdDateType;
|
$OrdClassType=empty($OrdClassType)!=false ? "1" : $OrdClassType;
|
|
$sql="select SourceName,sum(LoginUserInt) as LoginUserInt,sum(NewUserInt) as NewUserInt from (select (CASE when LEFT(UserSource,3)='Iid' then (select top 1 IntroducerName from IntroducerData where IntroducerID=replace(UserSource,LEFT(UserSource,3),'')) when LEFT(UserSource,4)='UUID' then '营销小程序' else UserSource END) as SourceName,LEFT(UserSource,3) as Source,replace(UserSource,LEFT(UserSource,3),'') as SourceID,count(UserID) as LoginUserInt,NewUserInt=(select count(UserID) from UserData as b where a.UserSource=b.UserSource and UserRegisterTime ".$SqlDateType." ) from UserData as a where UserSource<>'' and UserLoginTime ".$SqlDateType." GROUP BY UserSource) as aa GROUP BY SourceName";
|
//echo $sql;exit;
|
$data = sqlsrv_query($conn,$sql);
|
if($data == true){
|
$FormArray=array();
|
//表头
|
$FormArray[0]=array("来源","新用户","活跃用户");
|
$FormArrayX=count($FormArray[0]);
|
if (sqlsrv_rows_affected($data)==0) {
|
$SystemMessageType=2;
|
$SystemMessageTXT="数据库中相关无数据!";
|
$y=0;
|
} else {
|
$i=0;
|
while($rs = sqlsrv_fetch_array( $data, SQLSRV_FETCH_ASSOC) ) {
|
//读取数据
|
$SourceName = $rs['SourceName'];
|
$NewUserInt = $rs['NewUserInt'];
|
$LoginUserInt = $rs['LoginUserInt'];
|
//读取数据--End
|
|
//写入数组
|
$i++;
|
$FormArray[$i][0]=$SourceName;
|
$FormArray[$i][1]=$NewUserInt;
|
$FormArray[$i][2]=$LoginUserInt;
|
|
//写入数组--End
|
}
|
|
}
|
}
|
|
//echo print_r($FormArray);
|
//exit;
|
?>
|