f (!empty($uidarr)) {
$uids = array();
$update = array();
foreach ($uidarr as $_uid => $n) {
$uids[] = $_uid;
$update[$_uid] = array('articles-' => $n);
'mysql' != $conf['cache']['type'] and cache_delete('user-' . $_uid);
}
user_big_update(array('uid' => $uids), $update);
}
!empty($operate_create) && function_exists('operate_big_insert') and operate_big_insert($operate_create);
return TRUE;
}
// 大数据量容易超时 删除用户时使用,删除主题 回复 栏目统计 附件 全站统计
function well_thread_delete_all_by_uid($uid)
{
// 用户主题数
$user = user_read_cache($uid);
set_time_limit(0);
// 删除所有回复
if ($user['comments']) {
$postist = comment_pid_find_by_uid($uid, 1, $user['comments'], FALSE);
$pidarr = array();
foreach ($postist as $val) {
$pidarr[] = $val['pid'];
}
unset($postist);
!empty($pidarr) and comment_delete_by_pids($pidarr);
}
if ($user['articles']) {
// 如果主题、附件和回复数量太大会超时
$tidlist = thread_tid_find_by_uid($uid, 1, $user['articles'], FALSE, 'tid', array('tid'));
$tidarr = array();
foreach ($tidlist as $val) {
$tidarr[] = $val['tid'];
}
unset($tidlist);
!empty($tidarr) and well_thread_delete_all($tidarr);
}
return TRUE;
}
// 搜索标题
function well_thread_find_by_keyword($keyword, $d = NULL)
{
if (empty($keyword)) return NULL;
$db = $_SERVER['db'];
$d = $d ? $d : $db;
if (!$d) return FALSE;
$threadlist = db_sql_find("SELECT * FROM `{$d->tablepre}website_thread` WHERE subject LIKE '%$keyword%' LIMIT 60;", 'tid', $d);
if ($threadlist) {
$threadlist = arrlist_multisort($threadlist, 'tid', FALSE);
foreach ($threadlist as &$thread) {
well_thread_format($thread);
// 关键词标色
//$thread['subject'] = comment_highlight_keyword($thread['subject'], $keyword);
}
}
return $threadlist;
}
// 查找 最后评论 lastpid
function well_thread_find_lastpid($tid)
{
$arr = comment_pid_read(array('tid' => $tid), array('pid' => -1), array('pid'));
$lastpid = empty($arr) ? 0 : $arr['pid'];
return $lastpid;
}
// 更新最后的 uid
function well_thread_update_last($tid)
{
if (empty($tid)) return FALSE;
$lastpid = well_thread_find_lastpid($tid);
if (empty($lastpid)) return FALSE;
$lastpost = comment_read($lastpid);
if (empty($lastpost)) return FALSE;
$r = well_thread_update($tid, array('lastuid' => $lastpost['uid']));
return $r;
}
function well_thread_maxid()
{
$n = db_maxid('website_thread', 'tid');
return $n;
}
// 主题状态 0:通过 1~9 审核:1待审核 10~19:10退稿 11逻辑删除
function well_thread_format(&$thread)
{
global $gid, $uid, $forumlist;
$conf = _SERVER('conf');
if (empty($thread)) return;
$thread['create_date_fmt'] = humandate($thread['create_date']);
$thread['last_date_fmt'] = humandate($thread['last_date']);
$thread['create_date_fmt_ymd'] = date('Y-m-d', $thread['create_date']);
$thread['last_date_fmt_ymd'] = date('Y-m-d', $thread['last_date']);
$user = user_read_cache($thread['uid']);
$onlinelist = online_user_list_cache();
$user['online_status'] = isset($onlinelist[$user['uid']]) ? 1 : 0;
$thread['username'] = $user['username'];
$thread['user_avatar_url'] = array_value($user, 'avatar_url');
$thread['user'] = user_safe_info($user);
unset($user);
$forum = array_value($forumlist, $thread['fid']);
$thread['forum_name'] = array_value($forum, 'name');
$thread['forum_url'] = array_value($forum, 'url');
if ($thread['last_date'] == $thread['create_date']) {
$thread['last_date_fmt'] = '';
$thread['lastuid'] = 0;
$thread['lastusername'] = '';
} else {
$lastuser = $thread['lastuid'] ? user_read_cache($thread['lastuid']) : array();
$thread['lastusername'] = $thread['lastuid'] ? $lastuser['username'] : lang('guest');
$thread['lastuser'] = $thread['lastuid'] ? user_safe_info($lastuser) : array();
unset($lastuser);
}
$thread['url'] = url('read-' . $thread['tid'], '', FALSE);
if ($conf['url_rewrite_on'] > 1) {
!empty($forum['well_alias']) and $thread['url'] = url(urlencode($forum['well_alias'])."-$thread[create_date]a$thread[tid]", '', FALSE);
} else {
$thread['url'] = url("read-$thread[create_date]a$thread[tid]", '', FALSE);
}
$thread['user_url'] = url('user-' . $thread['uid']);
$thread['sticky_class'] = '';
if ($thread['sticky'] > 0) {
if (1 == $thread['sticky']) {
$thread['sticky_class'] = 'success';
} elseif (2 == $thread['sticky']) {
$thread['sticky_class'] = 'warning';
} elseif (3 == $thread['sticky']) {
$thread['sticky_class'] = 'danger';
}
}
$nopic = view_path() . 'img/nopic.png';
if ($thread['icon']) {
$attach_dir_save_rule = array_value($conf, 'attach_dir_save_rule', 'Ym');
$day = date($attach_dir_save_rule, $thread['icon']);
$thread_format_icon_default = 1;
if (1 == $thread_format_icon_default) {
// 本地文件绝对路径
$destfile = $conf['upload_path'] . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
// 本地
$thread['icon_fmt'] = is_file($destfile) ? file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg' : $nopic;
if (1 == $conf['attach_on'] && 1 == $thread['attach_on']) {
// 云储存
$thread['icon_fmt'] = file_path($thread['attach_on']) . 'thumbnail/' . $day . '/' . $thread['uid'] . '_' . $thread['tid'] . '_' . $thread['icon'] . '.jpeg';
} elseif (2 == $conf['attach_on'] && 2 == $thread['attach_on']) {
// 图床 未上传成功 本地图片在的话使用本地,不在则默认
$thread['icon_fmt'] = $thread['image_url'] ? $thread['image_url'] : $thread['icon_fmt'];
}
}
} else {
$thread['icon_fmt'] = $nopic;
}
// 回复页面
$thread['pages'] = ceil($thread['posts'] / $conf['comment_pagesize']);
$thread['tag_fmt'] = $thread['tag'] ? xn_json_decode($thread['tag']) : '';
// 权限判断
$thread['allowupdate'] = ($uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowupdate');
$thread['allowdelete'] = (group_access($gid, 'allowuserdelete') and $uid == $thread['uid']) || forum_access_mod($thread['fid'], $gid, 'allowdelete');
$thread['allowtop'] = forum_access_mod($thread['fid'], $gid, 'allowtop');
$thread = well_thread_safe_info($thread);
}
function well_thread_format_last_date(&$thread)
{
if ($thread['last_date'] != $thread['create_date']) {
$thread['last_date_fmt'] = humandate($thread['last_date']);
} else {
$thread['create_date_fmt'] = humandate($thread['create_date']);
}
}
// 对 $threadlist 权限过滤
function well_thread_list_access_filter(&$threadlist, $gid)
{
global $forumlist;
if (empty($threadlist)) return NULL;
foreach ($threadlist as $tid => $thread) {
if (empty($forumlist[$thread['fid']]['accesson'])) continue;
if ($thread['sticky'] > 0) continue;
if (!forum_access_user($thread['fid'], $gid, 'allowread')) {
unset($threadlist[$tid]);
}
}
}
function well_thread_safe_info($thread)
{
unset($thread['userip'], $thread['user']['threads'], $thread['user']['posts'], $thread['user']['credits'], $thread['user']['golds'], $thread['user']['money']);
empty($thread['user']) || $thread['user'] = user_safe_info($thread['user']);
return $thread;
}
// 过滤安全数据
function well_thread_filter(&$val)
{
unset($val['userip'], $val['fid'], $val['flagid'], $val['type'], $val['user'], $val['create_date']);
}
//------------------------ 其他方法 ------------------------
// 集合主题tid,统一拉取,避免多次查询thread表
function thread_unified_pull($arr)
{
global $gid, $fid;
$stickylist = array_value($arr, 'stickylist', array());
$tidlist = array_value($arr, 'tidlist', array());
//$fid = array_value($arr, 'fid');
// 合并过滤空数组
//$tidlist = array_filter($stickylist + $tidlist);
$tidarrlist = $tidlist = $stickylist + $tidlist;
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidarrlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidarrlist) ? array() : arrlist_values($tidarrlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$arrlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($arrlist, $gid);
$threadlist = array();
foreach ($arrlist as $_tid => &$_thread) {
$_thread = well_thread_safe_info($_thread);
// 归类列表数据
isset($tidlist[$_thread['tid']]) and $threadlist[$_tid] = $_thread;
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
// 按之前tidlist排序
$threadlist = array2_sort_key($threadlist, $tidlist, 'tid');
unset($arrlist, $tidlist);
$arr = array('threadlist' => $threadlist, 'flaglist' => $flaglist);
return $arr;
}
// read.php 详情页其他主题调用,集合tid统一拉取数据,最后归类
function thread_other_pull($thread)
{
global $forumlist, $gid;
$fid = array_value($thread, 'fid');
$forum = array_value($forumlist, $fid);
if (empty($forum)) return NULL;
//$tid = array_value($thread, 'tid');
//$tag_fmt = array_value($thread, 'tag_fmt');
$arrlist = array();
$tidlist = array();
// 版块自定义
list($flaglist, $flagtids) = flag_thread_by_fid($fid);
empty($flagtids) || $tidlist += $flagtids;
unset($flagtids);
// 在这之前合并所有二维数组 tid值为键/array('tid值' => tid值)
$tidarr = empty($tidlist) ? array() : arrlist_values($tidlist, 'tid');
// 在这之前使用array_merge()前合并所有一维数组 tid/array(1,2,3)
if (empty($tidarr)) return NULL;
$tidarr = array_unique($tidarr);
// 主题相关统一遍历后再归类
$threadlist = well_thread_find($tidarr, count($tidarr));
// 过滤没有权限访问的主题 / filter no permission thread
well_thread_list_access_filter($threadlist, $gid);
foreach ($threadlist as &$_thread) {
$_thread = well_thread_safe_info($_thread);
// flag thread
if (!empty($flaglist)) {
foreach ($flaglist as $key => $val) {
if (isset($val['tids']) && in_array($_thread['tid'], $val['tids'])) {
$flaglist[$key]['list'][array_search($_thread['tid'], $val['tids'])] = $_thread;
ksort($flaglist[$key]['list']);
}
}
}
}
unset($threadlist);
if (!empty($flaglist)) {
foreach ($flaglist as &$val) {
$i = 0;
if (!isset($val['list'])) continue;
foreach ($val['list'] as &$v) {
++$i;
$v['i'] = $i;
}
}
$arrlist['flaglist'] = $flaglist;
unset($flaglist);
}
return $arrlist;
}
//--------------------------cache--------------------------
// 已格式化 从缓存中读取,避免重复从数据库取数据
function well_thread_read_cache($tid)
{
global $conf;
$key = 'website_thread_' . $tid;
static $cache = array(); // 用静态变量只能在当前 request 生命周期缓存,跨进程需要再加一层缓存:redis/memcached/xcache/apc
if (isset($cache[$key])) return $cache[$key];
if ('mysql' == $conf['cache']['type']) {
$r = well_thread_read($tid);
} else {
$r = cache_get($key);
if (NULL === $r) {
$r = well_thread_read($tid);
$r and cache_set($key, $r, 1800);
}
}
$cache[$key] = $r ? $r : NULL;
return $cache[$key];
}
?>
2018年,如下几件事或许值得期待编程频道|福州电脑网
2018年,如下几件事或许值得期待
编程之家600
更新时间:2026-04-10 02:32:15 2017年已经远去,2018已经到来,从去年整个IT产业的发展来看,不乏亮点,但也有很多事情未尘埃落定,因此,在2018年初,笔者斗胆对今年的几个大事进行预测,或许如下几件事值得大家期待。
一,比特币崩盘?
2017年比特币迎来了一波罕见的牛市,年初比特币尚在1000美元水平,但到年底一路走高达到20000美元水平,如此强势的上涨引发了全球对比特币泡沫的担忧,有投资者认为,比特币泡沫已经超过了17世纪的荷兰郁金香泡沫,一旦泡沫破灭,后果不堪设想。
实际上,在年底比特币的波动就明显加大,曾从20000美元迅速暴跌至11000美元附近之后企稳反弹,目前的价格维持在15000美元左右。这不仅预示着比特币已经告别单边牛市,更重要的是,波动的加大也给“庄家”提供了出货的机会,一旦庄家完成出货,比特币崩盘的可能性很大。一般的投资者最好是“敬而远之”。
二,网约车大战?
最近,网约车大战有抬头重燃的趋势,随着美团打车大张旗鼓的在全国多个城市布局,与滴滴出行的一场大战在所难免。而且,现在的情况和几年前不同,美团打车撼动滴滴出行的几率还是挺高的。
首先,滴滴出行的名声不太好,尤其对司机而言,提成太多、对司机太苛刻等成为口诛笔伐的点,得知美团做打车业务后,很多司机愿意倒戈。换言之,美团打车如果能在上述两个层面有所作为,必然获得大量司机的拥趸。
其次,美团走的是对吃喝玩乐进行全面覆盖的路线,而这里面往往也伴随着出行诉求,也就是说,美团做打车不管能否对抗滴滴,都有助于其生态体系的完善。所以我认为美团涉足出行比滴滴涉足外卖要容易一些。
当然,滴滴也不是没有优势,在估值和资金储备上,滴滴比美团还是要强一些的。所以,应对美团的策略,依然是发起补贴大战,拖垮对手。那么滴滴和美团究竟鹿死谁手呢?拭目以待。
三,AI大战?
百度状告王劲一案在业界引发了强烈反响,抛开案件本身不说,百度此举的意图更值得推敲。众所周知,AI领域近年来日益成熟,已经成为巨头之间的新战场。在这种背景之下,AI大战也必然拉开帷幕,百度状告王劲似乎是“醉翁之意不在酒”。
实际上,王劲只是从百度出走的众多AI高管中的一位,对这些人而言,可选择的路无非两个,一是创业,一个是加盟其他企业。不过只要他继续从事无人驾驶方面的工作,就站在了百度的对立面上,而且,一旦王劲的公司被腾讯或者阿里投资,后果不堪设想。所以,百度此举有杀鸡儆猴的意味,毕竟AI是百度的下一个战略重点,不容有失。
四,共享单车上演“四国争霸”?
如今共享单车已形成摩拜OFO哈罗三足鼎立的局面,而最近又传出滴滴收购小蓝单车的消息,若此事石锤,那么共享单车必然会上演“四国争霸”。这意味着,趋于集中的共享单车市场将再一次陷入分裂局面。
在去年,投资者曾呼吁摩拜和OFO必须合并才能盈利,却被双方的管理层所否定,这意味着短期内共享单车没有合并可能。这对行业可能产生不利,在笔者看来,共享单车本身没有太高的技术含量,只能通过不断的烧钱圈市场,市场陷入分裂,那么烧钱的势头必然不会停止。
五,互联网金融泡沫破灭?
如今对互联网金融的质疑可谓是越来越多,最近钱宝网跑路、陆金所事件让我们再一次看到了互联网金融所存在的一些问题。与此同时,针对消费者所推出的各类消费贷、校园贷所引发的社会事件更是层出不穷。
从互联网金融的发展轨迹来看,其诞生的时间并不长,但发展却很快。目前国内已经有几家成功IPO的互联网金融公司,但我们发现,行业的快速发展伴随着很多不成熟、不理性的问题。首先,由于将传统金融搬到了互联网上,其门槛也有所降低,这就给某些不法分子提供了可乘之机,消费者稍不注意就可能入坑。而监管的不到位进一步加剧了互联网金融泡沫的严重性。那么在2018年,这类泡沫是否会破灭呢?拭目以待。
六,双面屏、全面屏手机将流行?
前不久上市的双面屏手机YOTA3在市场上引发了强烈反响,该产品通过创新实现了用户正面沟通外界背面沟通自己的双重需求,因此获得了消费者的青睐。在2018年,类似的产品可能还会不断涌现。
除双面屏之外,全面屏手机同样受欢迎,而且很多厂商也在推相关产品。而业界对这两种解决方案的看法不同,有的认为双面屏将抄全面屏的后路,但也有人不以为然。在笔者看来,绝大多数厂商应该会同时推两种产品,满足消费者的需求。(文/王易见 QQ:543415188,微信:543415188)
本文发布于:2024-10-16,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:值得期待几件事
发布评论