Commit 55fd61e7 authored by hujun's avatar hujun

del 参数

parent 565d3d2a
...@@ -180,12 +180,12 @@ class Broker extends Basic ...@@ -180,12 +180,12 @@ class Broker extends Basic
$data['data'] = ''; $data['data'] = '';
$data['msg'] = ''; $data['msg'] = '';
if ($this->params['id'] && $this->params['houses_id']) { if ($this->params['id'] && $this->params['houses_id'] && $this->params['type']) {
$hg = new GHousesToAgents(); $hg = new GHousesToAgents();
$hg->del($this->params['id'], $this->params['houses_id']); $hg->del($this->params['id'], $this->params['houses_id'], $this->params['type']);
} else { } else {
$data['status'] = 101; $data['status'] = 101;
$data['msg'] = 'id or houses_id is null'; $data['msg'] = '参数错误';
} }
return $this->response($data['status'], $data['msg'], $data['data']); return $this->response($data['status'], $data['msg'], $data['data']);
} }
......
...@@ -178,12 +178,16 @@ class GHousesToAgents extends BaseModel ...@@ -178,12 +178,16 @@ class GHousesToAgents extends BaseModel
* *
* @param $id * @param $id
* @param $houses_id * @param $houses_id
* @return bool|false|int * @param $type
* @return GHousesToAgents|bool
*/ */
public function del($id, $houses_id) public function del($id, $houses_id, $type)
{ {
if ($id) { if ($id) {
$res = $this->save([ 'is_del' => 1 ], [ 'agents_id' => $id, 'houses_id' => $houses_id ]); $where['agents_id'] = $id;
$where['houses_id'] = $houses_id;
$where['type'] = $type;
$res = $this->where($where)->update([ 'is_del' => 1 ]);
} else { } else {
$res = false; $res = false;
} }
...@@ -409,4 +413,19 @@ class GHousesToAgents extends BaseModel ...@@ -409,4 +413,19 @@ class GHousesToAgents extends BaseModel
->where('a.agents_id', $agent_id) ->where('a.agents_id', $agent_id)
->count(); ->count();
} }
/**
* @param $field
* @param $type
* @param $houses_id
* @param int $is_del
* @return array
*/
public function getAgentHouseOne($field, $type, $houses_id, $is_del = 0) {
$where['is_del'] = $is_del;
$where['type'] = $type;
$where['houses_id'] = $houses_id;
return $this->where($where)
->column($field);
}
} }
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