webmain/model/sjoinModel.php

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
class sjoinClassModel extends Model
{
	private $getgroupidarr=array();
	
	//获取用户所在组Id
	public function getgroupid($uid, $fid='')
	{
		if($fid=='')$fid = 'id';
		$keys   = ''.$fid.''.$uid.'';
		if(isset($this->getgroupidarr[$keys]))return $this->getgroupidarr[$keys];
		$gasql	= " ( id in( select `sid` from `[Q]sjoin` where `type`='ug' and `mid`='$uid') or id in( select `mid` from `[Q]sjoin` where `type`='gu' and `sid`='$uid') )";
		$gsql	= "select `id` from `[Q]group` where $gasql ";
		$rows 	= $this->db->getall($gsql);
		$ids 	= '0';
		foreach($rows as $k=>$rs)$ids.=','.$rs[$fid].'';
		$this->getgroupidarr[$keys] = $ids;
		return $ids;
	}
	
	//把人员加到对应组上
	public function addgroupuid($uid, $gid)
	{
		$where 	= "1=1 and ((`type`='gu' and `sid`=$uid ) or (`type`='ug' and `mid`=$uid))";
		$this->delete($where);
		if(isempt($gid))return;
		$this->db->insert($this->table, '`type`,`mid`,`sid`,`indate`', "select 'ug','$uid',`id`,now() from `[Q]group` where id in($gid)", true);
	}
	
	//获取权限菜单id
	public function getmenuid($uid)
	{
		$gid 	= $this->getgroupid($uid);
		$whe1 	= "select `sid` from `[Q]sjoin` where ((`type`='um' and `mid`='$uid')";
		$whe2	= "select `mid` from `[Q]sjoin` where ((`type`='mu' and `sid`='$uid')";
		if($gid != '0'){
			$whe1.="  or (`type`='gm' and `mid` in($gid)) ";
			$whe2.="  or (`type`='mg' and `sid` in($gid)) ";
		}
		$whe1.= ')';
		$whe2.= ')';
		
		$ids 	= '0';
		$rows	= $this->db->getall($whe1);
		foreach($rows as $k=>$rs)$ids.=','.$rs['sid'].'';
		
		$rows	= $this->db->getall($whe2);
		foreach($rows as $k=>$rs)$ids.=','.$rs['mid'].'';
		return $ids;
	}
	
	/**
	*	查看菜单权限
	*/	
	public function getuserext($uid, $type=0)
	{
		$guid 	= '-1';
		if($type==1)return $guid;
		$guid	= '[0]';
		$mid 	= $this->getmenuid($uid);
后面还有 40 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。