|
@@ -282,8 +282,11 @@ class MainController extends DooController {
|
|
|
'where' => ' username!="admin" ' . $staffCondition,
|
|
|
'asArray' => true
|
|
|
) );
|
|
|
+
|
|
|
+ $alCondition=' aid>'.REMIT.' ';
|
|
|
+
|
|
|
$actionLogList = $action_log->find ( array (
|
|
|
- 'where' => ' 1 ' . $condition,
|
|
|
+ 'where' =>$alCondition . $condition,
|
|
|
'limit' => $page . ',' . $limit,
|
|
|
'desc' => 'aid',
|
|
|
'asArray' => true
|
|
@@ -294,7 +297,7 @@ class MainController extends DooController {
|
|
|
// 抽取日期 ,'groupby'=>'updatetime'
|
|
|
$dateLog = $action_log->find ( array (
|
|
|
'select' => 'updatetime',
|
|
|
- 'where' => ' 1 ' . $condition,
|
|
|
+ 'where' => $alCondition . $condition,
|
|
|
'limit' => $limit,
|
|
|
'desc' => 'aid',
|
|
|
'asArray' => true
|
|
@@ -566,7 +569,7 @@ class MainController extends DooController {
|
|
|
$max = array ();
|
|
|
$sum=0;
|
|
|
//客户总数
|
|
|
- $redisKey=date('Y-m-d').'_logStatisticsCSum';
|
|
|
+ $redisKey=date('Y-m-d').'_logStatisticsCSum_'.$this->staff [0] ['cid'];
|
|
|
$redisValue = $redis->lrange($redisKey, 0, -1);
|
|
|
if (empty($redisValue)){
|
|
|
$kkk = array ();
|
|
@@ -707,6 +710,10 @@ class MainController extends DooController {
|
|
|
|
|
|
//添加客户 数30天
|
|
|
$redisKey=date('Y-m-d').'SC_'.$redisCid.'_'.$redisSid;
|
|
|
+
|
|
|
+// echo $redisKey;
|
|
|
+// echo "<br/> date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) and status=1" . $categoryCondition . $sidCondition;
|
|
|
+
|
|
|
$redisValue=$redis->get($redisKey);
|
|
|
if (empty($redisValue)){
|
|
|
$actionLogClient = $action_log->find ( array (
|
|
@@ -749,9 +756,6 @@ class MainController extends DooController {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
// / Year(updatetime)=".date('Y')." and Month(updatetime)=".date('m')." and
|
|
|
$categoryList = $lcategory->find ( array (
|
|
|
'asArray' => true
|
|
@@ -1466,6 +1470,9 @@ class MainController extends DooController {
|
|
|
Doo::loadModel ( 'client' );
|
|
|
$client = new client ();
|
|
|
|
|
|
+ $redis = new Redis();
|
|
|
+ $redis->connect('127.0.0.1', '6379');
|
|
|
+
|
|
|
$cinfo = $client->getClientByNameT ( $clientname );
|
|
|
if (! empty ( $cinfo )) {
|
|
|
$ninfo = $company->getCompanyByCompanyname ( $companyname );
|
|
@@ -1544,11 +1551,8 @@ class MainController extends DooController {
|
|
|
//
|
|
|
// $company->update();
|
|
|
$diqu = $local1 . "," . $local2 . "," . $local3;
|
|
|
-
|
|
|
$cid = $companyInfo ['cid'];
|
|
|
-
|
|
|
$company2 = new company ();
|
|
|
-
|
|
|
$companyList = $company2->find ( array (
|
|
|
'where' => " companyname like '" . $companyname . "'",
|
|
|
"asArray" => true
|
|
@@ -1558,36 +1562,26 @@ class MainController extends DooController {
|
|
|
// print_r($companyList);
|
|
|
foreach ( $companyList as $key => $value ) {
|
|
|
if ($value ['district'] != $diqu) {
|
|
|
-
|
|
|
$falg = true;
|
|
|
} elseif ($value ['district'] == $diqu) {
|
|
|
$falg = false;
|
|
|
-
|
|
|
$cid = $value ['cid'];
|
|
|
-
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // var_dump($falg) ;die;
|
|
|
-
|
|
|
if ($falg) {
|
|
|
$company->companyname = $companyname;
|
|
|
-
|
|
|
$company->staffid = $this->staff [0] ['sid'];
|
|
|
-
|
|
|
$cid = $company->insert ();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
Doo::loadModel ( 'client_staff' );
|
|
|
-
|
|
|
$client_staff = new client_staff ();
|
|
|
|
|
|
$client->clientname = $clientname;
|
|
|
-
|
|
|
$client->gender = $gender;
|
|
|
-
|
|
|
$client->priority = $priority;
|
|
|
|
|
|
if (! empty ( $nicename ))
|
|
@@ -1602,9 +1596,7 @@ class MainController extends DooController {
|
|
|
$client->qq = $qq;
|
|
|
|
|
|
$client->companyid = $cid;
|
|
|
-
|
|
|
$client->companyname = $companyname;
|
|
|
-
|
|
|
$client->district = $local1 . "," . $local2 . "," . $local3;
|
|
|
// echo $client->district;
|
|
|
// die;
|
|
@@ -1650,13 +1642,9 @@ class MainController extends DooController {
|
|
|
|
|
|
// 加入地区记录
|
|
|
Doo::loadModel ( "district_staff" );
|
|
|
-
|
|
|
$district_staff = new district_staff ();
|
|
|
-
|
|
|
$district_staff->did = $lv1 [0] ['id'];
|
|
|
-
|
|
|
$district_staff->sid = $this->staff [0] ['sid'];
|
|
|
-
|
|
|
$district_staff->insert ();
|
|
|
|
|
|
// 日常行为
|
|
@@ -1675,10 +1663,105 @@ class MainController extends DooController {
|
|
|
if (isset ( $nature [0] ))
|
|
|
$action_log->nature = $nature [0];
|
|
|
$action_log->company = $companyname;
|
|
|
-
|
|
|
$action_log->class = $action_log->iconContacts;
|
|
|
-
|
|
|
$action_log->insert ();
|
|
|
+
|
|
|
+ //事实更新信息中心记录数量 需要更新3个redis 内的值
|
|
|
+ $categoryCondition = " and cid=" . $this->staff [0] ['cid'];
|
|
|
+ $sidCondition = " and sid=" . $this->staff [0] ['sid'];
|
|
|
+
|
|
|
+ //actionlog免查询值 $alCondition='';
|
|
|
+ $alCondition=' aid>'.REMIT.' and ';
|
|
|
+
|
|
|
+ //个人添加数量redis值
|
|
|
+ $redisKeyCS=date('Y-m-d').'SC_'.$this->staff [0] ['cid'].'_'.$this->staff [0] ['sid'];
|
|
|
+ $action_log = new action_log ();
|
|
|
+ $actionLogClient = $action_log->find ( array (
|
|
|
+ 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
|
|
|
+ 'where' => $alCondition." status=1" . $sidCondition . $categoryCondition.' and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime)',
|
|
|
+ 'groupby' => 'date_format(updatetime,"%m-%d")',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+ $statisticsClient = array ();
|
|
|
+ for($d = 0; $d <= 29; $d ++) {
|
|
|
+ $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
|
|
|
+ $falgClient = true;
|
|
|
+
|
|
|
+ foreach ( $actionLogClient as $value ) {
|
|
|
+ if ($value ['updatetime'] == $MD) {
|
|
|
+ array_push ( $statisticsClient, $value ['count'] );
|
|
|
+ $falgClient = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($falgClient)
|
|
|
+ array_push ( $statisticsClient, 0 );
|
|
|
+
|
|
|
+ }
|
|
|
+ $statisticsClient = array_reverse ( $statisticsClient );
|
|
|
+ $jsc=json_encode ( $statisticsClient );
|
|
|
+ $redis->set($redisKeyCS,$jsc);
|
|
|
+
|
|
|
+ //办事处添加数量reids值
|
|
|
+ $redisKeyC=date('Y-m-d').'SC_'.$this->staff [0] ['cid'].'_';
|
|
|
+ $action_log = new action_log ();
|
|
|
+ $actionLogClient = $action_log->find ( array (
|
|
|
+ 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
|
|
|
+ 'where' => $alCondition." status=1" . $categoryCondition.' and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime)',
|
|
|
+ 'groupby' => 'date_format(updatetime,"%m-%d")',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+ $statisticsClient = array ();
|
|
|
+ for($d = 0; $d <= 29; $d ++) {
|
|
|
+ $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
|
|
|
+ $falgClient = true;
|
|
|
+
|
|
|
+ foreach ( $actionLogClient as $value ) {
|
|
|
+ if ($value ['updatetime'] == $MD) {
|
|
|
+ array_push ( $statisticsClient, $value ['count'] );
|
|
|
+ $falgClient = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($falgClient)
|
|
|
+ array_push ( $statisticsClient, 0 );
|
|
|
+
|
|
|
+ }
|
|
|
+ $statisticsClient = array_reverse ( $statisticsClient );
|
|
|
+ $jsc=json_encode ( $statisticsClient );
|
|
|
+ $redis->set($redisKeyC,$jsc);
|
|
|
+
|
|
|
+ //全员添加数量的redis值
|
|
|
+ $redisKey=date('Y-m-d').'SC__';
|
|
|
+ $action_log = new action_log ();
|
|
|
+ $actionLogClient = $action_log->find ( array (
|
|
|
+ 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
|
|
|
+ 'where' => $alCondition.' status=1 and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime)',
|
|
|
+ 'groupby' => 'date_format(updatetime,"%m-%d")',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ $statisticsClient = array ();
|
|
|
+ for($d = 0; $d <= 29; $d ++) {
|
|
|
+ $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
|
|
|
+ $falgClient = true;
|
|
|
+
|
|
|
+ foreach ( $actionLogClient as $value ) {
|
|
|
+ if ($value ['updatetime'] == $MD) {
|
|
|
+ array_push ( $statisticsClient, $value ['count'] );
|
|
|
+ $falgClient = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($falgClient)
|
|
|
+ array_push ( $statisticsClient, 0 );
|
|
|
+
|
|
|
+ }
|
|
|
+ $statisticsClient = array_reverse ( $statisticsClient );
|
|
|
+ $jsc=json_encode ( $statisticsClient );
|
|
|
+ $redis->set($redisKey,$jsc);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
return "/contacts";
|
|
@@ -4842,6 +4925,10 @@ class MainController extends DooController {
|
|
|
) );
|
|
|
die ();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 为客户添加服务日志
|
|
|
+ */
|
|
|
function ajaxAddServiceLog() {
|
|
|
$status = $this->get_args('status') ? $this->get_args('status') : "";
|
|
|
$clientid = $this->get_args('cid') ? $this->get_args('cid') : "";
|
|
@@ -4917,6 +5004,101 @@ class MainController extends DooController {
|
|
|
$action_log->class = $action_log->iconContacts;
|
|
|
$action_log->insert ();
|
|
|
|
|
|
+ //更新信息中心服务日志统计数量
|
|
|
+ $redis = new Redis();
|
|
|
+ $redis->connect('127.0.0.1', '6379');
|
|
|
+
|
|
|
+ $categoryCondition = " and cid=" . $this->staff [0] ['cid'];
|
|
|
+ $sidCondition = " and sid=" . $this->staff [0] ['sid'];
|
|
|
+ //actionlog免查询值 $alCondition='';
|
|
|
+ $alCondition=' aid>'.REMIT.' and ';
|
|
|
+
|
|
|
+ //个人服务日志数量redis值
|
|
|
+ $redisKeyCS=date('Y-m-d').'SL_'.$this->staff [0] ['cid'].'_'.$this->staff [0] ['sid'];
|
|
|
+ $action_log = new action_log ();
|
|
|
+
|
|
|
+ $actionLogLongle = $action_log->find ( array (
|
|
|
+ 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
|
|
|
+ 'where' => $alCondition." status=3 ".$categoryCondition.$sidCondition." and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) " ,
|
|
|
+ 'groupby' => 'date_format(updatetime,"%m-%d")',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+
|
|
|
+ $statisticsLongle = array ();
|
|
|
+ for($d = 0; $d <= 29; $d ++) {
|
|
|
+ $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
|
|
|
+ $falgLongle = true;
|
|
|
+
|
|
|
+ foreach ( $actionLogLongle as $value ) {
|
|
|
+ if ($value ['updatetime'] == $MD) {
|
|
|
+ array_push ( $statisticsLongle, $value ['count'] );
|
|
|
+ $falgLongle = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($falgLongle)
|
|
|
+ array_push ( $statisticsLongle, 0 );
|
|
|
+ }
|
|
|
+ $statisticsLongle = array_reverse ( $statisticsLongle );
|
|
|
+ $jsl=json_encode ( $statisticsLongle );
|
|
|
+ $redis->set($redisKeyCS,$jsl);
|
|
|
+
|
|
|
+ //办事处服务日志数量reids值
|
|
|
+ $redisKeyC=date('Y-m-d').'SL_'.$this->staff [0] ['cid'].'_';
|
|
|
+ $action_log = new action_log ();
|
|
|
+ $actionLogLongle = $action_log->find ( array (
|
|
|
+ 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
|
|
|
+ 'where' => $alCondition." status=3 ".$categoryCondition." and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) " ,
|
|
|
+ 'groupby' => 'date_format(updatetime,"%m-%d")',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ $statisticsLongle = array ();
|
|
|
+ for($d = 0; $d <= 29; $d ++) {
|
|
|
+ $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
|
|
|
+ $falgLongle = true;
|
|
|
+
|
|
|
+ foreach ( $actionLogLongle as $value ) {
|
|
|
+ if ($value ['updatetime'] == $MD) {
|
|
|
+ array_push ( $statisticsLongle, $value ['count'] );
|
|
|
+ $falgLongle = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($falgLongle)
|
|
|
+ array_push ( $statisticsLongle, 0 );
|
|
|
+ }
|
|
|
+ $statisticsLongle = array_reverse ( $statisticsLongle );
|
|
|
+ $jsl=json_encode ( $statisticsLongle );
|
|
|
+ $redis->set($redisKeyC,$jsl);
|
|
|
+
|
|
|
+ //全员处服务日志数量的redis值
|
|
|
+ $redisKey=date('Y-m-d').'SL__';
|
|
|
+ $action_log = new action_log ();
|
|
|
+ $actionLogLongle = $action_log->find ( array (
|
|
|
+ 'select' => 'date_format(updatetime,"%m-%d") as updatetime,COUNT(*) as count',
|
|
|
+ 'where' => $alCondition." status=3 and date_sub(curdate(), INTERVAL 30 DAY) <= date(updatetime) " ,
|
|
|
+ 'groupby' => 'date_format(updatetime,"%m-%d")',
|
|
|
+ 'asArray' => true
|
|
|
+ ) );
|
|
|
+ $statisticsLongle = array ();
|
|
|
+ for($d = 0; $d <= 29; $d ++) {
|
|
|
+ $MD = date ( "m-d", strtotime ( "-" . $d . " day" ) );
|
|
|
+ $falgLongle = true;
|
|
|
+
|
|
|
+ foreach ( $actionLogLongle as $value ) {
|
|
|
+ if ($value ['updatetime'] == $MD) {
|
|
|
+ array_push ( $statisticsLongle, $value ['count'] );
|
|
|
+ $falgLongle = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($falgLongle)
|
|
|
+ array_push ( $statisticsLongle, 0 );
|
|
|
+ }
|
|
|
+ $statisticsLongle = array_reverse ( $statisticsLongle );
|
|
|
+ $jsl=json_encode ( $statisticsLongle );
|
|
|
+ $redis->set($redisKey,$jsl);
|
|
|
+
|
|
|
if (! empty ( $Remind )) {
|
|
|
Doo::loadModel ( 'remind' );
|
|
|
$remindObj = new remind ();
|
|
@@ -6444,7 +6626,7 @@ class MainController extends DooController {
|
|
|
$eMailList->districtId = $did;
|
|
|
$eMailList->nature = implode ( ",", $nature );
|
|
|
}
|
|
|
- //$eMailList->insert ();
|
|
|
+ $eMailList->insert ();
|
|
|
|
|
|
//创建邮件地址
|
|
|
//'http://sendcloud.sohu.com/webapi/list_member.add.json';
|