Commit 8ca730ce authored by clone's avatar clone

冻结经纪人

parent 89a5d94c
...@@ -386,6 +386,19 @@ class AAgents extends BaseModel ...@@ -386,6 +386,19 @@ class AAgents extends BaseModel
->select(); ->select();
} }
public function selectFollowUpNumByAgent( $field = "a.id",$table,$params,$num)
{
$where["district_id"] = array( 'not in', array( '13', '14', '15' ) );
return Db::table($this->table)
->field($field)
->alias("a")
->join( $table." as b" ,"a.id = b.agent_id","right")
->where($params)
->group("b.agent_id")
->having("count > $num")
->select();
}
/** /**
* @param string $field * @param string $field
* @param $params * @param $params
......
...@@ -578,6 +578,8 @@ Route::group('task', [ ...@@ -578,6 +578,8 @@ Route::group('task', [
'test' => ['task/FollowUpTask/test', ['method' => 'get']], 'test' => ['task/FollowUpTask/test', ['method' => 'get']],
'isExistTable' => ['task/FollowUpTask/isExistTable', ['method' => 'get']], 'isExistTable' => ['task/FollowUpTask/isExistTable', ['method' => 'get']],
'moveFollowUpList' => ['task/FollowUpTask/moveFollowUpList', ['method' => 'get']], 'moveFollowUpList' => ['task/FollowUpTask/moveFollowUpList', ['method' => 'get']],
'frostAgent' => ['task/FrostAgentTask/frostAgent', ['method' => 'get']],
]); ]);
Route::group('broker', [ Route::group('broker', [
......
<?php
namespace app\task\controller;
/**
* Created by PhpStorm.
* User: fuju
* Date: 2019/2/27
* Time: 16:05
*/
use app\model\AAgents;
use app\model\ASite;
class FrostAgentTask{
private $agentsModel;
private $table = 'u_phone_follow_up_';
private $date ;
private $siteModel;
function __construct()
{
$this->agentsModel = new AAgents();
$this->date = date("Y-m-d",strtotime("-1 day"));
$this->siteModel = new ASite();
}
public function frostAgent(){
//select count(1) as count,a.phone from a_agents a RIGHT JOIN u_phone_follow_up_10001 b on a.id = b.agent_id
//GROUP BY b.agent_id HAVING count >15 ;
$site_arr = $this->siteModel->getSite("id,name,city,is_del", ["is_del" => 0]);
if (count($site_arr) <= 0) {
return;
}
$field = "count(1) as count,a.id";
$params["a.status"] = 0;
$params["a.level"] = 10;
foreach ($site_arr as $item) {
$table_name = $this->table . $item["id"] . "_" . $this->date;
$params["a.site_id"] = $item["id"];
$agent_arr = $this->agentsModel->selectFollowUpNumByAgent( $field,$table_name,$params,15);
//execute_update
$this->execute_update($agent_arr);
}
}
private function execute_update($agent_arr){
dump($agent_arr);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment