Commit 959d3422 authored by hujun's avatar hujun

新增商铺判断是否存在关系

parent f7096d03
......@@ -155,9 +155,18 @@ class GHousesToAgents extends BaseModel
public function addHouseAgent($agents_id, $houses_id, $type) {
$agent_arr = [];
foreach ($agents_id as $k=>$v) {
$agent_arr[$k]['houses_id'] = $houses_id;
$agent_arr[$k]['agents_id'] = $v;
$agent_arr[$k]['type'] = $type;
$num = $this->where('houses_id', $houses_id)
->where('agents_id', $v)
->where('type', $type)
->where('is_del',0)
->count();
if (empty($num)) {
$agent_arr[$k]['houses_id'] = $houses_id;
$agent_arr[$k]['agents_id'] = $v;
$agent_arr[$k]['type'] = $type;
}
}
$res = $this->insertAll($agent_arr);
......
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