/** * 返回未安装的APP名 * @author MaWei (http://www.phpyrb.com) * @date 2014-10-8 下午5:42:38 */ function getUninstallAppName() { //检测app安装目录里的APP $file = getDirFile(C('INSTALLAPP_APP')); $file = arrtolower($file); //已安装的APP $is_exsit = $this->getAppList(); $is_exsit = arr2to1($is_exsit, 'app_name'); //取差集 $unexsit = array_diff($file, $is_exsit); return $unexsit; }
function comment() { $sid = intval($_REQUEST['sid']); //资源评论 $count = $this->Sourc->comment('count', array('sourc_id' => $sid)); $page = new Page($count, 10, array('ajax' => true, 'url' => U('Home/Content/comment', array('sid' => $sid)))); $comment = $this->Sourc->comment("{$page->firstRow},{$page->listRows}", array('sourc_id' => $sid, 'reply_id' => 0)); // dump($comment); //返回评论用户信息 $uids = arr2to1($comment, 'uid', 'reply'); $userinfo = $this->member->getMemberInfo($uids, 'id,uname,avatar'); $this->assign('comment', $comment); $this->assign('userinfo', $userinfo); $this->assign('mulit', true); $html = $this->fetch(); $data = array(); $data['html'] = $html; $data['show'] = $page->show(); echo json_encode($data); }
/** * 返回分类的子分类 * @author MaWei (http://www.phpyrb.com) * @date 2014-10-6 下午5:07:21 */ function getCateChildren($_cid) { $reid = $this->cate->field('id')->where('FIND_IN_SET(' . $_cid . ',path)')->select(); return arr2to1($reid, 'id'); }
/** * 返回评论 * @author MaWei (http://www.phpyrb.com) * @date 2014-8-9 下午4:22:35 */ function comment($_limit = 'count', $_where = array(), $_order = 'id DESC') { if ($_limit == 'count') { $count = $this->comment->where($_where)->count(); return $count; } $list = $this->comment->where($_where)->order($_order)->limit($_limit)->select(); //把下标换成ID $list = fieldtokey($list); //评论下的回复 $cids = arr2to1($list); $reply = $this->_commentReply($cids); foreach ($reply as $k => $v) { $list[$v['reply_id']]['reply'][$v['id']] = $v; } return $list; }
/** * 更新父ID后,把他的子分类设置成顶级分类 * @param int $_id * @return array * @author MaWei (http://www.phpyrb.com) * @date 2014-8-15 下午3:11:04 */ function catepid($_id) { $ids = $this->cate->field('id')->where(array('pid' => $_id))->find(); $ids = arr2to1($ids); $this->cate->where(array('id' => array('IN', implode(',', $ids))))->save(array('pid' => 0)); }