Commit d44c7c60 by 李洋

配置调整

parent 86ebc545
...@@ -231,18 +231,17 @@ class MessageApiController extends Controller ...@@ -231,18 +231,17 @@ class MessageApiController extends Controller
$this->Export(11024, '已存在相同模板描述,请更换描述内容'); $this->Export(11024, '已存在相同模板描述,请更换描述内容');
} }
// $url = 'http://api.liexin.com/msg/sendMessageByHandle';
// $url = 'http://szapi.ichunt.com/msg/sendMessageByHandle';
// $url = 'http://api.ichunt.com/msg/sendMessageByHandle';
$url = ''; $url = '';
$current_domain = $_SERVER['HTTP_HOST']; $current_domain = $_SERVER['HTTP_HOST'];
if($current_domain === "message.liexin.com") if($current_domain === Config('msgconfig.domain_local'))
{
$url = Config('msgconfig.api_domain_local');
}elseif ($current_domain === Config('msgconfig.domain_sz'))
{ {
$url = Config('app.api_address')['local']; $url = Config('msgconfig.api_domain_sz');
}elseif ($current_domain === "message.ichunt.net") }elseif ($current_domain === Config('msgconfig.domain_release'))
{ {
$url = Config('app.api_address')['test']; $url = Config('msgconfig.api_domain_release');
} }
$params = []; $params = [];
......
...@@ -97,7 +97,7 @@ class MessageController extends Controller ...@@ -97,7 +97,7 @@ class MessageController extends Controller
$paths = [["title" => "消息管理系统", "href" => '/database/']]; $paths = [["title" => "消息管理系统", "href" => '/database/']];
$username = $request->user->email; $username = $request->user->email;
$useremail = $request->user->email; $useremail = $request->user->email;
$menuconfig = DB::table('config')->where('config_id', 4)->first(); $menuconfig = DB::table('config')->where('config_id', $this->getConfigId())->first();
$menus = []; $menus = [];
if ($menuconfig && !($menus = json_decode($menuconfig->config_data))) if ($menuconfig && !($menus = json_decode($menuconfig->config_data)))
$menus = []; $menus = [];
...@@ -125,7 +125,7 @@ class MessageController extends Controller ...@@ -125,7 +125,7 @@ class MessageController extends Controller
$paths = [["title" => "首页", "href" => '/database/']]; $paths = [["title" => "首页", "href" => '/database/']];
$username = $request->user->email; $username = $request->user->email;
$useremail = $request->user->email; $useremail = $request->user->email;
$menuconfig = DB::table('config')->where('config_id', 4)->first(); $menuconfig = DB::table('config')->where('config_id', $this->getConfigId())->first();
$menus = []; $menus = [];
if ($menuconfig && !($menus = json_decode($menuconfig->config_data))) if ($menuconfig && !($menus = json_decode($menuconfig->config_data)))
$menus = []; $menus = [];
...@@ -696,10 +696,28 @@ class MessageController extends Controller ...@@ -696,10 +696,28 @@ class MessageController extends Controller
{ {
$perms_str = implode(',',$perms_arr); $perms_str = implode(',',$perms_arr);
$uid = $request->user->userId; $uid = $request->user->userId;
// $bid = 8;
// $url = "http://perm.liexin.net/api/check/$uid/$bid/?perms=$perms_str"; $bid = "";
$bid = Config('perm.bid'); $perm_url = "";
$perm_url = Config('perm.url');
//区分环境
$current_domain = $_SERVER['HTTP_HOST'];
if($current_domain === Config('msgconfig.domain_local'))
{
$bid = Config('msgconfig.perm_bid_local');
$perm_url = Config('msgconfig.perm_domain_local');
}
elseif ($current_domain === Config('msgconfig.domain_sz'))
{
$bid = Config('msgconfig.perm_bid_sz');
$perm_url = Config('msgconfig.perm_domain_sz');
}
elseif ($current_domain === Config('msgconfig.domain_release'))
{
$bid = Config('msgconfig.perm_bid_release');
$perm_url = Config('msgconfig.perm_domain_release');
}
$url = $perm_url."/api/check/$uid/$bid/?perms=$perms_str"; $url = $perm_url."/api/check/$uid/$bid/?perms=$perms_str";
$res = json_decode(curl($url),true); $res = json_decode(curl($url),true);
if(!$res['retcode']) if(!$res['retcode'])
...@@ -707,4 +725,23 @@ class MessageController extends Controller ...@@ -707,4 +725,23 @@ class MessageController extends Controller
return $res['data']['perms']; return $res['data']['perms'];
} }
} }
//根据当前域名获取config_id
private function getConfigId()
{
$current_domain = $_SERVER['HTTP_HOST'];
if($current_domain === Config('msgconfig.domain_local'))
{
return Config('msgconfig.config_id_local');
}
elseif ($current_domain === Config('msgconfig.domain_sz'))
{
return Config('msgconfig.config_id_sz');
}
elseif ($current_domain === Config('msgconfig.domain_release'))
{
return Config('msgconfig.config_id_release');
}
}
} }
\ No newline at end of file
...@@ -203,9 +203,4 @@ return [ ...@@ -203,9 +203,4 @@ return [
], ],
'api_address' => [
'local' => 'http://api.liexin.com/msg/sendMessageByHandle',
'test' => 'http://szapi.ichunt.com/msg/sendMessageByHandle',
],
]; ];
<?php
/**
* Created by PhpStorm.
* User: leo
* Date: 2018/1/11
* Time: 19:17
*/
return [
//域名
'domain_local'=>'message.liexin.com',
'domain_sz'=>'szmessage.ichunt.net',
'domain_release'=>'message.ichunt.net',
//接口地址
'api_domain_local' => 'http://api.liexin.com/msg/sendMessageByHandle',
'api_domain_sz' => 'http://szapi.ichunt.com/msg/sendMessageByHandle',
'api_domain_release' => 'http://api.ichunt.com/msg/sendMessageByHandle',
//项目config_id
'config_id_local' => 4,
'config_id_sz' => 5,
'config_id_release' => 5,
//权限配置
'perm_bid_local' => 8,
'perm_bid_sz' =>6,
'perm_bid_release' => 6,
'perm_domain_local' => "http://perm.liexin.net",
'perm_domain_sz' => "http://perm.ichunt.net",
'perm_domain_release' => "http://perm.ichunt.net",
];
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: leo
* Date: 2017/12/27
* Time: 16:10
*/
return [
'bid' => 8,
'url' => "http://perm.liexin.net",
'消息管理' => [
'消息模板列表' => ['template_check'],
'新增消息模板' => ['template_create', 'template_edit'],
'手动消息历史' => ['manualhistorylist_check'],
'手动发送消息' => ['manualmessage_edit', 'manualmessage_send'],
'全部历史消息' => ['allhistorylist_check'],
],
];
\ No newline at end of file
...@@ -287,7 +287,13 @@ ...@@ -287,7 +287,13 @@
<div style="text-align: center"> <div style="text-align: center">
<label style="margin-top: 30px">对不起,您没有权限查看此页面</label> <label style="margin-top: 30px">对不起,您没有权限查看此页面</label>
<div> <div>
<a href="{{ Config('perm.url').'/page/business/'.Config('perm.bid').'/request/template_create' }}" target="_blank" class="btn btn-primary">申请权限</a> @if($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_local'))
<a href="{{ Config('msgconfig.perm_domain_local').'/page/business/'.Config('msgconfig.perm_bid_local').'/request/template_create' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_sz'))
<a href="{{ Config('msgconfig.perm_domain_sz').'/page/business/'.Config('msgconfig.perm_bid_sz').'/request/template_create' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_release'))
<a href="{{ Config('msgconfig.perm_domain_release').'/page/business/'.Config('msgconfig.perm_bid_release').'/request/template_create' }}" target="_blank" class="btn btn-primary">申请权限</a>
@endif
</div> </div>
</div> </div>
@endif @endif
\ No newline at end of file
...@@ -180,7 +180,13 @@ ...@@ -180,7 +180,13 @@
<div style="text-align: center"> <div style="text-align: center">
<label style="margin-top: 30px">对不起,您没有权限查看此页面</label> <label style="margin-top: 30px">对不起,您没有权限查看此页面</label>
<div> <div>
<a href="{{ Config('perm.url').'/page/business/'.Config('perm.bid').'/request/allhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a> @if($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_local'))
<a href="{{ Config('msgconfig.perm_domain_local').'/page/business/'.Config('msgconfig.perm_bid_local').'/request/allhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_sz'))
<a href="{{ Config('msgconfig.perm_domain_sz').'/page/business/'.Config('msgconfig.perm_bid_sz').'/request/allhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_release'))
<a href="{{ Config('msgconfig.perm_domain_release').'/page/business/'.Config('msgconfig.perm_bid_release').'/request/allhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@endif
</div> </div>
</div> </div>
@endif @endif
......
...@@ -116,7 +116,13 @@ ...@@ -116,7 +116,13 @@
<div style="text-align: center"> <div style="text-align: center">
<label style="margin-top: 30px">对不起,您没有权限查看此页面</label> <label style="margin-top: 30px">对不起,您没有权限查看此页面</label>
<div> <div>
<a href="{{ Config('perm.url').'/page/business/'.Config('perm.bid').'/request/manualhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a> @if($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_local'))
<a href="{{ Config('msgconfig.perm_domain_local').'/page/business/'.Config('msgconfig.perm_bid_local').'/request/manualhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_sz'))
<a href="{{ Config('msgconfig.perm_domain_sz').'/page/business/'.Config('msgconfig.perm_bid_sz').'/request/manualhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_release'))
<a href="{{ Config('msgconfig.perm_domain_release').'/page/business/'.Config('msgconfig.perm_bid_release').'/request/manualhistorylist_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@endif
</div> </div>
</div> </div>
@endif @endif
...@@ -322,7 +322,13 @@ ...@@ -322,7 +322,13 @@
<div style="text-align: center"> <div style="text-align: center">
<label style="margin-top: 30px">对不起,您没有权限查看此页面</label> <label style="margin-top: 30px">对不起,您没有权限查看此页面</label>
<div> <div>
<a href="{{ Config('perm.url').'/page/business/'.Config('perm.bid').'/request/manualmessage_send' }}" target="_blank" class="btn btn-primary">申请权限</a> @if($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_local'))
<a href="{{ Config('msgconfig.perm_domain_local').'/page/business/'.Config('msgconfig.perm_bid_local').'/request/manualmessage_send' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_sz'))
<a href="{{ Config('msgconfig.perm_domain_sz').'/page/business/'.Config('msgconfig.perm_bid_sz').'/request/manualmessage_send' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_release'))
<a href="{{ Config('msgconfig.perm_domain_release').'/page/business/'.Config('msgconfig.perm_bid_release').'/request/manualmessage_send' }}" target="_blank" class="btn btn-primary">申请权限</a>
@endif
</div> </div>
</div> </div>
@endif @endif
\ No newline at end of file
...@@ -91,7 +91,13 @@ ...@@ -91,7 +91,13 @@
<div style="text-align: center"> <div style="text-align: center">
<label style="margin-top: 30px">对不起,您没有权限查看此页面</label> <label style="margin-top: 30px">对不起,您没有权限查看此页面</label>
<div> <div>
<a href="{{ Config('perm.url').'/page/business/'.Config('perm.bid').'/request/template_check' }}" target="_blank" class="btn btn-primary">申请权限</a> @if($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_local'))
<a href="{{ Config('msgconfig.perm_domain_local').'/page/business/'.Config('msgconfig.perm_bid_local').'/request/template_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_sz'))
<a href="{{ Config('msgconfig.perm_domain_sz').'/page/business/'.Config('msgconfig.perm_bid_sz').'/request/template_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@elseif ($_SERVER['HTTP_HOST'] === Config('msgconfig.domain_release'))
<a href="{{ Config('msgconfig.perm_domain_release').'/page/business/'.Config('msgconfig.perm_bid_release').'/request/template_check' }}" target="_blank" class="btn btn-primary">申请权限</a>
@endif
</div> </div>
</div> </div>
@endif @endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment