/** * 修改think php的where方法,在执行查询时只查询没有删除的记录. * * @param isNeed 是指是否需要is_remove这个条件 * @param mixed $where * @param null $parse * * @return Model */ public function where($where, $parse = null, $isNeed = 1) { if ($isNeed == 1) { parent::where(array('is_remove' => 0)); } return parent::where($where, $parse); }
public function where($map, $parse = null) { if (!$this->not_belongs_to_company) { $this->real_model_name = $this->real_model_name ? $this->real_model_name : $this->getModelName(); $map[$this->real_model_name . ".company_id"] = get_current_company_id(); } return parent::where($map, $parse); }