本文整理汇总了PHP中FDB::createIN方法的典型用法代码示例。如果您正苦于以下问题:PHP FDB::createIN方法的具体用法?PHP FDB::createIN怎么用?PHP FDB::createIN使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FDB
的用法示例。
在下文中一共展示了FDB::createIN方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAlbum
public function deleteAlbum($aid, $is_delete_share = false)
{
$aid = (int) $aid;
if (!$aid) {
return false;
}
$album = AlbumService::getAlbumById($aid);
if (empty($album)) {
return false;
}
if ($is_delete_share) {
$res = FDB::query('SELECT share_id FROM ' . FDB::table('album_share') . ' WHERE album_id = ' . $aid);
while ($data = FDB::fetch($res)) {
AlbumService::deleteAlbumItem($data['share_id'], false);
}
}
FDB::delete('album', 'id = ' . $aid);
FDB::delete('album_best', 'album_id = ' . $aid);
FDB::delete('album_share', 'album_id = ' . $aid);
FDB::delete('album_tags_related', 'album_id = ' . $aid);
if (!empty($album['flash_img'])) {
@unlink(FANWE_ROOT . $album['flash_img']);
}
if (!empty($album['best_img'])) {
@unlink(FANWE_ROOT . $album['best_img']);
}
if (!empty($album['tags'])) {
FDB::query('UPDATE ' . FDB::table('album_tags') . " SET album_count = album_count - 1 WHERE tag_name " . FDB::createIN($album['tags']));
}
FS('Share')->deleteShare($album['share_id']);
FDB::query('UPDATE ' . FDB::table('user_count') . ' SET
albums = albums - 1
WHERE uid = ' . $album['uid']);
FDB::query('UPDATE ' . FDB::table('share') . " SET type = 'default' \r\n\t\t\tWHERE rec_id = " . $aid . " AND type IN ('album_item','album_best','album_rec')");
FS('Medal')->runAuto($album['uid'], 'albums');
}
示例2: maybe
public function maybe()
{
global $_FANWE;
$home_uid = $_FANWE['home_uid'];
$home_user = FS('User')->getUserById($home_uid);
$user_names = FS('User')->getUserShowName($home_uid);
FanweService::instance()->cache->loadCache('forums');
$page_args = array('uid' => $home_uid);
$current_menu = 'topic';
$follow_uids = array();
$sql = 'SELECT uid
FROM ' . FDB::table('user_follow') . '
WHERE f_uid = ' . $home_uid . '
GROUP BY uid';
$res = FDB::query($sql);
while ($data = FDB::fetch($res)) {
$follow_uids[] = $data['uid'];
}
if (count($follow_uids) > 0) {
$sql = 'SELECT COUNT(tid)
FROM ' . FDB::table('forum_thread') . '
WHERE uid ' . FDB::createIN($follow_uids);
$count = FDB::resultFirst($sql);
$pager = buildPage('u/' . ACTION_NAME, $page_args, $count, $_FANWE['page'], 10);
$thread_list = array();
$res = FDB::query('SELECT ft.*,s.cache_data FROM ' . FDB::table('forum_thread') . ' AS ft
INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = ft.share_id
WHERE ft.uid ' . FDB::createIN($follow_uids) . ' ORDER BY ft.tid DESC LIMIT ' . $pager['limit']);
while ($thread = FDB::fetch($res)) {
$thread['cache_data'] = fStripslashes(unserialize($thread['cache_data']));
$thread['url'] = FU('club/detail', array('tid' => $thread['tid']));
$thread['time'] = getBeforeTimelag($thread['create_time']);
$thread['cate'] = $_FANWE['cache']['forums']['all'][$thread['fid']];
FS('Share')->shareImageFormat($thread);
unset($thread['cache_data']);
$thread_list[$thread['share_id']] = $thread;
}
}
include template('page/u/u_topic');
display();
}
示例3: getUsersByName
/**
* 根据会员名称获取会员列表
* @param array $user_names 名称数组
* @return array
*/
public function getUsersByName($user_names)
{
if (is_array($user_names)) {
return FDB::fetchAll('SELECT uid,user_name
FROM ' . FDB::table('user') . '
WHERE user_name ' . FDB::createIN($user_names));
} else {
return FDB::fetchFirst('SELECT uid,user_name
FROM ' . FDB::table('user') . "\r\n\t\t\t\tWHERE user_name = '{$user_names}'");
}
}
示例4: m_express
function m_express($obj, $content)
{
global $_FANWE;
$obj['parse_expres'] = array();
$express = getCache('m_emotion_express_cache');
//缓存过的表情hash
if ($express === NULL) {
$express = array();
$res = FDB::query("select `emotion`,concat('" . $_FANWE['site_url'] . "public/expression/',`type`,'/',`filename`) as fname from " . FDB::table('expression'));
while ($data = FDB::fetch($res)) {
$express[$data['emotion']] = $data['fname'];
}
setCache('m_emotion_express_cache', $express);
}
preg_match_all("/(\\[[^\f\n\r\t\v\\[\\] ]{2,20}?\\])/", $content, $exps);
if (!empty($exps[1])) {
$exps = array_unique($exps[1]);
foreach ($exps as $exp) {
if (!empty($exp) && isset($express[$exp])) {
//$obj['parse_expres'][$exp] = $express[$exp];
$obj['parse_expres'][] = array('key' => $exp, 'value' => $express[$exp], 'width' => 24, 'height' => 24);
}
}
}
$obj['parse_user'] = array();
preg_match_all("/@([^\f\n\r\t\v@<> ]{2,20}?)(?:\\:| )/", $content, $users);
if (!empty($users[1])) {
$patterns = array();
$replace = array();
$users = array_unique($users[1]);
$arr = array();
foreach ($users as $user) {
if (!empty($user)) {
$arr[] = addslashes($user);
}
}
$res = FDB::query('SELECT uid,user_name
FROM ' . FDB::table('user') . '
WHERE user_name ' . FDB::createIN($arr));
while ($data = FDB::fetch($res)) {
//$obj['parse_user'][$data['user_name']] = $data['uid'];
$obj['parse_user'][] = array('key' => $data['user_name'], 'value' => $data['uid']);
}
}
$obj['parse_events'] = array();
preg_match_all("/#([^\f\n\r\t\v]{1,80}?)#/", $content, $events);
if (!empty($events[1])) {
$patterns = array();
$replace = array();
$events = array_unique($events[1]);
$arr = array();
foreach ($events as $event) {
if (!empty($event)) {
$arr[] = addslashes($event);
}
}
$res = FDB::query('SELECT id,title
FROM ' . FDB::table('event') . '
WHERE title ' . FDB::createIN($arr));
while ($data = FDB::fetch($res)) {
//$obj['parse_events'][$data['title']] = $data['id'];
$obj['parse_events'][] = array('key' => $data['title'], 'value' => $data['id']);
}
}
}
示例5: getAdvPosition
/**
* 显示指定ID的广告位ID
* @param string $id 广告位
* @param int $count 显示数量
* @param string $target 关键字
* @return array
*/
function getAdvPosition($id, $count = '', $target = '')
{
global $_FANWE;
$ap = FDB::fetchFirst('SELECT * FROM ' . FDB::table('adv_position') . ' WHERE id =' . $id);
if (!$ap) {
return '';
}
if ($target != '') {
$target = explode(',', $target);
}
$where = "status = 1 AND position_id = '{$id}'";
if ($target != '') {
$where .= ' AND target_key' . FDB::createIN($target);
}
$sql = 'SELECT * FROM ' . FDB::table('adv') . ' WHERE ' . $where . ' ORDER BY sort ASC,id DESC';
if ($count > 0) {
$sql .= ' LIMIT 0,' . $count;
}
$adv_res = FDB::query($sql);
$adv_list = array();
while ($adv = FDB::fetch($adv_res)) {
$adv['html'] = getAdvHTML($adv, $ap);
$adv['durl'] = FU("adv/show", array("id" => $adv['id']));
$adv['turl'] = $adv['url'];
$adv['url'] = urlencode(FU("adv/show", array("id" => $adv['id'])));
$adv_list[] = $adv;
}
$ap['adv_list'] = $adv_list;
return $ap;
}
示例6: save
//.........这里部分代码省略.........
$share_match['content_match'] = segmentToUnicode(clearSymbol($content_match));
FDB::insert("share_match", $share_match);
}
ShareService::updateShareCache($share_id);
if ($share_data_rec_id > 0) {
$album_share = array();
$album_share['album_id'] = $share_data_rec_id;
$album_share['share_id'] = $share_id;
$album_share['cid'] = $share_data_rec_cate;
$album_share['create_day'] = getTodayTime();
FDB::insert("album_share", $album_share);
FS('Album')->updateAlbumByShare($share_data_rec_id, $share_id);
FS('Album')->updateAlbum($share_data_rec_id);
}
if (count($shop_ids) > 0) {
FS("Shop")->updateShopStatistic($shop_ids);
}
//保存提到我的
$atme_share_type = FDB::resultFirst("select `type` from " . FDB::table("share") . " where `share_id`='" . $share_id . "'");
if ($atme_share_type != "fav") {
$atme_list = array();
$pattern = "/@([^\f\n\r\t\v@ ]{2,20}?)(?:\\:| )/";
preg_match_all($pattern, $share_data['content'], $atme_list);
if (!empty($atme_list[1])) {
$atme_list[1] = array_unique($atme_list[1]);
$users = array();
foreach ($atme_list[1] as $user) {
if (!empty($user)) {
$users[] = $user;
}
}
$res = FDB::query('SELECT uid
FROM ' . FDB::table('user') . '
WHERE user_name ' . FDB::createIN($users));
while ($data = FDB::fetch($res)) {
FS("User")->setUserTips($data['uid'], 4, $share_id);
}
}
}
if ($is_score && !in_array($share_data_now_type, array('fav', 'album_best', 'album_rec'))) {
if (!$is_rel_imgage && in_array($share_data_type, array('goods', 'photo', 'goods_photo'))) {
FS("User")->updateUserScore($share_data['uid'], 'share', 'image', $share_data['content'], $share_id);
} else {
FS("User")->updateUserScore($share_data['uid'], 'share', 'default', $share_data['content'], $share_id);
}
}
if ($data['pub_out_check']) {
$weibo = array();
$weibo['content'] = $share_data['content'];
$weibo['img'] = $weibo_img;
$weibo['ip'] = $_FANWE['client_ip'];
$weibo['url'] = $_FANWE['site_url'] . FU('note/index', array('sid' => $share_id));
$weibo['url'] = str_replace('//', '/', $weibo['url']);
$weibo['url'] = str_replace(':/', '://', $weibo['url']);
$weibo = base64_encode(serialize($weibo));
if (empty($share_data['type'])) {
$share_data['type'] = 'default';
}
//转发到外部微博
$uid = $_FANWE['uid'];
$user_binds = FS("User")->getUserBindList($uid);
$is_open = false;
foreach ($user_binds as $class => $bind) {
if ($bind['sync'] && file_exists(FANWE_ROOT . "login/" . $class . ".php")) {
$check_field = "";
if (in_array($share_data['type'], array('bar', 'ask'))) {
示例7: sendMsg
/**
* 发送信息
* @param int $fuid 发信会员编号
* @param string $fusername 发信会员名称
* @param array $tuids 收信会员编号数组
* @param string $subject 信件主题
* @param string $message 信件内容
* @param int $type 信件类型
* @return int
*/
public function sendMsg($fuid, $fusername, $tuids, $subject, $message, $type = 0)
{
if (empty($fuid) || empty($fusername) || empty($tuids) || empty($message)) {
return 0;
}
//清除重复会员编号
$tuids = array_unique($tuids);
$relations = $mlids = array();
$tmp_tuids = $tuids;
foreach ($tmp_tuids as $key => $uid) {
if ($fuid == $uid || empty($uid)) {
unset($tuids[$key]);
continue;
}
$relations[$uid] = MessageService::getRelation($fuid, $uid);
}
if (empty($tuids)) {
return MSG_SEND_NONE_ERROR;
}
if (!$subject) {
$subject = htmlspecialchars(cutStr(clearExpress(trim($message)), 80));
} else {
$subject = htmlspecialchars($subject);
}
$last_msg = htmlspecialchars(cutStr(clearExpress(trim($message)), 150));
$type = 0;
if ($type == 0) {
$res = FDB::query('SELECT mlid,min_max FROM ' . FDB::table('user_msg_list') . " WHERE min_max" . FDB::createIN($relations));
while ($data = FDB::fetch($res)) {
$mlids[$data['min_max']] = $data['mlid'];
}
$msg_config = array('last_uid' => $fuid, 'last_user_name' => $fusername, 'last_msg' => $last_msg);
$msg_config = addslashes(serialize($msg_config));
foreach ($relations as $key => $value) {
if (!isset($mlids[$value])) {
FDB::query("INSERT INTO " . FDB::table('user_msg_list') . "(uid,type,subject,members,min_max,dateline,msg_config) VALUES('{$fuid}', '1', '{$subject}', 2, '{$value}', '" . TIME_UTC . "', '{$msg_config}')");
$mlid = FDB::insertId();
FDB::query("INSERT INTO " . FDB::table('user_msg_index') . "(mlid) VALUES('{$mlid}')");
$miid = FDB::insertId();
FDB::query("INSERT INTO " . MessageService::getTablaName($mlid) . "(miid,mlid,uid,message,dateline,status) VALUES('{$miid}', '{$mlid}', '{$fuid}', '{$message}', '" . TIME_UTC . "', 0)");
FDB::query("INSERT INTO " . FDB::table('user_msg_member') . "(mlid, uid, is_new, num, last_update, last_dateline) VALUES('{$mlid}', '{$key}', '1', '1', '0', '" . TIME_UTC . "')");
FDB::query("INSERT INTO " . FDB::table('user_msg_member') . "(mlid, uid, is_new, num, last_update, last_dateline) VALUES('{$mlid}', '{$fuid}', '0', '1', '" . TIME_UTC . "', '" . TIME_UTC . "')");
} else {
$mlid = $mlids[$value];
FDB::query("INSERT INTO " . FDB::table('user_msg_index') . "(mlid) VALUES('{$mlid}')");
$miid = FDB::insertId();
FDB::query("INSERT INTO " . MessageService::getTablaName($mlid) . "(miid,mlid,uid,message,dateline,status) VALUES('{$miid}', '{$mlid}', '{$fuid}', '{$message}', '" . TIME_UTC . "', 0)");
$result = FDB::query("INSERT INTO " . FDB::table('user_msg_member') . "(mlid, uid, is_new, num, last_update, last_dateline) VALUES('{$mlid}', '{$key}', '1', '1', '0', '" . TIME_UTC . "')", 'SILENT');
if (!$result) {
FDB::query("UPDATE " . FDB::table('user_msg_member') . " SET is_new = 1, num = num + 1, last_dateline='" . TIME_UTC . "' WHERE mlid='{$mlid}' AND uid='{$key}'");
}
$result = FDB::query("INSERT INTO " . FDB::table('user_msg_member') . "(mlid, uid, is_new, num, last_update, last_dateline) VALUES('{$mlid}', '{$fuid}', '0', '1', '" . TIME_UTC . "', '" . TIME_UTC . "')", 'SILENT');
if (!$result) {
FDB::query("UPDATE " . FDB::table('user_msg_member') . " SET is_new = 1, num = num + 1, last_update='" . TIME_UTC . "', last_dateline='" . TIME_UTC . "' WHERE mlid='{$mlid}' AND uid='{$fuid}'");
}
FDB::query("UPDATE " . FDB::table('user_msg_list') . " SET msg_config='{$msg_config}' WHERE mlid='{$mlid}'");
}
}
} else {
}
foreach ($tuids as $uid) {
$result = FDB::query("INSERT INTO " . FDB::table('user_notice') . "(uid, type, num, create_time) VALUES('{$uid}',5,1,'" . TIME_UTC . "')", 'SILENT');
if (!$result) {
FDB::query("UPDATE " . FDB::table('user_notice') . " SET num = num + 1, create_time='" . TIME_UTC . "' WHERE uid='{$uid}' AND type=5");
}
}
return $miid;
}
示例8: while
GROUP BY parent_id
ORDER BY parent_id DESC LIMIT ' . $limit;
$next_sql = 'SELECT parent_id
FROM ' . FDB::table("share") . '
WHERE type = \'fav\' AND uid = ' . $home_uid . '
GROUP BY parent_id
ORDER BY parent_id DESC LIMIT ' . $next_limit;
$res = FDB::query($sql);
while ($data = FDB::fetch($res)) {
$fav_share_ids[] = $data['parent_id'];
}
$share_list = array();
if (count($fav_share_ids) > 0) {
$sql = 'SELECT *
FROM ' . FDB::table("share") . '
WHERE share_id ' . FDB::createIN($fav_share_ids) . ' and share_data <> ' . " 'default' \r\n\t\t\t\tGROUP BY share_id ORDER BY share_id DESC LIMIT 0,10";
$share_list = FDB::fetchAll($sql);
$share_list = FS('Share')->getShareDetailList($share_list, true, true, true);
}
$hasNextPage = FDB::fetchAll($next_sql);
if ($hasNextPage) {
$is_next = 1;
} else {
$is_next = 0;
}
$share_list = FDB::fetchAll($sql);
$scale = 1;
if ($share_list) {
$share_list = FS('Share')->getShareDetailList($share_list, false, false, false, true, 2);
$list = array();
$current_user = array();
示例9: m_express
function m_express($content)
{
global $_FANWE;
$express = getCache('m_emotion_express_cache');
//缓存过的表情hash
if (!$express) {
$express_rs = FDB::fetchAll("select `emotion`,concat('" . $_FANWE['site_url'] . "public/expression/',`type`,'/',`filename`) as fname from " . FDB::table('expression'));
foreach ($express_rs as $k => $row) {
$express[0][] = $row['emotion'];
$express[1][] = "<img src='" . $row['fname'] . "' title='" . preg_replace("/[\\[\\]]/", '', $row['emotion']) . "' />";
}
setCache('m_emotion_express_cache', $express);
}
$content = str_replace($express[0], $express[1], $content);
$parse_user = array();
preg_match_all("/@([^\f\n\r\t\v@<> ]{2,20}?)(?:\\:| )/", $content, $users);
if (!empty($users[1])) {
$patterns = array();
$replace = array();
$users = array_unique($users[1]);
$arr = array();
foreach ($users as $user) {
if (!empty($user)) {
$arr[] = addslashes($user);
}
}
$res = FDB::query('SELECT uid,user_name
FROM ' . FDB::table('user') . '
WHERE user_name ' . FDB::createIN($arr));
while ($data = FDB::fetch($res)) {
$parse_user[$data['user_name']] = $data['uid'];
}
}
$parse_events = array();
preg_match_all("/#([^\f\n\r\t\v]{1,80}?)#/", $content, $events);
if (!empty($events[1])) {
$patterns = array();
$replace = array();
$events = array_unique($events[1]);
$arr = array();
foreach ($events as $event) {
if (!empty($event)) {
$arr[] = addslashes($event);
}
}
$res = FDB::query('SELECT id,title
FROM ' . FDB::table('event') . '
WHERE title ' . FDB::createIN($arr));
while ($data = FDB::fetch($res)) {
$parse_events[$data['title']] = $data['id'];
}
}
return array("users" => $parse_user, "events" => $parse_events);
}