Commit d8ccd6a9 authored by zhuwei's avatar zhuwei

1

parent 6391460f
......@@ -103,20 +103,20 @@ class UserAgentService
/**
* 搬家
*/
public function moveHouse(){
$pageNo = 1;
$pageSize = 10;
$field = "id as user_id,b.id as agent_id,b.site_id";
$user_list = $this->m_user->moveHouse($field, $pageNo, $pageSize, "a.id desc");
/**
`user_id` int(10) DEFAULT NULL,
`site_id` int(6) DEFAULT '10001' COMMENT '站点id ',
`agent_id` int(10) DEFAULT NULL COMMENT '经纪人id注意:上海的客方可以是杭州的经纪人',
`is_del` tinyint(1) DEFAULT '0' COMMENT '是否删除 0正常 1删除',
`create_time` timestamp NULL DEFAULT NULL,
`update_time`
*/
return $user_list;
public function moveHouse($pageNo = 1,$pageSize = 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");
foreach ($user_list as $k1 => $v1) {
$user_list[$k1]['create_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);
return $user_insert;
}
}
\ No newline at end of file
......@@ -127,4 +127,11 @@ class UserAgentModel extends Model
->select();
return $result;
}
public function moveHouseInsertAll($data)
{
$result = Db::table($this->table)
->insertAll($data);
return $result;
}
}
......@@ -1113,18 +1113,25 @@ class Users extends Model
->select();
}
public function moveHouse($field, $pageNo, $pageSize, $order)
public function moveHouse($field, $params,$pageNo, $pageSize, $order)
{
$result = Db::table($this->table)
->alias("a")
->join("a_agents b", "b.agent_id=a.id", "left")
->join("a_agents b", "b.id=a.agent_id", "left")
->field($field)
// ->where($params)
->where($params)
->order($order)
->page($pageNo)
->limit($pageSize)
->select();
return $result;
}
public function moveHouseInsertAll($data)
{
$result = Db::table($this->table)
->insertAll($data);
return $result;
}
}
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