Commit 75bc136f authored by zhuwei's avatar zhuwei

1

parent 5bfad4aa
......@@ -911,8 +911,8 @@ class User extends Basic
*/
public function moveHouseAgent()
{
ini_set('memory_limit', '500M'); //内存限制
set_time_limit(0); //
// ini_set('memory_limit', '500M'); //内存限制
// set_time_limit(0); //
$s_user_agent = new UserAgentService();
$res = $s_user_agent->moveHouse();
return $res;
......
......@@ -104,9 +104,6 @@ class UserAgentService
* 处理老数据
*/
public function moveHouse(){
ini_set('memory_limit', '500M'); //内存限制
set_time_limit(0); //
$limit = 1000;
$user_count = $this->moveHouseCount();
......@@ -115,9 +112,8 @@ class UserAgentService
for ($page = 1; $page <= $total_page; $page++) {
$res = $this->moveHouseSaveData($page,$limit);
big_log($res);
}
return true;
return '';
}
/**
......@@ -130,18 +126,11 @@ class UserAgentService
$field = "a.id as user_id,b.id as agent_id,a.site_ids as site_id,a.create_time";
$params[] = ['EXP', 'a.site_ids IS NOT NULL AND a.agent_id IS NOT NULL AND a.agent_id > 0'];
$user_list = $this->m_user->moveHouse($field, $params, $page, $limit, "a.id asc");
$user_list_ = [];
foreach ($user_list as $k => $v) {
$site_ids = explode(',', $v['site_id']);
foreach ($site_ids as $k1 => $v1) {
// dump($v1);exit;
$is_save = $this->isSaveEd($v['user_id'],$v['agent_id'],$v['site_id']);
big_log('检查是否已经存在数据!');
big_log($is_save);
if($is_save){
big_log('存在跳出循环!');
continue;
}
$a = [];
$a['user_id'] = $v['user_id'];
$a['site_id'] = $v1;
......@@ -151,9 +140,19 @@ class UserAgentService
$user_list_[] = $a;
}
}
// dump($user_list_);exit;
foreach ($user_list_ as $k2 => $v2) {
$is_save = $this->isSaveEd($v2['user_id'],$v2['agent_id'],$v2['site_id']);
if($is_save){
unset($user_list_[$k2]);
}
}
if($user_list_){
$user_insert = $this->m_user_agent->moveHouseInsertAll($user_list_);
return $user_insert;
}
return true;
}
/**
......
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