Your Name 3 سال پیش
والد
کامیت
39d53ca5eb
4فایلهای تغییر یافته به همراه139 افزوده شده و 15 حذف شده
  1. 6 4
      tool/clue/database/info.php
  2. 4 2
      tool/clue/database/info_stat.php
  3. 9 7
      tool/clue/lib/Cron.php
  4. 120 2
      tool/clue/lib/Manage.php

+ 6 - 4
tool/clue/database/info.php

@@ -83,7 +83,7 @@ if ($search_auth ==2) {
 			if ($work) {
 			if ($work) {
 				$work['group'] = explode(',',$work['group']);
 				$work['group'] = explode(',',$work['group']);
 				if (isset($work['group'][1]) && $work['group'][1] && $work['group'][1] == $admin_id) {
 				if (isset($work['group'][1]) && $work['group'][1] && $work['group'][1] == $admin_id) {
-					$audit_admin = Dever::setInput('search_option_follow_group_id', $group['id']);
+					$audit_group = Dever::setInput('search_option_follow_group_id', $group['id']);
 				} else {
 				} else {
 					$audit_admin = Dever::setInput('search_option_follow_admin_id', $admin_id);
 					$audit_admin = Dever::setInput('search_option_follow_admin_id', $admin_id);
 				}
 				}
@@ -580,8 +580,9 @@ return array
     (
     (
     	'list_option' => array
     	'list_option' => array
         (
         (
-         'col' => 'yes-follow_admin_id,yes-follow_group_id',
-         'status' => array('yes', 'in'),
+         'col' => 'yes-follow_admin_id,follow_group_id',
+         'type' => array('yes', 'in'),
+         'state' =>1,
         ),
         ),
         'list' => array
         'list' => array
         (
         (
@@ -599,7 +600,7 @@ return array
                 'start_cdate'=>array('yes-cdate','>='),
                 'start_cdate'=>array('yes-cdate','>='),
                 'end_cdate' => array('yes-cdate','<='),
                 'end_cdate' => array('yes-cdate','<='),
                 'follow_admin_id' => 'yes',
                 'follow_admin_id' => 'yes',
-                'follow_grouop_id' => 'yes',
+                'follow_group_id' => 'yes',
                 // 'area' => array('yes', 'like'),
                 // 'area' => array('yes', 'like'),
                 'start_day' => array('yes-day', '>='),
                 'start_day' => array('yes-day', '>='),
                 'end_day' => array('yes-day', '<='),
                 'end_day' => array('yes-day', '<='),
@@ -619,6 +620,7 @@ return array
             	'start' => array('yes-cdate','>='),
             	'start' => array('yes-cdate','>='),
             	'end'=>array('yes-cdate','<='),
             	'end'=>array('yes-cdate','<='),
                 'follow_group_id' =>'yes',
                 'follow_group_id' =>'yes',
+                'create_group_id' => 'yes',
                 // 'type' =>array('yes','in'),
                 // 'type' =>array('yes','in'),
                 'state' => 1,
                 'state' => 1,
             ),
             ),

+ 4 - 2
tool/clue/database/info_stat.php

@@ -31,6 +31,8 @@ return array
             'default'   => '',
             'default'   => '',
             'match'     => 'is_numeric',
             'match'     => 'is_numeric',
             'desc'      => '',
             'desc'      => '',
+            'list'      => 'date("Y-m-d", {cdate})',
+            'list_order' => 1,
             // 'search'    => 'day',
             // 'search'    => 'day',
             // 'search_button' => array
             // 'search_button' => array
             // (
             // (
@@ -150,8 +152,8 @@ return array
             # 只有insert时才生效
             # 只有insert时才生效
             'insert'    => true,
             'insert'    => true,
             'search'    => 'day',
             'search'    => 'day',
-            'list'      => 'date("Y-m-d", {cdate})',
-            'list_order' => 1,
+            // 'list'      => 'date("Y-m-d", {cdate})',
+            // 'list_order' => 1,
         ),
         ),
     ),
     ),
 
 

+ 9 - 7
tool/clue/lib/Cron.php

@@ -6,10 +6,8 @@ Class Cron
 {
 {
 	public function stat_api()
 	public function stat_api()
 	{
 	{
-		$start=mktime(0,0,0,date('m'),date('d'),date('Y'));
+		$start=mktime(0,0,0,date('m'),date('d'),date('Y'))-86400;
         $end = $start+86400-1;
         $end = $start+86400-1;
-        // print_R($start);
-        // print_R($end);die;
         $data = Dever::db('work/branch')->state();
         $data = Dever::db('work/branch')->state();
         foreach ($data as $k => $v) {
         foreach ($data as $k => $v) {
         	$w['follow_group_id'] = $v['group_id'];
         	$w['follow_group_id'] = $v['group_id'];
@@ -17,10 +15,14 @@ Class Cron
         	$w['end'] = $end;
         	$w['end'] = $end;
         	$where['group_id'] = $v['group_id'];
         	$where['group_id'] = $v['group_id'];
         	$where['day'] = $start;
         	$where['day'] = $start;
-        	$cy = Dever::db('clue/info_log')->getCountAll($w);
-        	
-        	// echo dever::sql();die;
-        	$where['group_num'] = count($cy);
+        	// $cy = Dever::db('clue/info_log')->getCountAll($w);
+        	$info = Dever::db('clue/info')->getAll($w);
+        	$create = Dever::db('clue/info')->getAll(array('start'=>$start,'end'=>$end,'create_group_id'=>$v['group_id']));
+        	$cinfo = array_merge($info,$create);
+        	foreach ($cinfo as $k1 =>$v1) {
+        		$rest[$v1['id']]=$v1;
+        	}
+        	$where['group_num'] = count($rest);
         	$w['type'] = '1,2,3,4,5';
         	$w['type'] = '1,2,3,4,5';
         	$where['num'] = Dever::db('clue/info')->getHAll($w);
         	$where['num'] = Dever::db('clue/info')->getHAll($w);
         	$w['type'] = 1;
         	$w['type'] = 1;

+ 120 - 2
tool/clue/lib/Manage.php

@@ -74,7 +74,7 @@ Class Manage
 	}
 	}
 	public function out_muban_api()
 	public function out_muban_api()
 	{
 	{
-		$header = array('客户姓名','手机号','客户等级','跟进次数','所在城市','跟进人','跟进状态','最近跟进时间');
+		$header = array('客户姓名*','手机号*','客户等级*','微信号','QQ号','所在城市','性别','年龄','行业','线索状态(默认为未分派)');
 		$body = array();
 		$body = array();
 		
 		
 		$file = "下载模板";
 		$file = "下载模板";
@@ -105,6 +105,124 @@ Class Manage
 							$where['userset_id'] = $userset['id'];
 							$where['userset_id'] = $userset['id'];
 						}
 						}
 					}
 					}
+					if ($v['D']) {
+						$where['wechat'] = $v['D'];
+					}
+					if ($v['E']) {
+						$where['qq'] = $v['E'];
+					}
+					$provice = '';
+					$city_id = '';
+					if ($v['F']) {
+						$area = explode('/',$v['F']);
+						if ($area[0]) {
+							$pro = Dever::db('area/province')->find(array('name'=>$area[0]));
+							if ($pro) {
+								$province = $pro['id'];
+							}
+						}
+						if(isset($area[1]) && $area[1]) {
+							$city = Dever::db('area/city')->find(array('name'=>$area[1]));
+							if ($city) {
+								$city_id = ','.$city['id'];
+							}
+						}
+						$where['area'] = $province.$city_id;
+					}
+					if ($v['G']) {
+						if ($v['G'] == '未知') {
+							$where['sex'] = 1;
+						} else if ($v['G'] == '男') {
+							$where['sex'] = 2;
+						} else if ($v['G'] == '女') {
+							$where['sex'] = 3;
+						}
+					}
+					if ($v['H']) {
+						$where['age'] = $v['H'];
+					}
+					if ($v['I']) {
+						$where['trade'] = $v['I'];
+					}
+					if ($v['J']) {
+						if ($v['J'] == '未分派') {
+							$where['status_id'] = 1;
+						} elseif ($v['J'] == '初期接触阶段') {
+							$where['status_id'] = 2;
+						} elseif ($v['J'] == '潜在客户洽谈') {
+							$where['status_id'] = 3;
+						} elseif ($v['J'] == '定金已付阶段') {
+							$where['status_id'] = 4;
+						} elseif ($v['J'] == '成交完成') {
+							$where['status_id'] = 5;
+						} elseif ($v['J'] == '取消关闭') {
+							$where['status_id'] = 6;
+						} elseif ($v['J'] == '搁置中	') {
+							$where['status_id'] = 7;
+						}
+					} else {
+						$where['status_id'] = 1;
+					}
+					
+					$group_id = '';
+					$admin_id = '';
+					$company = Dever::load('manage/company.get');
+					$admin = Dever::load("manage/auth.info");
+					$admin = Dever::db('manage/admin')->find($admin['id']);
+					if ($admin) {
+						$admin['group'] = explode(',',$admin['group']);
+						foreach ($admin['group'] as $k =>$v) {
+							$group = Dever::db('manage/group')->find(array('company_id'=>$company,'id'=>$v));
+						}
+						if ($group) {
+							$group_id = $group['id'];
+							$where['follow_group_id'] = $group['id'];
+							$where['create_group_id'] = $group['id'];
+						}
+						$admin_id = $admin['id'];
+						$where['follow_admin_id'] = $admin['id'];
+						$where['create_admin_id'] = $admin['id'];
+						$where['follow'] = $group_id.','.$admin_id;
+					}
+					$where['out_type'] = 2;
+					$info = Dever::db('clue/info')->find(array('mobile'=>$where['mobile'],'clear'=>true));
+					$where['clear'] = true;
+					if (!$info && $where) {
+
+						Dever::db('clue/info')->insert($where);
+					}
+					
+				}
+			}
+
+		}
+	}
+	/*
+	public function updateImport($id,$name,$data) {
+		$where = array();
+		$source = Dever::param('source',$data);
+		if ($source) {
+			$sou = Dever::db('clue/source')->find(array('name'=>$source));
+			if ($sou){
+				$where['source'] = $sou['id'];
+			}
+		}
+		$file = Dever::param('file',$data);
+		$file = Dever::local($file);
+		$res = Dever::excelImport($file,0);
+		if ($res) {
+			foreach ($res as $k => $v) {
+				if ($k >= 2) {
+					$where['name'] = $v['A'];
+					$where['mobile'] = $v['B'];
+					$where['clue_num'] = Dever::load('clue/lib/info')->getClueNum();
+					if ($v['C']) {
+						$userset = Dever::db('clue/user_set')->find(array('name'=>$v['C']));
+
+						if ($userset ) {
+							$where['userset_id'] = $userset['id'];
+						}
+					}
 					$where['num'] = $v['D'];
 					$where['num'] = $v['D'];
 					$provice = '';
 					$provice = '';
 					$city_id = '';
 					$city_id = '';
@@ -182,7 +300,7 @@ Class Manage
 			}
 			}
 
 
 		}
 		}
-	}
+	}*/
 	public function group($id)
 	public function group($id)
 	{
 	{
 		$data = Dever::db('manage/group')->find($id);
 		$data = Dever::db('manage/group')->find($id);