·设为首页收藏本站📧邮箱修改🎁免费下载专区💎积分✅卡密📒收藏夹👽聊天室
返回列表 发布新帖

Discuz home模块解析

258 0
发表于 2023-12-17 13:18:25 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
功能解析

home模块很庞大,包含了discuz论坛和用户信息相关的几乎所有功能,比如动态、消息、勋章、道具等等,有的功能还分为很多小功能,下面列出home模块基本的组成:

子模块

说明

space

用户个人空间相关的功能,如活动、相册、日志、收藏、好友、分享、悬赏等等

spacecp

用户个人空间相关功能的改动,如添加好友、发日志、收藏帖子等等

misc



magic
道具相关

editor

编辑器

invite

邀请相关

task

任务相关,如任务列表、申请任务、获取奖励、放弃任务等功能

medal

勋章相关,如勋章列表、申请勋章等功能

rss

网站信息聚合页

follow

广播相关


下面分别分析home模块的各个子模块:

rss模块

访问连接:home.php?mod=rss
此处的rss应该是指Really Simple Syndication(简易信息聚合),输出网站的信息和对应用户的个人动态信息(blog):
  1. //输出网站信息echo         "<?xml version="1.0" encoding="".$charset.""?>\n"."<rss version="2.0">\n"."  <channel>\n"."    <title>{$space[username]}</title>\n"."    <link>{$space[space_url]}</link>\n"."    <description>{$_G[setting][bbname]}</description>\n"."    <copyright>Copyright(C) {$_G[setting][bbname]}</copyright>\n"."    <generator>Discuz! Board by Comsenz Inc.</generator>\n"."    <lastBuildDate>".gmdate('r', TIMESTAMP)."</lastBuildDate>\n"."    <image>\n"."      <url>{$_G[siteurl]}static/image/common/logo_88_31.gif</url>\n"."      <title>{$_G[setting][bbname]}</title>\n"."      <link>{$_G[siteurl]}</link>\n"."    </image>\n";//输出用户个人动态,$data_blog是根据uid在home_blog表中获取的//$data_blog = C::t('home_blog')->range(0, $pagenum, 'DESC', 'dateline', 0, null, $uid);foreach($data_blog as $curblogid => $value) {$value = array_merge($value, (array)$data_blogfield[$curblogid]);$value['message'] = getstr($value['message'], 300, 0, 0, 0, -1);if($value['pic']) {$value['pic'] = pic_cover_get($value['pic'], $value['picflag']);$value['message'] .= "<br /><img src="$value[pic]">";}echo         "    <item>\n"."      <title>".$value['subject']."</title>\n"."      <link>$_G[siteurl]home.php?mod=space&uid=$value[uid]&do=blog&id=$value[blogid]</link>\n"."      <description><![CDATA[".dhtmlspecialchars($value['message'])."]]></description>\n"."      <author>".dhtmlspecialchars($value['username'])."</author>\n"."      <pubDate>".gmdate('r', $value['dateline'])."</pubDate>\n"."    </item>\n";}echo         "  </channel>\n"."</rss>";
复制代码
medal模块

访问连接:home.php?mod=medal
medal模块即勋章模块,这个模块分别有以下几个功能(对应到action字段):

action

功能



action为空的情况下显示所有可用勋章列表
log

显示我的勋章列表

confirm

显示申请勋章窗口

apply

确认申请勋章


进入medal模块,就有一句缓存相关的调用,从common_syscache表中取出medals的缓存并存入全局变量$_G[‘cache’][$cachename]中,以便取用。
  1. loadcache('medals');
复制代码
展示所有勋章

展示所有勋章的代码如下,我添加了注释说明:
  1. include libfile('function/forum');$medalcredits = array();//在forum_medal表中获取所有勋章并遍历foreach(C::t('forum_medal')->fetch_all_data(1) as $medal) {//勋章获取权限,如金钱>100、威望>100等$medal['permission'] = medalformulaperm(serialize(array('medal' => dunserialize($medal['permission']))), 1);//勋章也可设置为可使用积分、威望等值购买if($medal['price']) {$medal['credit'] = $medal['credit'] ? $medal['credit'] : $_G['setting']['creditstransextra'][3];$medalcredits[$medal['credit']] = $medal['credit'];}$medallist[$medal['medalid']] = $medal;}//在common_member_field_forum表中获取当前用户已获得的勋章列表$memberfieldforum = C::t('common_member_field_forum')->fetch($_G['uid']);$membermedal = $memberfieldforum['medals'] ? explode("\t", $memberfieldforum['medals']) : array();$membermedal = array_map('intval', $membermedal);$lastmedals = $uids = array();//在forum_medallog表中获取最后10条勋章发放/获取记录foreach(C::t('forum_medallog')->fetch_all_lastmedal(10) as $id => $lastmedal) {$lastmedal['dateline'] = dgmdate($lastmedal['dateline'], 'u');$lastmedals[$id] = $lastmedal;$uids[] = $lastmedal['uid'];}//获取最后10条勋章发放记录相关用户的信息$lastmedalusers = C::t('common_member')->fetch_all($uids);//获取当前登录用户已获得的所有勋章列表,此处的勋章列表和前面的变量$membermedal重复了,暂时不知道二者的区别$mymedals = C::t('common_member_medal')->fetch_all_by_uid($_G['uid']);
复制代码
log–我的勋章

我的勋章列表的实现代码与展示所有勋章的实现代码基本一致,唯一不同的就是勋章获取记录显示的是个人的记录,所以此处就不展开分析了。
comfirm–申请勋章窗口
  1. include libfile('function/forum');//获取所有勋章列表$medal = C::t('forum_medal')->fetch($_GET['medalid']);//获取勋章权限和价格$medal['permission'] = medalformulaperm(serialize(array('medal' => dunserialize($medal['permission']))), 1);if($medal['price']) {$medal['credit'] = $medal['credit'] ? $medal['credit'] : $_G['setting']['creditstransextra'][3];$medalcredits[$medal['credit']] = $medal['credit'];}include template('home/space_medal_float');
复制代码
confirm功能通过上面的代码获取勋章的详细信息,并通过下面的js代码以窗口的形式展示:
  1. onclick="showWindow('medal', 'home.php?mod=medal&action=confirm&medalid=7')"
复制代码
apply–提交申请

提交申请的实现代码大致如下,在注释里分析其实现:
  1. $medalid = intval($_GET['medalid']);$_G['forum_formulamessage'] = $_G['forum_usermsg'] = $medalnew = '';//获取所有可用的勋章列表$medal = C::t('forum_medal')->fetch($medalid);//检查勋章是否可申请if(!$medal['type']) {showmessage('medal_apply_invalid');}//检查是否已持有勋章if(C::t('common_member_medal')->count_by_uid_medalid($_G['uid'], $medalid)) {showmessage('medal_apply_existence', 'home.php?mod=medal');}$applysucceed = FALSE;//是否符合申请条件$medalpermission = $medal['permission'] ? dunserialize($medal['permission']) : '';//检查勋章是否有用户组限制if($medalpermission[0] || $medalpermission['usergroupallow']) {include libfile('function/forum');medalformulaperm(serialize(array('medal' => $medalpermission)), 1);if($_G['forum_formulamessage']) {showmessage('medal_permforum_nopermission', 'home.php?mod=medal', array('formulamessage' => $_G['forum_formulamessage'], 'usermsg' => $_G['forum_usermsg']));} else {$applysucceed = TRUE;}} else {$applysucceed = TRUE;}if($applysucceed) {$expiration = empty($medal['expiration'])? 0 : TIMESTAMP + $medal['expiration'] * 86400;if($medal['type'] == 1) {//勋章类型为可购买if($medal['price']) {//勋章是否需要花积分或威望等值购买//积分或威望是否足够$medal['credit'] = $medal['credit'] ? $medal['credit'] : $_G['setting']['creditstransextra'][3];if($medal['price'] > getuserprofile('extcredits'.$medal['credit'])) {showmessage('medal_not_get_credit', '', array('credit' => $_G['setting']['extcredits'][$medal[credit]][title]));}//扣除购买积分或威望等updatemembercount($_G['uid'], array($medal['credit'] => -$medal['price']), true, 'BME', $medal['medalid']);}$memberfieldforum = C::t('common_member_field_forum')->fetch($_G['uid']);$usermedal = $memberfieldforum;unset($memberfieldforum);$medal['medalid'] = $medal['medalid'].(empty($expiration) ? '' : '|'.$expiration);$medalnew = $usermedal['medals'] ? $usermedal['medals']."\t".$medal['medalid'] : $medal['medalid'];//给当前用户添加购买的勋章C::t('common_member_field_forum')->update($_G['uid'], array('medals' => $medalnew));C::t('common_member_medal')->insert(array('uid' => $_G['uid'], 'medalid' => $medal['medalid']), 0, 1);$medalmessage = 'medal_get_succeed';} else {//勋章类型为其他可申请的类型//检查是否已经申请过了if(C::t('forum_medallog')->count_by_verify_medalid($_G['uid'], $medal['medalid'])) {showmessage('medal_apply_existence', 'home.php?mod=medal');}$medalmessage = 'medal_apply_succeed';//通知管理员审核勋章manage_addnotify('verifymedal');}//记录勋章申请请求C::t('forum_medallog')->insert(array('uid' => $_G['uid'],'medalid' => $medalid,'type' => $medal['type'],'dateline' => TIMESTAMP,'expiration' => $expiration,'status' => ($expiration ? 1 : 0),));showmessage($medalmessage, 'home.php?mod=medal', array('medalname' => $medal['name']));}
复制代码
task模块

discuz自带任务模块,可在discuz管理中心->运营->站点任务中开启任务模块并管理论坛任务。
任务模块主要有以下几个功能,请求的字段do的值代表功能:

do值

功能



当do字段值为空时,表示浏览任务列表
view

查看任务详情

apply

申请任务

delete

放弃任务

draw

领取奖励

giveup

放弃任务,功能与delete一样,暂时未知被哪里调用

parter

参与某任务的用户列表


任务模块的业务逻辑实现主要在/source/class/class_task.php中,其数据存储主要跟表common_task、common_mytask和common_taskvar表相关。

数据库表

描述

common_task

存储所有论坛任务

common_mytask

存储所有用户和任务的关系

common_taskvar

存储任务的详细信息


展示任务列表

获取任务列表的功能代码如下,我将在注释中解析功能:
  1. function tasklist($item) {...//从数据库中获取与用户和item相关的任务列表,item有4个值new/doing/done/failed分别对应新任务、进行中任务、已完成任务和失败任务foreach(C::t('common_task')->fetch_all_by_status($_G['uid'], $item) as $task) {//从fetch_all_by_status方法中看,new和canapply没有区别if($item == 'new' || $item == 'canapply') {//检查任务的时间限制list($task['allowapply'], $task['t']) = $this->checknextperiod($task);if($task['allowapply'] < 0) {//不符合时间限制则不显示任务continue;}$task['noperm'] = $task['applyperm'] && $task['applyperm'] != 'all' && !(($task['applyperm'] == 'member'&& $_G['adminid'] == '0') || ($task['applyperm'] == 'admin' && $_G['adminid'] > '0') || forumperm($task['applyperm']));$task['appliesfull'] = $task['tasklimits'] && $task['achievers'] >= $task['tasklimits'];//不符合权限限制和已申请满员则不显示任务if($item == 'canapply' && ($task['noperm'] || $task['appliesfull'])) {continue;}}$num++;//任务的奖励类型if($task['reward'] == 'magic') {$magicids[] = $task['prize'];} elseif($task['reward'] == 'medal') {$medalids[] = $task['prize'];} elseif($task['reward'] == 'invite') {$invitenum = $task['prize'];} elseif($task['reward'] == 'group') {$groupids[] = $task['prize'];}//任务已启用且在可申请时间内if($task['available'] == '2' && ($task['starttime'] > TIMESTAMP || ($task['endtime'] && $task['endtime'] <= TIMESTAMP))) {$endtaskids[] = $task['taskid'];}//csc字段包含了任务进度百分比和最后更新时间,用\t隔开$csc = explode("\t", $task['csc']);$task['csc'] = floatval($csc[0]);//获取任务进度$task['lastupdate'] = intval($csc[1]);//获取任务进度更新时间//更新任务进度if(!$updated && $item == 'doing' && $task['csc'] < 100) {$updated = TRUE;$escript = explode(':', $task['scriptname']);//discuz支持任务插件,插件任务存在/source/plugin/中,原生任务在/source/class/task/中if(count($escript) > 1) {include_once DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.php';$taskclassname = 'task_'.$escript[1];} else {require_once libfile('task/'.$task['scriptname'], 'class');$taskclassname = 'task_'.$task['scriptname'];}$taskclass = new $taskclassname;$task['applytime'] = $task['dateline'];if(method_exists($taskclass, 'csc')) {$result = $taskclass->csc($task);//计算任务进度} else {showmessage('task_not_found', '', array('taskclassname' => $taskclassname));}//更新用户和任务的关系if($result === TRUE) {$task['csc'] = '100';C::t('common_mytask')->update($_G['uid'], $task['taskid'], array('csc' => $task['csc']));} elseif($result === FALSE) {C::t('common_mytask')->update($_G['uid'], $task['taskid'], array('status' => -1));} else {$task['csc'] = floatval($result['csc']);C::t('common_mytask')->update($_G['uid'], $task['taskid'], array('csc' => $task['csc']."\t".$_G['timestamp']));}}//如果该任务已完成或者已失败,检查是否可重新申请if(in_array($item, array('done', 'failed')) && $task['period']) {list($task['allowapply'], $task['t']) = $this->checknextperiod($task);$task['allowapply'] = $task['allowapply'] > 0 ? 1 : 0;}//获取任务图标$task['icon'] = $task['icon'] ? $task['icon'] : 'task.gif';if(strtolower(substr($task['icon'], 0, 7)) != 'http://') {$escript = explode(':', $task['scriptname']);if(count($escript) > 1 && file_exists(DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif')) {$task['icon'] = 'source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif';} else {$task['icon'] = 'static/image/task/'.$task['icon'];}}$task['dateline'] = $task['dateline'] ? dgmdate($task['dateline'], 'u') : '';$tasklist[] = $task;}//根据任务奖励类型获取奖励相关的信息//获取奖励物品名if($magicids) {foreach(C::t('common_magic')->fetch_all($magicids) as $magic) {$this->listdata[$magic['magicid']] = $magic['name'];}}//获取奖励奖章名if($medalids) {foreach(C::t('forum_medal')->fetch_all($medalids) as $medal) {$this->listdata[$medal['medalid']] = $medal['name'];}}//获取奖励用户组名if($groupids) {foreach(C::t('common_usergroup')->fetch_all($groupids) as $group) {$this->listdata[$group['groupid']] = $group['grouptitle'];}}//获取奖励邀请码if($invitenum) {$this->listdata[$invitenum] = $_G['lang']['invite_code'];}//无奖励if($endtaskids) {}return $tasklist;}
复制代码
view–任务详情

任务详情的代码如下:
  1. function view($id) {//获取任务信息$this->task = C::t('common_task')->fetch_by_uid($_G['uid'], $id);...//获取任务奖励信息switch($this->task['reward']) {case 'magic':$this->task['rewardtext'] = C::t('common_magic')->fetch($this->task['prize']);$this->task['rewardtext'] = $this->task['rewardtext']['name'];break;case 'medal':$this->task['rewardtext'] = C::t('forum_medal')->fetch($this->task['prize']);$this->task['rewardtext'] = $this->task['rewardtext']['name'];break;case 'group':$group = C::t('common_usergroup')->fetch($this->task['prize']);$this->task['rewardtext'] = $group['grouptitle'];break;}//获取任务图标链接$this->task['icon'] = $this->task['icon'] ? $this->task['icon'] : 'task.gif';if(strtolower(substr($this->task['icon'], 0, 7)) != 'http://') {$escript = explode(':', $this->task['scriptname']);if(count($escript) > 1 && file_exists(DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif')) {$this->task['icon'] = 'source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.gif';} else {$this->task['icon'] = 'static/image/task/'.$this->task['icon'];}}//获取任务结束时间和任务描述$this->task['endtime'] = $this->task['endtime'] ? dgmdate($this->task['endtime'], 'u') : '';$this->task['description'] = nl2br($this->task['description']);$this->taskvars = array();foreach(C::t('common_taskvar')->fetch_all_by_taskid($id) as $taskvar) {if(!$taskvar['variable'] || $taskvar['value']) {if(!$taskvar['variable']) {$taskvar['value'] = $taskvar['description'];}//用户相对该任务的状态if($taskvar['sort'] == 'apply') {$this->taskvars['apply'][] = $taskvar;} elseif($taskvar['sort'] == 'complete') {$this->taskvars['complete'][$taskvar['variable']] = $taskvar;} elseif($taskvar['sort'] == 'setting') {$this->taskvars['setting'][$taskvar['variable']] = $taskvar;}}}//获取允许申请任务的用户组信息$this->task['grouprequired'] = $comma = '';$this->task['applyperm'] = $this->task['applyperm'] == 'all' ? '' : $this->task['applyperm'];if(!in_array($this->task['applyperm'], array('', 'member', 'admin'))) {$query = C::t('common_usergroup')->fetch_all(explode(',', str_replace("\t", ',', $this->task['applyperm'])));foreach($query as $group) {$this->task['grouprequired'] .= $comma.$group[grouptitle];$comma = ', ';}}//申请此任务前需要完成任务的任务信息if($this->task['relatedtaskid']) {$task = C::t('common_task')->fetch($this->task['relatedtaskid']);$_G['taskrequired'] = $task['name'];}//根据scriptname判断任务类型是内置任务还是插件类型的任务,并且获取任务对应的实现类$escript = explode(':', $this->task['scriptname']);if(count($escript) > 1) {include_once DISCUZ_ROOT.'./source/plugin/'.$escript[0].'/task/task_'.$escript[1].'.php';$taskclassname = 'task_'.$escript[1];} else {require_once libfile('task/'.$this->task['scriptname'], 'class');$taskclassname = 'task_'.$this->task['scriptname'];}$taskclass = new $taskclassname;if($this->task['status'] == '-1') {//失败的任务if($this->task['period']) {//检查申请时间限制list($allowapply, $this->task['t']) = $this->checknextperiod($this->task);} else {$allowapply = -4;//小于0则为不可申请}} elseif($this->task['status'] == '0') {//正在执行的任务...if($this->task['csc'] < 100) {//如果任务进度不是已完成,则检查任务进度if(method_exists($taskclass, 'csc')) {$result = $taskclass->csc($this->task);//更新任务进度,返回值为任务是否已完成或者进度}...}} elseif($this->task['status'] == '1') {//已完成的任务if($this->task['period']) {//检查是否可重新申请list($allowapply, $this->task['t']) = $this->checknextperiod($this->task);} else {$allowapply = -5;}} else {$allowapply = 1;}if(method_exists($taskclass, 'view')) {//获取勋章展示信息$this->task['viewmessage'] = $taskclass->view($this->task, $this->taskvars);} else {$this->task['viewmessage'] = '';}if($allowapply > 0) {//检查是否有其他申请限制if($this->task['applyperm'] && $this->task['applyperm'] != 'all' && !(($this->task['applyperm'] == 'member' && $_G['adminid'] == '0') || ($this->task['applyperm'] == 'admin' && $_G['adminid'] > '0') || preg_match("/(^|\t)(".$_G['groupid'].")(\t|$)/", $this->task['applyperm']))) {$allowapply = -2;} elseif($this->task['tasklimits'] && $this->task['achievers'] >= $this->task['tasklimits']) {$allowapply = -3;}}$this->task['dateline'] = dgmdate($this->task['dateline'], 'u');return $allowapply;}
复制代码
apply–申请任务

apply的申请流程如下:
  1. function apply($id) {//获取任务信息$this->task = C::t('common_task')->fetch($id);//检查任务状态,字面意思就能看懂if($this->task['available'] != 2) {showmessage('task_nonexistence');} elseif(($this->task['starttime'] && $this->task['starttime'] > TIMESTAMP) || ($this->task['endtime'] && $this->task['endtime'] <= TIMESTAMP)) {showmessage('task_offline');} elseif($this->task['tasklimits'] && $this->task['achievers'] >= $this->task['tasklimits']) {showmessage('task_full');}if($this->task['relatedtaskid'] && !C::t('common_mytask')->count($_G['uid'], $this->task['relatedtaskid'], 1)) {//未完成关联任务return -1;} elseif($this->task['applyperm'] && $this->task['applyperm'] != 'all' && !(($this->task['applyperm'] == 'member' && $_G['adminid'] == '0') || ($this->task['applyperm'] == 'admin' && $_G['adminid'] > '0') || preg_match("/(^|\t)(".$_G['groupid'].")(\t|$)/", $this->task['applyperm']))) {//不符合申请权限return -2;} elseif(!$this->task['period'] && C::t('common_mytask')->count($_G['uid'], $id)) {//不允许多次申请任务return -3;} elseif($this->task['period']) {//检查申请时间和申请次数等限制$mytask = C::t('common_mytask')->fetch($_G['uid'], $id);$task = C::t('common_task')->fetch($id);$mytask['period'] = $task['period'];$mytask['periodtype'] = $task['periodtype'];unset($task);list($allowapply) = $this->checknextperiod($mytask);if($allowapply < 0) {return -4;}}...$taskclass = new $taskclassname;//检查其他条件if(method_exists($taskclass, 'condition')) {$taskclass->condition();}//申请成功,保存用户申请数据C::t('common_mytask')->insert(array('uid' => $_G['uid'],'username' => $_G['username'],'taskid' => $this->task['taskid'],'csc' => '0\t'.$_G['timestamp'],'dateline' => $_G['timestamp']), false, true);//申请用户数C::t('common_task')->update_applicants($this->task['taskid'], 1);if(method_exists($taskclass, 'preprocess')) {$taskclass->preprocess($this->task);}return true;}
复制代码
delete,giveup–放弃任务

用户放弃任务的主要逻辑如下:
  1. //移除用户和任务的关联C::t('common_mytask')->delete($_G['uid'], $id);//申请用户数减1C::t('common_task')->update_applicants($id, -1);
复制代码
draw–领取奖励

领取奖励的主要逻辑如下:
  1. function draw($id) {...} elseif($this->task['tasklimits'] && $this->task['achievers'] >= $this->task['tasklimits']) {//完成任务人数限制return -1;}...$taskclass = new $taskclassname;if(method_exists($taskclass, 'csc')) {$result = $taskclass->csc($this->task);//更新并获取任务进度} ...if($result === TRUE) {//任务已完成if($this->task['reward']) {//是否有奖励$rewards = $this->reward();$notification = $this->task['reward'];//获取任务奖励信息if($this->task['reward'] == 'magic') {$rewardtext = C::t('common_magic')->fetch($this->task['prize']);$rewardtext = $rewardtext['name'];} elseif($this->task['reward'] == 'medal') {$rewardtext = C::t('forum_medal')->fetch($this->task['prize']);$rewardtext = $rewardtext['name'];if(!$this->task['bonus']) {$notification = 'medal_forever';}} elseif($this->task['reward'] == 'group') {$group = C::t('common_usergroup')->fetch($this->task['prize']);$rewardtext = $group['grouptitle'];} elseif($this->task['reward'] == 'invite') {$rewardtext = $this->task['prize'];}//通知用户奖励信息notification_add($_G[uid], 'task', 'task_reward_'.$notification, array('taskid' => $this->task['taskid'],'name' => $this->task['name'],'creditbonus' => $_G['setting']['extcredits'][$this->task['prize']]['title'].' '.$this->task['bonus'].' '.$_G['setting']['extcredits'][$this->task['prize']]['unit'],'rewardtext' => $rewardtext,'bonus' => $this->task['bonus'],'prize' => $this->task['prize'],));}//成功领取奖励的回调if(method_exists($taskclass, 'sufprocess')) {$taskclass->sufprocess($this->task);}//更新任务信息C::t('common_mytask')->update($_G['uid'], $id, array('status' => 1, 'csc' => 100, 'dateline' => $_G['timestamp']));C::t('common_task')->update_achievers($id, 1);...} elseif($result === FALSE) {//任务失败//更新任务状态C::t('common_mytask')->update($_G['uid'], $id, array('status' => -1));if($_G['inajax']) {$this->message('-1', 'task_failed');} else {return -2;}} else {//任务在执行中//提示任务进度$result['t'] = $this->timeformat($result['remaintime']);$this->messagevalues['values'] = array('csc' => $result['csc'], 't' => $result['t']);if($result['csc']) {C::t('common_mytask')->update($_G['uid'], $id, array('csc' => $result['csc']."\t".$_G['timestamp']));$this->messagevalues['msg'] = $result['t'] ? 'task_doing_rt' : 'task_doing';} else {$this->messagevalues['msg'] = $result['t'] ? 'task_waiting_rt' : 'task_waiting';}if($_G['inajax']) {$this->message($result['csc'], $this->messagevalues['msg'], $this->messagevalues['values']);} else {return -3;}}}
复制代码
parter–参与者列表

获取参与者列表的主要实现如下:
  1. function parter($id) {$parterlist = array();//最多抓取8位参与者信息foreach(C::t('common_mytask')->fetch_all_by_taskid($id, 8) as $parter) {//展示参与者头像、昵称和任务进度等信息$parter['avatar'] = avatar($parter['uid'], 'small');$csc = explode("\t", $parter['csc']);$parter['csc'] = floatval($csc[0]);$parterlist[] = $parter;}return $parterlist;}
复制代码
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

创宇盾启航版免费网站防御网站加速服务
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:3.12.71.166,GMT+8, 2024-12-22 23:31 , Processed in 0.315048 second(s), 77 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2024 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表