public function deleteAll($fields, $type = null) { if (!is_array($fields)) { $fields = array($fields); } if (!$fields) { return; } switch ($type) { case 'person': $cwhere = " WHERE c.is_company=0 "; break; case 'company': $cwhere = " WHERE c.is_company>0 "; break; default: $cwhere = ''; } $set = array(); foreach ($fields as $id) { switch ($id) { case 'birthday': $value = "'0000-00-00'"; break; case 'photo': $value = 0; break; default: $value = "''"; break; } $set[] = "`{$id}`={$value}"; } $set = implode(',', $set); if (!$this->model) { $this->model = new waContactModel(); } $this->model->exec("UPDATE wa_contact AS c SET " . $set . $cwhere); }