当前位置: 首页>>代码示例>>PHP>>正文


PHP FDB::resultFirst方法代码示例

本文整理汇总了PHP中FDB::resultFirst方法的典型用法代码示例。如果您正苦于以下问题:PHP FDB::resultFirst方法的具体用法?PHP FDB::resultFirst怎么用?PHP FDB::resultFirst使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FDB的用法示例。


在下文中一共展示了FDB::resultFirst方法的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);
 }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:34,代码来源:pwd.mapi.php

示例2: all

    public function all()
    {
        global $_FANWE;
        $is_best = false;
        $is_all = true;
        $_FANWE['nav_title'] = lang('common', 'daren');
        $count = FDB::resultFirst('SELECT COUNT(uid) FROM ' . FDB::table('user_daren') . ' WHERE status = 1');
        $pager = buildPage('daren/all', array(), $count, $_FANWE['page'], 18);
        $col = 3;
        $index = 0;
        $list = array();
        $today_time = getTodayTime();
        $sql = 'SELECT ud.*,u.user_name,u.server_code,uc.fans,uc.goods,uc.shares,
			up.reside_province,up.reside_city,up.introduce 
			FROM ' . FDB::table('user_daren') . ' AS ud 
			INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = ud.uid 
			INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = u.uid 
			INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = ud.uid 
			WHERE ud.status = 1 
			ORDER BY ud.day_time DESC,ud.id DESC LIMIT ' . $pager['limit'];
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $data['today_best'] = false;
            $data['url'] = FU('u/index', array('uid' => $data['uid']));
            $province = $_FANWE['cache']['citys']['all'][$data['reside_province']]['name'];
            $city = $_FANWE['cache']['citys']['all'][$data['reside_city']]['name'];
            $data['city'] = $province . ' ' . $city;
            $list[$index % $col][] = $data;
            $index++;
        }
        include template('page/daren');
        display();
    }
开发者ID:dalinhuang,项目名称:concourse,代码行数:33,代码来源:daren.module.php

示例3: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 1;
        $share_id = (int) $_FANWE['requestData']['share_id'];
        $page = (int) $_FANWE['requestData']['page'];
        $page = max(1, $page);
        $sql_count = "SELECT COUNT(DISTINCT comment_id) FROM " . FDB::table("share_comment") . " WHERE share_id = " . $share_id;
        $total = FDB::resultFirst($sql_count);
        $page_size = PAGE_SIZE;
        $page_total = ceil($total / $page_size);
        if ($page > $page_total) {
            $page = $page_total;
        }
        $limit = ($page - 1) * $page_size . "," . $page_size;
        $sql = 'SELECT c.*,u.user_name,u.server_code FROM ' . FDB::table('share_comment') . ' AS c 
			INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = c.uid 
			WHERE c.share_id = ' . $share_id . ' ORDER BY c.comment_id DESC LIMIT ' . $limit;
        $res = FDB::query($sql);
        $list = array();
        while ($item = FDB::fetch($res)) {
            $item['user_avatar'] = avatar($item['uid'], 'm', $item['server_code'], 1, true);
            $item['time'] = getBeforeTimelag($item['create_time']);
            m_express(&$item, $item['content']);
            $list[] = $item;
        }
        $root['item'] = $list;
        $root['page'] = array("page" => $page, "page_total" => $page_total);
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:31,代码来源:commentlist.mapi.php

示例4: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 1;
        $is_hot = (int) $_FANWE['requestData']['is_hot'];
        $is_new = (int) $_FANWE['requestData']['is_new'];
        $page = (int) $_FANWE['requestData']['page'];
        $page = max(1, $page);
        $today_time = getTodayTime();
        $field = '';
        $whrer = '';
        $book_photo_goods = (int) $_FANWE['setting']['book_photo_goods'];
        if ($book_photo_goods == 0) {
            $whrer = " WHERE share_data IN ('goods','photo','goods_photo')";
        } elseif ($book_photo_goods == 1) {
            $whrer = " WHERE share_data IN ('photo','goods_photo')";
        } elseif ($book_photo_goods == 2) {
            $whrer = " WHERE share_data IN ('goods','goods_photo')";
        }
        if ($is_hot == 1) {
            $day7_time = $today_time - 604800;
            $field = ",(create_time > {$day7_time}) AS time_sort ";
            $sort = " ORDER BY time_sort DESC,collect_count DESC";
        }
        if ($is_new == 1) {
            $sort = " ORDER BY share_id DESC";
        }
        $sql_count = "SELECT COUNT(DISTINCT share_id) FROM " . FDB::table("share");
        $total = FDB::resultFirst($sql_count);
        $page_size = PAGE_SIZE;
        $max_page = 100;
        if ($total > $max_page * $page_size) {
            $total = $max_page * $page_size;
        }
        if ($page > $max_page) {
            $page = $max_page;
        }
        $page_total = ceil($total / $page_size);
        $limit = ($page - 1) * $page_size . "," . $page_size;
        $sql = 'SELECT DISTINCT(share_id),cache_data ' . $field . '
					FROM ' . FDB::table('share') . $whrer . $sort . ' LIMIT ' . $limit;
        $res = FDB::query($sql);
        $share_list = array();
        while ($item = FDB::fetch($res)) {
            $cache_data = fStripslashes(unserialize($item['cache_data']));
            $img = current($cache_data['imgs']['all']);
            $data = array();
            $data['share_id'] = $item['share_id'];
            $data['img'] = getImgName($img['img'], 100, 999, 0, true);
            $data['height'] = $img['height'] * (100 / $img['width']);
            $share_list[] = $data;
        }
        $root['item'] = $share_list;
        $root['page'] = array("page" => $page, "page_total" => $page_total);
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:57,代码来源:sharelist.mapi.php

示例5: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 0;
        $uid = (int) $_FANWE['requestData']['uid'];
        if ($uid > 0) {
            if (!FS('User')->getUserExists($uid)) {
                $uid = 0;
            }
        }
        if ($uid == 0) {
            $uid = $_FANWE['uid'];
            $root['home_user'] = $_FANWE['user'];
        }
        if ($uid == 0) {
            $root['info'] = "请选择要查看的会员";
            m_display($root);
        }
        if (!isset($root['home_user'])) {
            $root['home_user'] = FS("User")->getUserById($uid);
            unset($root['home_user']['user_name_match'], $root['home_user']['password'], $root['home_user']['active_hash'], $root['home_user']['reset_hash']);
            $root['home_user']['user_avatar'] = avatar($uid, 'm', $root['home_user']['server_code'], 1, true);
        }
        $page = (int) $_FANWE['requestData']['page'];
        $page = max(1, $page);
        $is_spare_flow = (int) $_FANWE['requestData']['is_spare_flow'];
        $img_size = 200;
        $scale = 2;
        if ($is_spare_flow == 1) {
            $img_size = 100;
            $scale = 1;
        }
        $total = FDB::resultFirst('SELECT COUNT(photo_id) FROM ' . FDB::table('share_photo') . ' WHERE uid = ' . $uid);
        $page_size = 20;
        //PAGE_SIZE;
        $page_total = max(1, ceil($total / $page_size));
        if ($page > $page_total) {
            $page = $page_total;
        }
        $limit = ($page - 1) * $page_size . "," . $page_size;
        $photo_list = array();
        $res = FDB::query('SELECT photo_id,share_id,img 
			FROM ' . FDB::table('share_photo') . ' 
			WHERE uid = ' . $uid . ' ORDER BY photo_id DESC LIMIT ' . $limit);
        while ($photo = FDB::fetch($res)) {
            $photo['img'] = getImgName($photo['img'], $img_size, $img_size, 1, true);
            $photo['height'] = round($img_size / $scale);
            $photo['url'] = FU('note/m', array('sid' => $photo['share_id'], 'id' => $photo['photo_id']), true);
            $photo_list[] = $photo;
        }
        $root['return'] = 1;
        $root['item'] = $photo_list;
        $root['page'] = array("page" => $page, "page_total" => $page_total);
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:56,代码来源:photolist.mapi.php

示例6: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 1;
        $key = 'm/sharecate';
        $cache_list = getCache($key);
        if ($cache_list !== NULL || TIME_UTC - $cache_list['cache_time'] > 600) {
            $cate_list = array();
            $min_time = $this->getQuarterMinTime();
            $max_time = getTodayTime();
            FanweService::instance()->cache->loadCache('albums');
            $album_cate = $_FANWE['cache']['albums']['category'];
            foreach ($album_cate as $k => $v) {
                $cate = array();
                $cate['cate_id'] = $v['id'];
                $cate['cate_name'] = $v['name'];
                $cate['short_name'] = $v['name'];
                $cate['cate_code'] = $v['cate_code'];
                $cate['cate_icon'] = FS("Image")->getImageUrl($v['img'], 2);
                $cate['desc'] = $v['desc'];
                $cate['create_time'] = $v['create_time'];
                //获取本季分享数量
                $share_count_sql = 'select count(DISTINCT s.share_id) from ' . FDB::table("share") . ' as s 
					INNER JOIN ' . FDB::table("album_share") . ' as al on s.share_id = al.share_id where al.cid = ' . $v['id'] . " and s.day_time >= {$min_time} AND s.day_time <= {$max_time} ";
                $cate['share_count'] = FDB::resultFirst($share_count_sql);
                $cate['img_tags'] = array();
                $img_size = 320;
                $sql = 'select s.share_id,al.title,sp.img from ' . FDB::table("share") . ' as s
					INNER JOIN ' . FDB::table("album_share") . ' as als ON s.share_id = als.share_id 
					INNER JOIN ' . FDB::table("album") . ' as al ON als.album_id = al.id
					INNER JOIN ' . FDB::table("share_photo") . " as sp ON s.share_id = sp.share_id \r\n\t\t\t\t\tWHERE s.day_time >= {$min_time} AND s.day_time <= {$max_time} AND als.cid = " . $v['id'] . " GROUP BY s.share_id ORDER BY s.share_id desc limit 5";
                $res = FDB::query($sql);
                while ($data = FDB::fetch($res)) {
                    $img_data = array();
                    $img_data['share_id'] = $data['share_id'];
                    $img_data['tag_name'] = $data['title'];
                    $img_data['is_tag'] = 0;
                    $img_data['img'] = FS("Image")->getImageUrl(getImgName($data['img'], $img_size, $img_size, 1, true), 2);
                    $img_data['url_tag'] = urlencode($data['title']);
                    $cate['img_tags'][] = $img_data;
                    $img_size = 160;
                }
                $cate['txt_tags'] = array();
                $cate_list[] = $cate;
            }
            $cache_list = array();
            $cache_list['cate_list'] = $cate_list;
            $cache_list['cache_time'] = TIME_UTC;
            setCache($key, $cache_list);
        } else {
            $cate_list = $cache_list['cate_list'];
        }
        $root['item'] = $cate_list;
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:56,代码来源:sharecate.mapi.php

示例7: pm

 public function pm()
 {
     define("ACTION_NAME", "pm");
     if (intval($GLOBALS['fanwe']->var['uid']) == 0) {
         fHeader("location: " . FU('user/login'));
     }
     $uname = addslashes($_POST['uname']);
     $uid = intval(FDB::resultFirst("select uid from " . FDB::table("user") . " where user_name = '" . $uname . "'"));
     fHeader("location: " . FU('message/send', array('uid' => $uid)));
 }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:10,代码来源:message.module.php

示例8: searchShop

 public function searchShop()
 {
     vendor("common");
     $kw = trim($_REQUEST['kw']);
     $result['kw'] = $kw;
     $shop_list = FDB::fetchAll("select * from " . FDB::table("shop") . " where shop_name like '%" . $kw . "%' order by rand() limit 20 ");
     $shop_count = intval(FDB::resultFirst("select count(*) from " . FDB::table("shop") . " where shop_name like '%" . $kw . "%'"));
     $result['shop_list'] = $shop_list;
     $result['shop_count'] = $shop_count;
     die(json_encode($result));
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:11,代码来源:ShareGoodsAction.class.php

示例9: jumpUserBindReg

 public function jumpUserBindReg($data, $user_name)
 {
     do {
         $max_count = FDB::resultFirst('SELECT COUNT(*) FROM ' . FDB::table("user") . " WHERE user_name = '" . $user_name . "'");
         if ($max_count > 0) {
             $user_name = $user_name . '_' . random(3);
         }
     } while ($max_count > 0);
     $data['user_name'] = $user_name;
     $data = serialize($data);
     fSetCookie('bind_user_info', authcode($data, 'ENCODE'));
     fHeader("location:" . FU('user/bind'));
 }
开发者ID:yakrsa,项目名称:football,代码行数:13,代码来源:userbase.class.php

示例10: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 1;
        $page = (int) $_FANWE['requestData']['page'];
        $page = max(1, $page);
        $total = FDB::resultFirst('SELECT COUNT(id) FROM ' . FDB::table('user_daren') . ' WHERE status = 1');
        $page_size = PAGE_SIZE;
        $page_total = max(1, ceil($total / $page_size));
        if ($page > $page_total) {
            $page = $page_total;
        }
        $limit = ($page - 1) * $page_size . "," . $page_size;
        $user_follows = array();
        $res = FDB::query('SELECT u.uid,u.user_name,u.server_code,uc.fans,ud.reason,up.introduce 
				FROM ' . FDB::table('user_daren') . ' AS ud
				INNER JOIN ' . FDB::table('user') . ' AS u ON u.uid = ud.uid
				INNER JOIN ' . FDB::table('user_count') . ' AS uc ON uc.uid = ud.uid
				INNER JOIN ' . FDB::table('user_profile') . ' AS up ON up.uid = ud.uid 
				WHERE ud.status = 1 ORDER BY ud.id DESC LIMIT ' . $limit);
        while ($data = FDB::fetch($res)) {
            $data['user_avatar'] = avatar($data['uid'], 'm', $data['server_code'], 1, true);
            $data['desc'] = $data['introduce'];
            if (!empty($data['reason'])) {
                $data['desc'] = $data['reason'];
            }
            unset($data['server_code'], $data['introduce'], $data['reason']);
            if ($data['uid'] == $_FANWE['uid']) {
                $data['is_follow'] = -1;
            } else {
                $user_follows[$data['uid']] = 0;
                $data['is_follow'] = 0;
            }
            $user_list[$data['uid']] = $data;
        }
        $uids = array_keys($user_follows);
        $uids = implode(',', $uids);
        $uids = str_replace(',,', ',', $uids);
        if (!empty($uids)) {
            $res = FDB::query("SELECT uid FROM " . FDB::table('user_follow') . ' 
				WHERE f_uid = ' . $_FANWE['uid'] . ' AND uid IN (' . $uids . ')');
            while ($item = FDB::fetch($res)) {
                $user_list[$item['uid']]['is_follow'] = 1;
            }
        }
        $root['item'] = array_slice($user_list, 0);
        $root['page'] = array("page" => $page, "page_total" => $page_total);
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:50,代码来源:darens.mapi.php

示例11: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 0;
        $uid = $_FANWE['uid'];
        if ($uid == 0) {
            $root['info'] = "请先登陆";
            m_display($root);
        }
        $root['home_user'] = $_FANWE['user'];
        $page = (int) $_FANWE['requestData']['page'];
        $page = max(1, $page);
        $uids = array();
        //获取我关注的会员编号
        $sql = 'SELECT uid
			FROM ' . FDB::table('user_follow') . '
			WHERE f_uid = ' . $uid;
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $uids[] = (int) $data['uid'];
        }
        if (count($uids) > 0) {
            $sql = 'SELECT COUNT(share_id) FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ')';
            $total = FDB::resultFirst($sql);
            $page_size = PAGE_SIZE;
            $page_total = max(1, ceil($total / $page_size));
            if ($page > $page_total) {
                $page = $page_total;
            }
            $limit = ($page - 1) * $page_size . "," . $page_size;
            $share_list = array();
            $sql = 'SELECT * FROM ' . FDB::table("share") . ' WHERE uid IN (' . implode(',', $uids) . ') ORDER BY share_id DESC LIMIT ' . $limit;
            $share_list = FDB::fetchAll($sql);
            $share_list = mGetShareDetailList($share_list, true);
        } else {
            $page_total = 0;
            $share_list = array();
        }
        $root['return'] = 1;
        if (count($share_list) > 0) {
            $root['item'] = array_slice($share_list, 0);
        } else {
            $root['item'] = array();
        }
        $root['page'] = array("page" => $page, "page_total" => $page_total);
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:48,代码来源:ufollow.mapi.php

示例12: show

    public function show()
    {
        global $_FANWE;
        $id = (int) $_FANWE['request']['id'];
        if (!$id) {
            exit;
        }
        $shop = FDB::fetchFirst('SELECT * FROM ' . FDB::table('shop') . ' WHERE shop_id = ' . $id);
        if (!$shop) {
            fHeader("location: " . FU('shop/index'));
        }
        $_FANWE['nav_title'] = $shop['shop_name'] . ' - ' . $_FANWE['nav_title'];
        $cache_data = fStripslashes(unserialize($shop['data']));
        $shop['tags'] = $cache_data['tags'];
        if (empty($shop['taoke_url'])) {
            $shop['to_url'] = FU('tgo', array('url' => $shop['shop_url']));
        } else {
            $shop['to_url'] = FU('tgo', array('url' => $shop['taoke_url']));
        }
        $page_args['id'] = $id;
        $sql = 'SELECT COUNT(DISTINCT sg.share_id) FROM ' . FDB::table('share_goods') . ' AS sg 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id 
			WHERE s.status = 1 AND sg.shop_id = ' . $id;
        $share_count = FDB::resultFirst($sql);
        $page_size = 20;
        $pager = buildPage('shop/show', $page_args, $share_count, $_FANWE['page'], $page_size);
        $share_ids = array();
        $sql = 'SELECT DISTINCT sg.share_id FROM ' . FDB::table('share_goods') . ' AS sg 
			INNER JOIN ' . FDB::table('share') . ' AS s ON s.share_id = sg.share_id 
			WHERE s.status = 1 AND sg.shop_id = ' . $id . ' ORDER BY sg.share_id DESC LIMIT ' . $pager['limit'];
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $share_ids[] = $data['share_id'];
        }
        $share_list = array();
        if (count($share_ids) > 0) {
            $share_ids = implode(',', $share_ids);
            $sql = 'SELECT * FROM ' . FDB::table('share') . ' WHERE share_id IN (' . $share_ids . ') ORDER BY share_id DESC';
            $share_list = FDB::fetchAll($sql);
            $share_list = FS('Share')->getShareDetailList($share_list, false, true, true, false, 0, 10);
        }
        $shops_tags = FS('Shop')->getUserOtherShopAndTags($id);
        include template('page/shop/shop_show');
        display();
    }
开发者ID:dalinhuang,项目名称:concourse,代码行数:45,代码来源:shop.module.php

示例13: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 0;
        $uid = $_FANWE['uid'];
        if ($uid == 0) {
            $root['info'] = "请先登陆";
            m_display($root);
        }
        $root['home_user'] = $_FANWE['user'];
        FDB::query("DELETE FROM " . FDB::table('user_notice') . " WHERE uid='{$uid}' AND type=3");
        $page = (int) $_FANWE['requestData']['page'];
        $page = max(1, $page);
        $sql = 'SELECT COUNT(sc.comment_id)
			FROM ' . FDB::table("share") . ' AS s
			INNER JOIN ' . FDB::table("share_comment") . ' AS sc ON sc.share_id = s.share_id
			WHERE  s.uid = ' . $uid;
        $total = FDB::resultFirst($sql);
        $page_size = PAGE_SIZE;
        $page_total = max(1, ceil($total / $page_size));
        if ($page > $page_total) {
            $page = $page_total;
        }
        $limit = ($page - 1) * $page_size . "," . $page_size;
        $comment_list = array();
        $sql = 'SELECT sc.*,s.content as scontent,u.user_name,u.server_code 
			FROM ' . FDB::table("share") . ' AS s
			INNER JOIN ' . FDB::table("share_comment") . ' AS sc ON sc.share_id = s.share_id 
			INNER JOIN ' . FDB::table("user") . ' AS u ON u.uid = sc.uid 
			WHERE s.uid = ' . $uid . '
			ORDER BY comment_id DESC LIMIT ' . $limit;
        $res = FDB::query($sql);
        while ($data = FDB::fetch($res)) {
            $data['user_avatar'] = FS("Image")->getImageUrl('.' . avatar($data['uid'], 'm', 1), 2);
            $data['time'] = getBeforeTimelag($data['create_time']);
            $data['url'] = FU('note/index', array('sid' => $data['share_id']), true);
            m_express(&$data, $data['content'] . $data['scontent']);
            $comment_list[] = $data;
        }
        $root['return'] = 1;
        $root['item'] = $comment_list;
        $root['page'] = array("page" => $page, "page_total" => $page_total);
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:45,代码来源:ucommentlist.mapi.php

示例14: deleteEvent

 function deleteEvent($share_id)
 {
     $share_id = (int) $share_id;
     $event_id = (int) FDB::resultFirst("select id from " . FDB::table("event") . " \r\n\t\t\twhere share_id = {$share_id}");
     if ($event_id > 0) {
         $share = FDB::fetchFirst("select share_id,uid from " . FDB::table("event_share") . " \r\n\t\t\t\twhere event_id = {$event_id} order by share_id asc limit 0,1");
         if ($share) {
             $share_id = (int) $share['share_id'];
             $uid = (int) $share['uid'];
             FDB::query("update " . FDB::table("event") . " set thread_count = thread_count - 1,share_id = {$share_id},uid = {$uid} where id = {$event_id}");
             FDB::delete('event_share', 'share_id = ' . $share_id);
         } else {
             FDB::delete('event', 'id = ' . $event_id);
         }
     } else {
         FDB::delete('event_share', 'share_id = ' . $share_id);
         FDB::query("update " . FDB::table("event") . " set thread_count = thread_count - 1 where id = {$event_id}");
     }
 }
开发者ID:dalinhuang,项目名称:concourse,代码行数:19,代码来源:event.service.php

示例15: run

    public function run()
    {
        global $_FANWE;
        $root = array();
        $root['return'] = 0;
        $uid = $_FANWE['uid'];
        if ($uid == 0) {
            $root['info'] = "请先登陆";
            m_display($root);
        }
        $root['home_user'] = $_FANWE['user'];
        FDB::query("DELETE FROM " . FDB::table('user_notice') . " WHERE uid='{$uid}' AND type=4");
        $page = (int) $_FANWE['requestData']['page'];
        $page = max(1, $page);
        $sql = 'SELECT COUNT(*)
			FROM ' . FDB::table("share") . ' AS s
			LEFT JOIN ' . FDB::table("atme") . ' as a on a.share_id=s.share_id
			WHERE a.uid = ' . $uid . ' and s.uid <> ' . $uid . ' and s.type<>\'fav\' ';
        $total = FDB::resultFirst($sql);
        $page_size = PAGE_SIZE;
        $page_total = max(1, ceil($total / $page_size));
        if ($page > $page_total) {
            $page = $page_total;
        }
        $limit = ($page - 1) * $page_size . "," . $page_size;
        $share_list = array();
        $sql = 'SELECT s.*
			FROM ' . FDB::table("share") . ' AS s
			LEFT JOIN ' . FDB::table("atme") . ' as a on a.share_id=s.share_id
			WHERE a.uid = ' . $uid . ' and s.uid <> ' . $uid . ' and s.type<>\'fav\'
			ORDER BY s.share_id DESC LIMIT ' . $limit;
        $share_list = FDB::fetchAll($sql);
        $share_list = mGetShareDetailList($share_list, true);
        $root['return'] = 1;
        if (count($share_list) > 0) {
            $root['item'] = array_slice($share_list, 0);
        } else {
            $root['item'] = array();
        }
        $root['page'] = array("page" => $page, "page_total" => $page_total);
        m_display($root);
    }
开发者ID:BGCX261,项目名称:zhubao-tupu-svn-to-git,代码行数:42,代码来源:atmelist.mapi.php


注:本文中的FDB::resultFirst方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。