本文整理汇总了PHP中FDB::update方法的典型用法代码示例。如果您正苦于以下问题:PHP FDB::update方法的具体用法?PHP FDB::update怎么用?PHP FDB::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDB
的用法示例。
在下文中一共展示了FDB::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
global $_FANWE;
$root = array();
$root['return'] = 0;
if ($_FANWE['uid'] == 0) {
$root['info'] = "请先登陆";
m_display($root);
}
$user = FS("User")->getUserById($_FANWE['uid']);
$data = array('oldpassword' => $_FANWE['requestData']['oldpassword'], 'newpassword' => $_FANWE['requestData']['newpassword']);
$vservice = FS('Validate');
$validate = array(array('oldpassword', 'required', '请输入现在的密码'), array('newpassword', 'range_length', '请输入正确的新密码', 6, 32));
if (!$vservice->validation($validate, $data)) {
$root['info'] = $vservice->getError();
m_display($root);
} else {
if (md5($data['oldpassword']) != $user['password']) {
$root['info'] = '原密码不正确';
m_display($root);
} else {
FDB::update('user', array('password' => md5($data['newpassword'])), 'uid = ' . $_FANWE['uid']);
$root['info'] = '修改成功';
$user_field = $_FANWE['setting']['integrate_field_id'];
$sql = "SELECT {$user_field} FROM " . FDB::table('user') . " WHERE uid = '{$_FANWE['uid']}'";
$integrate_id = intval(FDB::resultFirst($sql));
if ($integrate_id > 0) {
FS("Integrate")->editUser($integrate_id, $data['newpassword'], '', '');
}
}
}
$root['return'] = 1;
m_display($root);
}
示例2: updateBindInfo
private function updateBindInfo($user)
{
global $_FANWE;
$data = array();
$info = array();
$info['access_token'] = $user['access_token'];
$data['info'] = serialize($info);
FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
}
示例3: updateBindInfo
public function updateBindInfo($user)
{
global $_FANWE;
$info = array();
$info['access_token'] = $user['access_token'];
unset($user['access_token']);
$info['user'] = $user;
$data = array();
$data['info'] = addslashes(serialize($info));
FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
}
示例4: updateBindInfo
private function updateBindInfo($user)
{
global $_FANWE;
$info = array();
$info['oauth_token'] = $user['last_key']['oauth_token'];
$info['oauth_token_secret'] = $user['last_key']['oauth_token_secret'];
unset($user['last_key']);
$info['user'] = $user;
$data = array();
$data['info'] = addslashes(serialize($info));
FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
}
示例5: updateBindInfo
public function updateBindInfo($user)
{
global $_FANWE;
$refresh_time = TIME_UTC + (int) $user['token']['expires_in'];
$info = array();
$info['access_token'] = $user['token']['access_token'];
unset($user['token']);
$info['user'] = $user;
$data = array();
$data['refresh_time'] = $refresh_time;
$data['info'] = addslashes(serialize($info));
FDB::update('user_bind', $data, "uid = " . $_FANWE['uid'] . " AND type = '" . $this->type . "'");
}
示例6: unBind
public function unBind()
{
global $_FANWE;
if ($_FANWE['uid'] > 0) {
FDB::delete('user_bind', "uid = " . $_FANWE['uid'] . " AND type = 'taobao'");
$update = array();
$update['buyer_level'] = 0;
$update['seller_level'] = 0;
$update['is_buyer'] = 0;
FDB::update('user', $update, 'uid = ' . $_FANWE['uid']);
}
$redirect_uri = urlencode($_FANWE['site_url'] . substr(FU('settings/bind'), 1));
$url = "https://oauth.taobao.com/logoff?client_id=" . $this->config['app_key'] . "&redirect_uri=" . $redirect_uri;
fHeader("location: " . $url);
}
示例7: updateShopStatistic
public function updateShopStatistic($shop_ids)
{
if (is_array($shop_ids)) {
$shop_ids = array_unique($shop_ids);
foreach ($shop_ids as $shop_id) {
$shop_id = (int) $shop_id;
if ($shop_id > 0) {
$data = array();
$data['recommend_count'] = ShopService::getShopUserCount($shop_id);
$temp = array();
$temp['tags'] = ShopService::getShopTags($shop_id);
$temp['goods'] = ShopService::getShopGoods($shop_id);
$data['data'] = addslashes(serialize($temp));
FDB::update('shop', $data, 'shop_id = ' . $shop_id);
}
}
}
}
示例8: bindUser
public function bindUser($user, $parameters, $session)
{
if ($user) {
global $_FANWE;
$data = array();
$data['uid'] = $_FANWE['uid'];
$data['type'] = $this->type;
$data['keyid'] = $user['user_id'];
$info = array();
$info['session_key'] = $session;
$info['refresh_token'] = $parameters['refresh_token'];
$info['user'] = $user;
$data['info'] = addslashes(serialize($info));
if ((int) $parameters['expires_in'] > 0) {
$data['refresh_time'] = TIME_UTC + (int) $parameters['expires_in'];
} else {
$data['refresh_time'] = 0;
}
$update = array();
$update['buyer_level'] = $user['buyer_credit']['level'];
$update['seller_level'] = $user['seller_credit']['level'];
FDB::update('user', $update, 'uid = ' . $_FANWE['uid']);
$buyer = array();
$buyer['is_buyer'] = 1;
if ($update['buyer_level'] < 2 || $update['seller_level'] > 6) {
$buyer['is_buyer'] = 0;
}
FDB::update('user', $buyer, 'uid = ' . $_FANWE['uid'] . ' AND is_buyer > -1');
if (!empty($user['avatar']) && !FS('User')->getIsAvatar($_FANWE['uid'])) {
$img = copyFile($user['avatar']);
if ($img !== false) {
FS('User')->saveAvatar($_FANWE['uid'], $img['path']);
}
}
FDB::insert('user_bind', $data, false, true);
}
}
示例9: outputJson
if (!checkAuthority('share', 'index')) {
$result['status'] = 0;
outputJson($result);
}
$manage_lock = checkIsManageLock('share', $id);
if ($manage_lock !== false) {
$result['status'] = 1;
$result['msg'] = $manage_lock['user_name'] . ',' . sprintf(lang('manage', 'manage_lock'), fToDate($manage_lock['time']));
outputJson($result);
}
$share = FS("Share")->getShareById($id);
if (empty($share)) {
$result['status'] = 0;
outputJson($result);
}
$result['status'] = 1;
$update = array();
if ($share['is_index'] == 0) {
$result['msg'] = lang('manage', 'manage_index_success');
$update['is_index'] = 1;
} else {
$result['msg'] = lang('manage', 'manage_unindex_success');
$update['is_index'] = 0;
$update['index_img'] = '';
if (!empty($share['index_img'])) {
@unlink(FANWE_ROOT . $share['index_img']);
}
}
createManageLog('share', 'index', $id, $result['msg']);
FDB::update('share', $update, 'share_id = ' . $id);
outputJson($result);
示例10: intval
<?php
$id = intval($_FANWE['request']['tid']);
if ($id == 0) {
exit;
}
if (!checkAuthority('ask', 'edit')) {
exit;
}
$manage_lock = checkIsManageLock('ask', $id);
if ($manage_lock !== false) {
exit;
}
$old = FS('Ask')->getTopicById($id);
if (empty($old)) {
deleteManageLock('ask', $id);
exit;
}
$share_id = $old['share_id'];
$topic = array('title' => htmlspecialchars(trim($_FANWE['request']['title'])), 'content' => htmlspecialchars(trim($_FANWE['request']['content'])), 'aid' => $_FANWE['request']['aid'], 'is_best' => isset($_FANWE['request']['is_best']) ? intval($_FANWE['request']['is_best']) : 0, 'is_top' => isset($_FANWE['request']['is_top']) ? intval($_FANWE['request']['is_top']) : 0);
FDB::update('ask_thread', $topic, 'tid = ' . $id);
FS('Share')->updateShare($share_id, $topic['title'], $topic['content']);
createManageLog('ask', 'edit', $id, lang('manage', 'manage_edit_success'));
deleteManageLock('ask', $id);
$msg = lang('manage', 'manage_edit_success');
include template('manage/tooltip');
display();
示例11: define
<?php
define('ROOT_PATH', str_replace('taobao/notify.php', '', str_replace('\\', '/', __FILE__)));
include ROOT_PATH . 'public/data/caches/system/setting.cache.php';
$id = (int) $_REQUEST['exId'];
$sign = trim($_REQUEST['exIdSign']);
if ($id == 0 || empty($sign)) {
exit;
} else {
$sign1 = md5($id . $data['setting']['second_taobao_sign']);
if ($sign != $sign1) {
exit;
}
}
define('GOODS_ID', $id);
require "init.php";
$goods['page'] = trim($_FANWE['request']['pages']);
$goods['alipay_gid'] = trim($_FANWE['request']['alipayGoodsId']);
$goods['status'] = 1;
FDB::update('second_goods', $goods, 'gid = ' . GOODS_ID);
示例12: unBuyerverifier
public function unBuyerverifier()
{
global $_FANWE;
$uid = $_FANWE['uid'];
$data['is_buyer'] = -1;
FDB::update('user', $data, "uid = {$uid}");
fHeader("location: " . FU('settings/buyerverifier'));
}
示例13: updateUserTodayScore
public function updateUserTodayScore($uid, $score)
{
$uid = (int) $uid;
$score = (int) $score;
$statistic = FDB::fetchFirst('SELECT * FROM ' . FDB::table('user_statistics') . ' WHERE uid = ' . $uid . ' AND type = 7');
$today_time = getTodayTime();
if (!$statistic) {
$data['uid'] = $uid;
$data['num'] = $score;
$data['last_time'] = $today_time;
$data['type'] = 7;
FDB::insert('user_statistics', $data);
} else {
$data['last_time'] = $today_time;
if ($statistic['last_time'] < $today_time) {
$data['num'] = $score;
} else {
$data['num'] = (int) $statistic['num'] + $score;
}
FDB::update('user_statistics', $data, 'uid = ' . $uid . ' AND type = 7');
}
}
示例14: updateAlbum
public function updateAlbum($aid)
{
$aid = (int) $aid;
if (!$aid) {
return false;
}
$album = AlbumService::getAlbumById($aid);
if (empty($album)) {
return false;
}
$share_count = (int) FDB::resultFirst('SELECT COUNT(DISTINCT share_id) FROM ' . FDB::table('album_share') . ' WHERE album_id = ' . $aid);
$cache_data = array();
$res = FDB::query('SELECT share_id FROM ' . FDB::table('album_share') . '
WHERE album_id = ' . $aid . ' ORDER BY share_id DESC LIMIT 0,6');
$ids = array();
while ($data = FDB::fetch($res)) {
$ids[] = $data['share_id'];
}
if (count($ids) > 0) {
$imags = array();
$ids = implode(',', $ids);
$res = FDB::query('SELECT share_id,cache_data FROM ' . FDB::table('share') . ' WHERE share_id IN (' . $ids . ') ORDER BY share_id DESC');
while ($data = FDB::fetch($res)) {
$data['cache_data'] = unserialize($data['cache_data']);
FS('Share')->shareImageFormat($data);
unset($data['cache_data']);
foreach ($data['imgs'] as $img) {
$imags[] = $img;
if (count($imags) >= 6) {
break;
}
}
if (count($imags) >= 6) {
break;
}
}
$cache_data['imgs'] = $imags;
}
$cache_data = serialize($cache_data);
$album = array();
$album['share_count'] = $share_count;
$album['cache_data'] = $cache_data;
FDB::update('album', $album, 'id = ' . $aid);
}
示例15: updateShareCache
public function updateShareCache($share_id, $type = 'all')
{
$share_id = (int) $share_id;
if (!$share_id) {
return;
}
$share = FDB::fetchFirst('SELECT cache_data,share_data FROM ' . FDB::table('share') . ' WHERE share_id = ' . $share_id);
if (!$share) {
return;
}
$cache_data = fStripslashes(unserialize($share['cache_data']));
switch ($type) {
case 'tags':
$cache_data['tags'] = ShareService::getShareTags($share_id, true);
break;
case 'collects':
$cache_data['collects'] = ShareService::getShareCollectUser($share_id, 50);
break;
case 'comments':
$cache_data['comments'] = ShareService::getNewCommentIdsByShare($share_id, 10);
break;
case 'imgs':
$cache_data['imgs'] = ShareService::getShareImage($share_id, $share['share_data']);
break;
case 'all':
$cache_data['tags'] = ShareService::getShareTags($share_id, true);
$cache_data['collects'] = ShareService::getShareCollectUser($share_id, 50);
$cache_data['comments'] = ShareService::getNewCommentIdsByShare($share_id, 10);
$cache_data['imgs'] = ShareService::getShareImage($share_id, $share['share_data']);
break;
}
unset($share['share_data']);
$share['cache_data'] = addslashes(serialize($cache_data));
FDB::update("share", $share, 'share_id = ' . $share_id);
}