Commit e88021f2 authored by zhuwei's avatar zhuwei

1

parent 7f4f294c
...@@ -177,19 +177,8 @@ class ImageDepot extends Basic ...@@ -177,19 +177,8 @@ class ImageDepot extends Basic
// dump($res); // dump($res);
$s_user_agent = new UserAgentService(); $s_user_agent = new UserAgentService();
$user_count = $s_user_agent->moveHouseCount(); $res = $s_user_agent->moveHouse();
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); // dump($res);
} }
......
...@@ -101,12 +101,30 @@ class UserAgentService ...@@ -101,12 +101,30 @@ class UserAgentService
/** /**
* 搬家 * 处理老数据
*/
public function moveHouse(){
$limit = 100;
$user_count = $this->moveHouseCount();
$total_page = intval($user_count / $limit) + (($user_count % $limit == 0) ? 0 : 1);
for ($page = 1; $page <= $total_page; $page++) {
// $res = $s_user_agent->moveHouse($page,$limit);
// if($page == 10){
// exit;
// }
}
}
/**
* 保存数据
* @param int $page * @param int $page
* @param int $limit * @param int $limit
* @return int|string * @return int|string
*/ */
public function moveHouse($page = 1,$limit = 100){ public function moveHouseSaveData($page = 1,$limit = 100){
$field = "a.id as user_id,b.id as agent_id,b.site_id"; $field = "a.id as user_id,b.id as agent_id,b.site_id";
$params[] = ['EXP', 'b.site_id IS NOT NULL ']; $params[] = ['EXP', 'b.site_id IS NOT NULL '];
$user_list = $this->m_user->moveHouse($field, $params, $page, $limit, "a.id asc"); $user_list = $this->m_user->moveHouse($field, $params, $page, $limit, "a.id asc");
...@@ -116,7 +134,6 @@ class UserAgentService ...@@ -116,7 +134,6 @@ class UserAgentService
$user_list[$k1]['update_time'] = date("Y-m-d H:i:s", time()); $user_list[$k1]['update_time'] = date("Y-m-d H:i:s", time());
} }
dump($user_list);
$user_insert = $this->m_user_agent->moveHouseInsertAll($user_list); $user_insert = $this->m_user_agent->moveHouseInsertAll($user_list);
return $user_insert; return $user_insert;
} }
......
...@@ -129,7 +129,7 @@ class UserService ...@@ -129,7 +129,7 @@ class UserService
$s_user_agent->addUserAgent($data['agents_id'],$id,$site_id); $s_user_agent->addUserAgent($data['agents_id'],$id,$site_id);
}else{ }else{
if (!empty($data['agents_id']) && ($data['agents_id'] != $agent_id_old)) { if (!empty($data['agents_id']) && ($data['agents_id'] != $agent_id_old)) {
$s_user_agent->changeUserAgent($data['agent_id'],$id,$site_id); $s_user_agent->changeUserAgent($data['agents_id'],$id,$site_id);
} }
} }
......
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