/** * 更新关键字信息 * @param $info * @param $id */ public function update_key($info, $id) { if ($id) { $data = yf_set_update($info); $sql = "UPDATE " . $this->table('wxkeyword') . " SET " . $data . " WHERE id='" . $id . "'"; return $res = $this->query($sql); } }
/** * 修改文章信息 * @param $info * @param $photo * @param $id * @return */ public function update_art($info, $photo, $id) { if ($id) { $data = yf_set_update($info); $sql = "UPDATE " . $this->table('store_goods') . " SET " . $data . " WHERE id='" . $id . "'"; $res = $this->query($sql); $aid = $id; if ($photo) { $sql = "INSERT INTO " . $this->table('album_photos') . " (aid,original_pic) VALUES"; if (is_array($photo)) { foreach ($photo as $k => $v) { $sql .= "('{$aid}','{$v}'),"; } } else { $sql .= "('{$aid}','{$photo}'),"; } $sql = substr($sql, 0, strlen($sql) - 1); $this->query($sql); } return $res; } }
/** * 更新微信规则 * @param $info * @param $content * @param $id * @return */ public function update_rule($info, $content, $id) { $result = array('error' => 0, 'content' => ''); if ($id) { $info['modifytime'] = yf_time(); $data = yf_set_update($info); $sql = "UPDATE " . $this->table('rule') . " SET " . $data . " WHERE id='" . $id . "'"; $res = $this->query($sql); if (!$res) { $result['error'] = 1; $result['content'] = Lang('SQL_ERROR'); } else { if (is_array($content)) { if (is_array($content) && count($content) > 0) { foreach ($content as $key => $val) { $content[$key]['rid'] = $id; } $error = 0; foreach ($content as $kk => $vv) { $reply_id = ""; if (!empty($vv['id'])) { $reply_id = $vv['id']; } unset($vv['id']); if (!empty($reply_id)) { $yf_data = yf_set_update($vv); $sql = "update " . $this->table('news_reply') . " set " . $yf_data . " where id=" . $reply_id; if (!($res = $this->query($sql))) { $error++; } } else { $yf_data = yf_set_insert($vv); $sql = "insert into " . $this->table('news_reply') . " (" . $yf_data['key'] . ") values (" . $yf_data['val'] . ")"; if (!($res = $this->query($sql))) { $error++; } } } if ($error != 0) { $result['error'] = 1; $result['content'] = Lang('SQL_ERROR'); } } } else { $sql = "UPDATE " . $this->table('basic_reply') . " SET content='" . $content . "' WHERE rid='" . $id . "'"; $res = $this->query($sql); } } } return $result; }
/** * 更新表单字段信息 * @param $info * @param $id */ public function update_word($info, $id) { if ($id) { $error = 0; $old_data = $this->getRow("select * from " . $this->table('forms_word') . " where id=" . $id); if ($old_data['type'] != $info['type'] || $old_data['type_size'] != $info['type_size']) { $error++; } $data = yf_set_update($info); $sql = "update " . $this->table('forms_word') . " set " . $data . " where id=" . $id; $this->query($sql); if ($error > 0) { $data_name = $this->getOne("select data from " . $this->table('fields') . " where id=" . $old_data['fields_id']); $sql = "ALTER TABLE " . $this->table('forms_log') . "_" . $old_data['form_id'] . " MODIFY `" . $data_name . "` " . $info['type'] . "(" . $info['type_size'] . ")"; $this->query($sql); } return true; } else { return false; } }
/** * 修改权限详细信息 * @param $info;要修改的信息 * @param $id;对应的ID * @return boolean; */ public function ud_act($info, $id) { $data = yf_set_update($info); $sql = "update " . $this->table('admin_action') . " set " . $data . " where mod_id=" . $id; $this->query($sql); return true; }
/** * 更新数据库数据 * @param $info * @param $id */ public function update_menu($info, $id) { if ($id) { $data = yf_set_update($info); $sql = "UPDATE " . $this->table('category') . " SET " . $data . " WHERE id='" . $id . "'"; $this->query($sql); return true; } }
public function update_store($info, $store_id) { $data = yf_set_update($info); $sql = "update " . $this->table('store') . " set " . $data . " where store_id=" . $store_id; return $this->query($sql); }
public function update_mem_comment($info, $wxid) { $data = yf_set_update($info); $sql = "update " . $this->table('worker_info') . " set " . $data . " where wxid=" . $wxid; return $this->query($sql); }
public function update_info($info, $info2, $wxid) { $data = yf_set_update($info); $sql = "update " . $this->table('wxusers') . " set " . $data . " where wxid=" . $wxid; $this->query($sql); $count = $this->getOne("select count(*) from " . $this->table('user') . " where wxid=" . $wxid); if ($count > 0) { $data2 = yf_set_update($info2); $sql = "update " . $this->table('user') . " set " . $data2 . " where wxid=" . $wxid; } else { $info2['wxid'] = $wxid; $data2 = yf_set_insert($info2); $sql = "insert into " . $this->table('user') . " (" . $data2['key'] . ") values (" . $data2['val'] . ")"; } return $this->query($sql); }
/** * 更新版块数据信息 * @param $info * @param $id */ public function update_group($info, $id) { if ($id) { $data = yf_set_update($info); $sql = "UPDATE " . $this->table('block') . " SET " . $data . " WHERE id='" . $id . "'"; return $res = $this->query($sql); } else { return false; } }
public function coll_store($info, $type) { if ($type == 'set_coll') { $info['status'] = 1; $count = $this->getOne("select count(*) from " . $this->table('store_fav') . " where store_id=" . $info['store_id'] . " and wxid=" . $info['wxid']); if ($count > 0) { $temp = $info; unset($temp['store_id']); unset($temp['wxid']); $data = yf_set_update($temp); $sql = "update " . $this->table('store_fav') . " set " . $data . " where store_id=" . $info['store_id'] . " and wxid=" . $info['wxid']; } else { $data = yf_set_insert($info); $sql = "insert into " . $this->table('store_fav') . " (" . $data['key'] . ") values (" . $data['val'] . ")"; } } else { $info['status'] = 0; $temp = $info; unset($temp['store_id']); unset($temp['wxid']); $data = yf_set_update($temp); $sql = "update " . $this->table('store_fav') . " set " . $data . " where store_id=" . $info['store_id'] . " and wxid=" . $info['wxid']; } return $this->query($sql); }