127 lines
2.9 KiB
PHP
127 lines
2.9 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Longbing [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright Chengdu longbing Technology Co., Ltd.
|
|
// +----------------------------------------------------------------------
|
|
// | Website http://longbing.org/
|
|
// +----------------------------------------------------------------------
|
|
// | Sales manager: +86-13558882532 / +86-13330887474
|
|
// | Technical support: +86-15680635005
|
|
// | After-sale service: +86-17361005938
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
namespace app\member\info;
|
|
|
|
use longbingcore\permissions\PermissionAbstract;
|
|
use think\facade\Db;
|
|
|
|
|
|
/**
|
|
* 模块功能权限
|
|
* Class Permissionclosure
|
|
*/
|
|
class PermissionMember extends PermissionAbstract {
|
|
|
|
const tabbarKey = null;
|
|
//后台管理菜单对应key[必填] , 当前模块文件夹名称
|
|
const adminMenuKey = 'member';
|
|
public $saasKey ;
|
|
const apiPaths = [];
|
|
|
|
|
|
public function __construct(int $uniacid,$infoConfigOptions = [])
|
|
{
|
|
$this->saasKey = longbing_get_auth_prefix('AUTH_MEMBER');
|
|
|
|
parent::__construct($uniacid, self::tabbarKey, self::adminMenuKey, $this->saasKey, self::apiPaths , $infoConfigOptions);
|
|
}
|
|
|
|
|
|
/**
|
|
* 返回saas端授权结果
|
|
* @return bool
|
|
*/
|
|
public function sAuth(): bool
|
|
{
|
|
|
|
|
|
|
|
if(!$this->getAuthIsSaasCheck()){
|
|
|
|
return true ;
|
|
}
|
|
|
|
return $this->sassValue > 0 ? true : false;
|
|
}
|
|
|
|
/**
|
|
* 返回p端授权结果
|
|
* @return bool
|
|
*/
|
|
public function pAuth(): bool
|
|
{
|
|
|
|
if (!$this->sAuth()) {
|
|
return false;
|
|
};
|
|
|
|
if(!$this->getAuthIsPlatformCheck()){
|
|
return true ;
|
|
}
|
|
|
|
|
|
$pAuthConfig = $this->getPAuthConfig();
|
|
|
|
|
|
|
|
if (!$pAuthConfig || $pAuthConfig['member_switch'] == 0) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
$all_count = Db::name('longbing_cardauth2_auth_app')->where(['app_name'=>'member'])->count('count');
|
|
} catch (\Exception $exception) {
|
|
return false;
|
|
}
|
|
|
|
|
|
if ($all_count > $this->getSaasValue()) {
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
$cardauth2= Db::name('longbing_cardauth2_auth_app')->where(['modular_id' => $this->uniacid,'app_name'=>'member'])->find();
|
|
} catch (\Exception $exception) {
|
|
return false;
|
|
}
|
|
|
|
|
|
|
|
if (!$cardauth2|| $cardauth2['sign'] < time() || $cardauth2['count'] < 1||md5('ndvjnfjvnjnv'.$cardauth2['create_time'])==$cardauth2['sign_data']) {
|
|
return false;
|
|
}
|
|
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 返回c端授权结果
|
|
*
|
|
* @param int $user_id
|
|
* @return bool
|
|
* @author ArtizanZhang
|
|
* @DataTime: 2019/12/9 17:13
|
|
*/
|
|
public function cAuth(int $user_id): bool
|
|
{
|
|
return true;
|
|
}
|
|
} |