public function statistics() { $app_alias = getAppAlias('post'); $posterDao = M('poster'); $allCount = $posterDao->field('COUNT(*) AS poster')->find(); return array("招贴总数" => $allCount['poster']); }
public function statistics() { $app_alias = getAppAlias('gift'); $giftCount = M('gift')->count(); $giftuserCount = M('gift_user')->count(); return array("{$app_alias}总数" => $giftCount, "{$app_alias}赠送人次" => $giftuserCount); }
public function statistics() { $app_alias = getAppAlias('task'); $task_count = M('task')->where('`status`=1')->count(); $recycle_count = M('task')->where('`status`=2')->count(); return array("{$app_alias}数" => $task_count . '篇', '回收站' => $recycle_count . '篇'); }
public function statistics() { $app_alias = getAppAlias('event'); $eventDao = M('event'); $userDao = M('event_user'); $allCount = $eventDao->field('COUNT(*) AS event,AVG(joinCount) AS joinIn')->find(); $onGoingCount = $eventDao->field('COUNT(*) AS event,AVG(joinCount) AS joinIn')->where('deadline>' . time())->find(); return array("{$app_alias}总数" => $allCount['event'], '平均参与人次' => number_format($allCount['joinIn'], 1, '.', ''), "当前进行的{$app_alias}数" => $onGoingCount['event'], '当前平均参与人次' => number_format($onGoingCount['joinIn'], 1, '.', '')); }
public function statistics() { $app_alias = getAppAlias('vote'); $voteDao = M('vote'); $voteUserDao = M('vote_user'); $voteNum = $voteDao->count(); $times = $voteUserDao->where(' opts<>"" ')->count(); return array("发起{$app_alias}数" => $voteNum, "参与{$app_alias}的人次" => $times); }
public function statistics() { $app_alias = getAppAlias('group'); $groupDao = M('group'); $bbsDao = M('group_topic'); $fileDao = M('group_attachment'); $allCount = $groupDao->field('COUNT(*) AS `groupcount`,AVG(`membercount`) AS `membercount`')->where('`status`=1 AND `is_del`=0')->find(); $bbscount = $bbsDao->field('COUNT(*) AS bbscount')->where('`is_del`=0')->find(); $filecount = $fileDao->field('COUNT(*) AS filecount')->where('`is_del`=0')->find(); return array("{$app_alias}总数" => $allCount['groupcount'], '平均成员数' => number_format($allCount['membercount'], 1, '.', ''), '平均帖子数' => number_format($bbscount['bbscount'] / $allCount['groupcount'], 1, '.', ''), '平均文档数' => number_format($filecount['filecount'] / $allCount['groupcount'], 1, '.', '')); }
public function commentVote() { $this->data['with_new_weibo'] = intval($this->data['with_new_weibo']); //$this->data['type'] = t($this->data['type']); $this->data['type'] = 'vote'; $this->data['appid'] = intval($this->data['appid']); $this->data['comment'] = $this->data['comment']; $this->data['to_id'] = intval($this->data['to_id']); $this->data['author_uid'] = intval($this->data['author_uid']); $this->data['title'] = t(html_entity_decode($this->data['title'], ENT_QUOTES, 'UTF-8')); $this->data['url'] = urldecode($this->data['url']); $this->data['table'] = t($this->data['table']); $this->data['id_field'] = t($this->data['id_field']); $this->data['comment_count_field'] = t($this->data['comment_count_field']); $app_alias = getAppAlias($this->data['type']); // 被回复内容 $former_comment = array(); if ($this->data['to_id'] > 0) { $former_comment = M('comment')->where("`id`='{$this->data['to_id']}'")->find(); } // 插入新数据 $map['type'] = $this->data['type']; // 应用名 $map['appid'] = $this->data['appid']; $map['appuid'] = $this->data['author_uid']; $map['uid'] = $this->mid; $map['comment'] = t(getShort($this->data['comment'], $GLOBALS['ts']['site']['length'])); $map['cTime'] = time(); $map['toId'] = $this->data['to_id']; $map['status'] = 0; // 0: 未读 1:已读 $map['quietly'] = 0; $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $this->data['author_uid']; $map['data'] = serialize(array('title' => $this->data['title'], 'url' => $this->data['url'], 'table' => $this->data['table'], 'id_field' => $this->data['id_field'], 'comment_count_field' => $this->data['comment_count_field'])); if (empty($map['type']) && empty($map['appid']) && empty($map['appuid']) && empty($map['comment'])) { return 0; } $res = M('comment')->add($map); return $res; }
/** * 获取微博来源 * * @param string $type * @param array $type_data */ function getFrom($type, $type_data) { $type_data = unserialize($type_data); if ($type_data['app_name'] && ($app_alias = getAppAlias($type_data['app_name']))) { // title只取前10个字符 mb_strlen($type_data['title'], 'UTF8') > 10 && ($type_data['title'] = mb_substr($type_data['title'], 0, 10, 'UTF8') . '...'); $type_data['title'] = !empty($type_data['title']) ? ' - ' . $type_data['title'] : ''; $type_data['url'] = !empty($type_data['url']) ? $type_data['url'] : '###'; $target = substr($type_data['url'], 0, 1) == '#' ? '_self' : '_blank'; $html = "<a href=\"{$type_data['url']}\" target=\"{$target}\">{$app_alias}{$type_data['title']}</a>"; } elseif ($type_data['source']) { //站外资源 // source只取前10个字符 mb_strlen($type_data['source'], 'UTF8') > 10 && ($type_data['source'] = mb_substr($type_data['source'], 0, 10, 'UTF8') . '...'); $type_data['url'] = !empty($type_data['url']) ? $type_data['url'] : '###'; $target = substr($type_data['url'], 0, 1) == '#' ? '_self' : '_blank'; $html = "<a href=\"{$type_data['url']}\" target=\"{$target}\">{$type_data['source']}</a>"; } elseif ($type == 0) { $html = '<a href="###">网站</a>'; } elseif ($type == 1) { $html = '<a href="###">手机网页</a>'; } elseif ($type == 2) { $html = '<a href="###">Android客户端</a>'; } elseif ($type == 3) { $html = '<a href="###">iPhone客户端</a>'; } return $html; }
* other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ defined('_JEXEC') or die('Unauthorized Access'); if (isset($view)) { addView($title, $view); } if (isset($type)) { $title[] = $type; shRemoveFromGETVarsList('type'); } if (isset($filter)) { $title[] = $filter; shRemoveFromGETVarsList('filter'); } if (isset($listId)) { $title[] = getListAlias($listId); shRemoveFromGETVarsList('listId'); } if (isset($appId)) { $title[] = getAppAlias($appId); shRemoveFromGETVarsList('appId'); } if (isset($filterid)) { $title[] = $filterid; shRemoveFromGETVarsList('filterid'); } if (isset($groupId)) { $title[] = getGroupAlias($groupId); shRemoveFromGETVarsList('groupId'); }
public function sendToWeibo() { $_REQUEST['with_new_weibo'] = intval($_REQUEST['with_new_weibo']); $_REQUEST['type'] = t($_REQUEST['type']); $_REQUEST['appid'] = intval($_REQUEST['appid']); $_REQUEST['comment'] = $_REQUEST['comment']; $_REQUEST['to_id'] = intval($_REQUEST['to_id']); $_REQUEST['author_uid'] = intval($_REQUEST['author_uid']); $_REQUEST['title'] = t(html_entity_decode($_REQUEST['title'], ENT_QUOTES)); $_REQUEST['url'] = urldecode($_REQUEST['url']); $_REQUEST['table'] = t($_REQUEST['table']); $_REQUEST['id_field'] = t($_REQUEST['id_field']); $_REQUEST['comment_count_field'] = t($_REQUEST['comment_count_field']); $app_alias = getAppAlias($_REQUEST['type']); // 被回复内容 $former_comment = array(); if ($_REQUEST['to_id'] > 0) { $former_comment = M('comment')->where("`id`='{$_REQUEST['to_id']}'")->find(); } // 插入新数据 $map['type'] = $_REQUEST['type']; // 应用名 $map['appid'] = $_REQUEST['appid']; $map['appuid'] = $_REQUEST['author_uid']; $map['uid'] = $this->mid; $map['comment'] = t(getShort($_REQUEST['comment'], $GLOBALS['ts']['site']['length'])); $map['cTime'] = time(); $map['toId'] = $_REQUEST['to_id']; $map['status'] = 0; // 0: 未读 1:已读 $map['quietly'] = 0; $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $_REQUEST['author_uid']; $map['data'] = serialize(array('title' => keyWordFilter($_REQUEST['title']), 'url' => $_REQUEST['url'], 'table' => $_REQUEST['table'], 'id_field' => $_REQUEST['id_field'], 'comment_count_field' => $_REQUEST['comment_count_field'])); $res = M('comment')->add($map); // 避免命名冲突 unset($map['data']); if ($res) { // 发表分享 if ($_REQUEST['with_new_weibo']) { $from_data = array('app_type' => 'local_app', 'app_name' => $_REQUEST['type'], 'title' => $_REQUEST['title'], 'url' => $_REQUEST['url']); $from_data = serialize($from_data); D('Weibo', 'weibo')->publish($this->mid, array('content' => html_entity_decode($_REQUEST['comment'] . ($_REQUEST['to_id'] > 0 ? ' //@' . getUserName($former_comment['uid']) . ' :' . $former_comment['comment'] : ''), ENT_QUOTES)), 0, 0, '', '', $from_data); } // 组装结果集 $result = $map; $result['data']['uavatar'] = getUserSpace($this->mid, 'null', '_blank', '{uavatar}'); $result['data']['uspace'] = getUserSpace($this->mid, 'null', '_blank', '{uname}'); //$result['data']['comment'] = $_REQUEST['comment']; $result['data']['ctime'] = L('just_now'); $result['data']['uname'] = getUserName($this->mid); $result['data']['comment'] = formatComment(t($_REQUEST['comment'])); $result['data']['id'] = $res; $result['data']['userGroupIcon'] = getUserGroupIcon($this->mid); $result['data']['del_state'] = 1; return json_encode($result); } else { echo -1; } }
public function doAddComment() { $_POST['with_new_weibo'] = intval($_POST['with_new_weibo']); $_POST['type'] = t($_POST['type']); $_POST['appid'] = intval($_POST['appid']); $_POST['comment'] = $_POST['comment']; $_POST['to_id'] = intval($_POST['to_id']); $_POST['author_uid'] = intval($_POST['author_uid']); $_POST['title'] = t(html_entity_decode($_POST['title'], ENT_QUOTES)); $_POST['url'] = urldecode($_POST['url']); $_POST['table'] = t($_POST['table']); $_POST['id_field'] = t($_POST['id_field']); $_POST['comment_count_field'] = t($_POST['comment_count_field']); $app_alias = getAppAlias($_POST['type']); // 被回复内容 $former_comment = array(); if ($_POST['to_id'] > 0) { $former_comment = M('comment')->where("`id`='{$_POST['to_id']}'")->find(); } // 插入新数据 $map['type'] = $_POST['type']; // 应用名 $map['appid'] = $_POST['appid']; $map['appuid'] = $_POST['author_uid']; $map['uid'] = $this->mid; $map['comment'] = t(getShort($_POST['comment'], $GLOBALS['ts']['site']['length'])); $map['cTime'] = time(); $map['toId'] = $_POST['to_id']; $map['status'] = 0; // 0: 未读 1:已读 $map['quietly'] = 0; $map['to_uid'] = $former_comment['uid'] ? $former_comment['uid'] : $_POST['author_uid']; $map['data'] = serialize(array('title' => $_POST['title'], 'url' => $_POST['url'], 'table' => $_POST['table'], 'id_field' => $_POST['id_field'], 'comment_count_field' => $_POST['comment_count_field'])); $res = M('comment')->add($map); // 避免命名冲突 unset($map['data']); if ($res) { // 应用回调: 增加应用的评论计数 $this->__doAddCallBack($_POST['appid'], $_POST['table'], $_POST['id_field'], $_POST['comment_count_field']); //积分处理 $setCredit = X('Credit'); if ($map['toId'] > 0 && $this->mid != $map['to_uid']) { $setCredit->setUserCredit($this->mid, 'reply_comment')->setUserCredit($map['to_uid'], 'replied_comment'); } else { if ($this->mid != $map['to_uid']) { $setCredit->setUserCredit($this->mid, 'add_comment')->setUserCredit($map['to_uid'], 'is_commented'); } } // 发表微博 if ($_POST['with_new_weibo']) { $from_data = array('app_type' => 'local_app', 'app_name' => $_POST['type'], 'title' => $_POST['title'], 'url' => $_POST['url']); $from_data = serialize($from_data); D('Weibo', 'weibo')->publish($this->mid, array('content' => html_entity_decode($_POST['comment'] . ($_POST['to_id'] > 0 ? ' //@' . getUserName($former_comment['uid']) . ' :' . $former_comment['comment'] : ''), ENT_QUOTES)), 0, 0, '', '', $from_data); } /* // 给被回复人发送通知 if ($former_comment['uid']) { $data = array( 'app_alias' => $app_alias, 'url' => $_POST['url'], 'title' => $_POST['title'], 'content' => $_POST['comment'], 'my_content'=> $former_comment['comment'], ); service('Notify')->send($former_comment['uid'], 'home_replyComment', $data, $this->mid); unset($data); } // 给作者发送通知 ( 当被回复人和作者为同一人时, 只发一个通知. 优先被回复. ) if ($_POST['author_uid'] > 0 && $_POST['author_uid'] != $former_comment['uid']) { $data = array( 'app_alias' => $app_alias, 'url' => $_POST['url'], 'title' => $_POST['title'], 'content' => $_POST['comment'], ); service('Notify')->send($_POST['author_uid'], 'home_addComment', $data, $this->mid); unset($data); } */ // 组装结果集 $result = $map; $result['data']['uavatar'] = getUserSpace($this->mid, 'null', '_blank', '{uavatar}'); $result['data']['uspace'] = getUserSpace($this->mid, 'null', '_blank', '{uname}'); //$result['data']['comment'] = $_POST['comment']; $result['data']['ctime'] = L('just_now'); $result['data']['uname'] = getUserName($this->mid); $result['data']['comment'] = formatComment(t($_POST['comment'])); $result['data']['id'] = $res; $result['data']['userGroupIcon'] = getUserGroupIcon($this->mid); $result['data']['del_state'] = 1; echo json_encode($result); } else { echo -1; } }