Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
f1439d38
Commit
f1439d38
authored
Dec 11, 2018
by
christ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SecretKeys
parent
307981a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
9 deletions
+43
-9
Common.php
application/library/OSS/Common.php
+37
-8
SecretKeys.php
application/library/Our/SecretKeys.php
+5
-0
url.ini
conf/url.ini
+1
-1
No files found.
application/library/OSS/Common.php
View file @
f1439d38
...
...
@@ -3,6 +3,7 @@ namespace OSS;
use
OSS\OssClient
;
use
OSS\Core\OssException
;
use
Our\SecretKeys
;
/**
...
...
@@ -17,13 +18,21 @@ class Common
const
accessKeySecret
=
\Our\SecretKeys
::
ossAccessKey
;
const
bucket
=
\Our\SecretKeys
::
ossBucket
;
/**
* Get an OSSClient instance according to config.
*
* @return OssClient An OssClient instance
*/
public
static
function
getOssClient
()
{
const
endpointPre
=
SecretKeys
::
ossEndpointPre
;
const
buketPre
=
SecretKeys
::
ossBucket
;
public
static
function
getOssClientOnline
(){
try
{
$ossClient
=
new
OssClient
(
self
::
accessKeyId
,
self
::
accessKeySecret
,
self
::
endpointPre
,
false
);
}
catch
(
OssException
$e
)
{
printf
(
__FUNCTION__
.
"creating OssClient instance: FAILED
\n
"
);
printf
(
$e
->
getMessage
()
.
"
\n
"
);
return
null
;
}
return
$ossClient
;
}
public
static
function
getOssClientPre
(){
try
{
$ossClient
=
new
OssClient
(
self
::
accessKeyId
,
self
::
accessKeySecret
,
self
::
endpoint
,
false
);
}
catch
(
OssException
$e
)
{
...
...
@@ -33,10 +42,30 @@ class Common
}
return
$ossClient
;
}
/**
* Get an OSSClient instance according to config.
*
* @return OssClient An OssClient instance
*/
public
static
function
getOssClient
()
{
if
(
APP_ENV
==
'product'
||
APP_ENV
==
'productOne'
){
return
self
::
getOssClientOnline
();
}
else
{
return
self
::
getOssClientPre
();
}
}
public
static
function
getBucketName
()
{
return
self
::
bucket
;
if
(
APP_ENV
==
'product'
||
APP_ENV
==
'productOne'
){
return
self
::
bucket
;
}
else
{
return
self
::
buketPre
;
}
}
/**
...
...
application/library/Our/SecretKeys.php
View file @
f1439d38
...
...
@@ -25,6 +25,11 @@ class SecretKeys {
const
ossBucket
=
'qmoss-01'
;
//存储空间名称
const
ossDomain
=
'http://qmoss-01.oss-cn-hangzhou.aliyuncs.com'
;
//访问oss使用域名
//pre环境使用的oss
const
ossEndpointPre
=
'http://oss-cn-shanghai.aliyuncs.com'
;
//地域节点
const
ossBucketPre
=
'qmoss-shanghai'
;
//存储空间名称
const
ossDomainPre
=
'http://qmoss-shanghai.oss-cn-shanghai.aliyuncs.com'
;
//访问oss使用域名
//短信验证码相关
const
aliYunSmsAppId
=
'LTAICEp88gU0DNMe'
;
...
...
conf/url.ini
View file @
f1439d38
...
...
@@ -55,7 +55,7 @@ config.url.convert=/usr/local/bin/wkhtmltoimage
config.url.resourcesHost
=
"http://apitest.shenbd.com"
; 用户中心host
config.url.userHost
=
""
config.url.ossHost
=
"http
://testadmin.shenbd.com/data/upload
"
config.url.ossHost
=
"http
s://imgpre.shenbd.com
"
; oss 域名
;config.url.ossHost = "https://qmoss-01.oss-cn-hangzhou.aliyuncs.com"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment