更新
This commit is contained in:
parent
5ca65d37e5
commit
9df5ea73fa
@ -63,7 +63,8 @@ class IndexController extends BaseApiController
|
|||||||
*/
|
*/
|
||||||
public function config()
|
public function config()
|
||||||
{
|
{
|
||||||
$result = IndexLogic::getConfigData();
|
$group_id=$this->userInfo['group_id'];
|
||||||
|
$result = IndexLogic::getConfigData($group_id);
|
||||||
return $this->data($result);
|
return $this->data($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValida
|
|||||||
use app\api\logic\LoginLogic;
|
use app\api\logic\LoginLogic;
|
||||||
use app\Request;
|
use app\Request;
|
||||||
use app\api\logic\UserLogic;
|
use app\api\logic\UserLogic;
|
||||||
|
use app\common\model\Company;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录注册
|
* 登录注册
|
||||||
|
@ -19,6 +19,8 @@ use app\common\logic\BaseLogic;
|
|||||||
use app\common\model\article\Article;
|
use app\common\model\article\Article;
|
||||||
use app\common\model\decorate\DecoratePage;
|
use app\common\model\decorate\DecoratePage;
|
||||||
use app\common\model\decorate\DecorateTabbar;
|
use app\common\model\decorate\DecorateTabbar;
|
||||||
|
use app\common\model\user\UserMenu;
|
||||||
|
use app\common\model\user\UserRole;
|
||||||
use app\common\service\ConfigService;
|
use app\common\service\ConfigService;
|
||||||
use app\common\service\FileService;
|
use app\common\service\FileService;
|
||||||
|
|
||||||
@ -104,8 +106,30 @@ class IndexLogic extends BaseLogic
|
|||||||
* @author 段誉
|
* @author 段誉
|
||||||
* @date 2022/9/21 19:38
|
* @date 2022/9/21 19:38
|
||||||
*/
|
*/
|
||||||
public static function getConfigData()
|
public static function getConfigData($group_id=1)
|
||||||
{
|
{
|
||||||
|
if($group_id==null){
|
||||||
|
$group_id=1;
|
||||||
|
}
|
||||||
|
$group_find=UserRole::where('id',$group_id)->find();
|
||||||
|
$menu=[];
|
||||||
|
if($group_find){
|
||||||
|
$select=UserMenu::where('id','in',$group_find['menu_arr'])->field('id,pid,name,icon,sort,paths')->limit(100)->select()->toArray();
|
||||||
|
$arr=[];
|
||||||
|
foreach($select as $k=>$v){
|
||||||
|
if($v['pid']==0){
|
||||||
|
$arr[]=$v;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach($arr as $k=>$v){
|
||||||
|
foreach($select as $kk=>$vv){
|
||||||
|
if($v['id']==$vv['pid']){
|
||||||
|
$arr[$k]['children'][]=$vv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$menu=$arr;
|
||||||
|
}
|
||||||
// 底部导航
|
// 底部导航
|
||||||
$tabbar = DecorateTabbar::getTabbarLists();
|
$tabbar = DecorateTabbar::getTabbarLists();
|
||||||
// 导航颜色
|
// 导航颜色
|
||||||
@ -119,11 +143,11 @@ class IndexLogic extends BaseLogic
|
|||||||
// 政策协议
|
// 政策协议
|
||||||
'login_agreement' => ConfigService::get('login', 'login_agreement', config('project.login.login_agreement')),
|
'login_agreement' => ConfigService::get('login', 'login_agreement', config('project.login.login_agreement')),
|
||||||
// 第三方登录 开关
|
// 第三方登录 开关
|
||||||
'third_auth' => ConfigService::get('login', 'third_auth', config('project.login.third_auth')),
|
// 'third_auth' => ConfigService::get('login', 'third_auth', config('project.login.third_auth')),
|
||||||
// 微信授权登录
|
// 微信授权登录
|
||||||
'wechat_auth' => ConfigService::get('login', 'wechat_auth', config('project.login.wechat_auth')),
|
'wechat_auth' => ConfigService::get('login', 'wechat_auth', config('project.login.wechat_auth')),
|
||||||
// qq授权登录
|
// qq授权登录
|
||||||
'qq_auth' => ConfigService::get('login', 'qq_auth', config('project.login.qq_auth')),
|
// 'qq_auth' => ConfigService::get('login', 'qq_auth', config('project.login.qq_auth')),
|
||||||
];
|
];
|
||||||
// 网址信息
|
// 网址信息
|
||||||
$website = [
|
$website = [
|
||||||
@ -131,23 +155,15 @@ class IndexLogic extends BaseLogic
|
|||||||
'shop_logo' => FileService::getFileUrl(ConfigService::get('website', 'shop_logo')),
|
'shop_logo' => FileService::getFileUrl(ConfigService::get('website', 'shop_logo')),
|
||||||
];
|
];
|
||||||
// H5配置
|
// H5配置
|
||||||
$webPage = [
|
|
||||||
// 渠道状态 0-关闭 1-开启
|
|
||||||
'status' => ConfigService::get('web_page', 'status', 1),
|
|
||||||
// 关闭后渠道后访问页面 0-空页面 1-自定义链接
|
|
||||||
'page_status' => ConfigService::get('web_page', 'page_status', 0),
|
|
||||||
// 自定义链接
|
|
||||||
'page_url' => ConfigService::get('web_page', 'page_url', ''),
|
|
||||||
'url' => request()->domain() . '/mobile'
|
|
||||||
];
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'domain' => FileService::getFileUrl(),
|
'domain' => FileService::getFileUrl(),
|
||||||
'style' => $style,
|
'style' => $style,
|
||||||
'tabbar' => $tabbar,
|
'tabbar' => $tabbar,
|
||||||
|
'menu' => $menu,
|
||||||
'login' => $loginConfig,
|
'login' => $loginConfig,
|
||||||
'website' => $website,
|
'website' => $website,
|
||||||
'webPage' => $webPage,
|
|
||||||
'version'=> config('project.version')
|
'version'=> config('project.version')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -65,6 +65,10 @@ class LoginLogic extends BaseLogic
|
|||||||
} else {
|
} else {
|
||||||
$avatar = ConfigService::get('default_image', 'user_avatar');
|
$avatar = ConfigService::get('default_image', 'user_avatar');
|
||||||
}
|
}
|
||||||
|
$group_id=1;
|
||||||
|
if ($params['is_captain']) {
|
||||||
|
$group_id=2;
|
||||||
|
}
|
||||||
User::create([
|
User::create([
|
||||||
'sn' => $userSn,
|
'sn' => $userSn,
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
@ -85,6 +89,7 @@ class LoginLogic extends BaseLogic
|
|||||||
'address' => $params['address'],
|
'address' => $params['address'],
|
||||||
'qualification' => json_encode($params['qualification']),
|
'qualification' => json_encode($params['qualification']),
|
||||||
'company_id' => $params['company_id'],
|
'company_id' => $params['company_id'],
|
||||||
|
'group_id' => $group_id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
1
app/common/cache/UserTokenCache.php
vendored
1
app/common/cache/UserTokenCache.php
vendored
@ -83,6 +83,7 @@ class UserTokenCache extends BaseCache
|
|||||||
'expire_time' => $userSession->expire_time,
|
'expire_time' => $userSession->expire_time,
|
||||||
'admin_id' => $user->admin_id,
|
'admin_id' => $user->admin_id,
|
||||||
'company_id'=>$user->company_id,
|
'company_id'=>$user->company_id,
|
||||||
|
'group_id'=>$user->group_id
|
||||||
];
|
];
|
||||||
|
|
||||||
$ttl = new \DateTime(Date('Y-m-d H:i:s', $userSession->expire_time));
|
$ttl = new \DateTime(Date('Y-m-d H:i:s', $userSession->expire_time));
|
||||||
|
@ -89,13 +89,19 @@ class CompanyLogic extends BaseLogic
|
|||||||
$admin['password'] = create_password(123456, $passwordSalt);
|
$admin['password'] = create_password(123456, $passwordSalt);
|
||||||
|
|
||||||
$admin_id=Admin::strict(false)->insertGetId($admin);
|
$admin_id=Admin::strict(false)->insertGetId($admin);
|
||||||
|
//镇/街公司
|
||||||
if($params['company_type']==16){
|
if($params['company_type']==16){
|
||||||
AdminLogic::insertRole($admin_id, [3]);
|
AdminLogic::insertRole($admin_id, [3]);
|
||||||
|
$admin['group_id']=4;
|
||||||
}elseif($params['company_type']==17){
|
}elseif($params['company_type']==17){
|
||||||
|
//村管理公司
|
||||||
AdminLogic::insertRole($admin_id, [4]);
|
AdminLogic::insertRole($admin_id, [4]);
|
||||||
|
$admin['group_id']=3;
|
||||||
}
|
}
|
||||||
elseif ($params['company_type']==18) {
|
elseif ($params['company_type']==18) {
|
||||||
|
//小组服务公司
|
||||||
AdminLogic::insertRole($admin_id, [6]);
|
AdminLogic::insertRole($admin_id, [6]);
|
||||||
|
$admin['group_id']=5;
|
||||||
}
|
}
|
||||||
$userSn = User::createUserSn();
|
$userSn = User::createUserSn();
|
||||||
$admin['admin_id']=$admin_id;
|
$admin['admin_id']=$admin_id;
|
||||||
|
@ -32,7 +32,10 @@ class UserRole extends BaseModel
|
|||||||
|
|
||||||
public function getMenuArrAttr($value)
|
public function getMenuArrAttr($value)
|
||||||
{
|
{
|
||||||
return json_decode($value);
|
if($value){
|
||||||
|
return json_decode($value);
|
||||||
|
}
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user