Commit c7147a2f authored by zhuwei's avatar zhuwei

1

parent d8fec578
......@@ -169,18 +169,28 @@ class ImageDepot extends Basic
}
public function ceshi()
{
// $s = new PositionService();
//
// // $res = $s->getPositionDistance('31.067059,121.518854','31.079655,121.51713');
// $res = $s->getPositionDistance('31.170841,121.463858','31.17265,121.464914');
// dump($res);
$s = new UserAgentService();
$res = $s->moveHouse();
dump($res);
$s_user_agent = new UserAgentService();
$user_count = $s_user_agent->moveHouseCount();
dump($user_count);
$limit = 100;
$total_page = intval($user_count / $limit) + (($user_count % $limit == 0) ? 0 : 1);
dump($total_page);
for ($page = 1; $page <= $total_page; $page++) {
// $res = $s_user_agent->moveHouse($page,$limit);
// if($page == 10){
// exit;
// }
}
// dump($res);
}
......
......@@ -77,7 +77,7 @@ class UserAgentService
{
$params['user_id'] = $user_id;
$field = 'd.name as site_name,c.name as agent_name,c.phone as agent_phone';
$field = 'a.site_id,a.agent_id,d.name as site_name,c.name as agent_name,c.phone as agent_phone';
$user_agent_info = $this->m_user_agent->selectUserAgent($field,$params);
if(!$user_agent_info){
return false;
......@@ -102,11 +102,14 @@ class UserAgentService
/**
* 搬家
* @param int $page
* @param int $limit
* @return int|string
*/
public function moveHouse($pageNo = 1,$pageSize = 100){
public function moveHouse($page = 1,$limit = 100){
$field = "a.id as user_id,b.id as agent_id,b.site_id";
$params[] = ['EXP', 'b.site_id IS NOT NULL '];
$user_list = $this->m_user->moveHouse($field, $params, $pageNo, $pageSize, "a.id asc");
$user_list = $this->m_user->moveHouse($field, $params, $page, $limit, "a.id asc");
foreach ($user_list as $k1 => $v1) {
$user_list[$k1]['create_time'] = date("Y-m-d H:i:s", time());
......@@ -118,5 +121,15 @@ class UserAgentService
return $user_insert;
}
/*
* 符合要求的客户数量
*/
public function moveHouseCount(){
$params[] = ['EXP', 'b.site_id IS NOT NULL '];
$user_count = $this->m_user->moveHouseCount($params);
return $user_count;
}
}
\ No newline at end of file
......@@ -1113,7 +1113,7 @@ class Users extends Model
->select();
}
public function moveHouse($field, $params,$pageNo, $pageSize, $order)
public function moveHouse($field, $params,$page, $limit, $order)
{
$result = Db::table($this->table)
->alias("a")
......@@ -1121,12 +1121,22 @@ class Users extends Model
->field($field)
->where($params)
->order($order)
->page($pageNo)
->limit($pageSize)
->page($page)
->limit($limit)
->select();
return $result;
}
public function moveHouseCount($params)
{
$result = Db::table($this->table)
->alias("a")
->join("a_agents b", "b.id=a.agent_id", "left")
->where($params)
->count();
return $result;
}
public function moveHouseInsertAll($data)
{
$result = Db::table($this->table)
......
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