Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ypl_mobile_web
Overview
Overview
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邓丽
ypl_mobile_web
Commits
36fa4b7b
Commit
36fa4b7b
authored
Apr 25, 2016
by
庄欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2016.4.25
parent
1f064674
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
app/config/config.ini
+1
-0
app/model/Base.php
+7
-0
lib/TxImg/TxImgCloud.php
+7
-16
No files found.
app/config/config.ini
View file @
36fa4b7b
...
@@ -5,6 +5,7 @@ username = root
...
@@ -5,6 +5,7 @@ username = root
password
=
"MepaiSVSQL!@#321"
password
=
"MepaiSVSQL!@#321"
dbname
=
yuepai
dbname
=
yuepai
charset
=
utf8
charset
=
utf8
prefix
=
myp_
[application]
[application]
controller
=
app/controller/
controller
=
app/controller/
...
...
app/model/Base.php
View file @
36fa4b7b
...
@@ -7,6 +7,7 @@ class Base extends Model
...
@@ -7,6 +7,7 @@ class Base extends Model
protected
$pk
=
"id"
;
protected
$pk
=
"id"
;
protected
$models
=
[];
protected
$models
=
[];
protected
$errors
=
[];
protected
$errors
=
[];
public
function
initialize
()
public
function
initialize
()
{
{
$this
->
addBehavior
(
$this
->
addBehavior
(
...
@@ -86,4 +87,10 @@ class Base extends Model
...
@@ -86,4 +87,10 @@ class Base extends Model
return
$mata
->
getAttributes
(
$this
);
return
$mata
->
getAttributes
(
$this
);
}
}
public
function
getPrefix
()
{
$config
=
new
\Phalcon\Config\Adapter\Ini
(
APP_PATH
.
'./app/config/config.ini'
);
return
$config
->
database
->
prefix
;
}
}
}
lib/TxImg/TxImgCloud.php
View file @
36fa4b7b
...
@@ -21,7 +21,8 @@ class TxImgCloud extends Cloud{
...
@@ -21,7 +21,8 @@ class TxImgCloud extends Cloud{
$this
->
config
=
[
$this
->
config
=
[
"appid"
=>
self
::
AppId
,
"appid"
=>
self
::
AppId
,
'bucket'
=>
self
::
Bucket
,
'bucket'
=>
self
::
Bucket
,
'userid'
=>
0
'userid'
=>
0
,
'file_id'
=>
urlencode
(
date
(
"Y-m-d"
,
NOW_TIME
)
.
'/'
.
uniqid
()
.
rand
(
0
,
1000
))
];
];
$this
->
format
=
""
;
$this
->
format
=
""
;
}
}
...
@@ -76,20 +77,10 @@ class TxImgCloud extends Cloud{
...
@@ -76,20 +77,10 @@ class TxImgCloud extends Cloud{
//获取签名
//获取签名
protected
function
getSign
()
protected
function
getSign
()
{
{
$file
=
"./runtime/data/ImgCloud_sign.dat"
;
$cache
=
getCache
(
3600
*
24
*
30
);
if
(
!
file_exists
(
"./runtime/data"
))
{
$key
=
"IMG_SIGN"
;
mkdir
(
"./runtime/data"
,
true
);
if
(
$cache
->
exists
(
$key
))
{
}
else
{
return
$cache
->
get
(
$key
);
@
chmod
(
"./runtime/data"
,
0777
);
}
if
(
file_exists
(
$file
))
{
$sign
=
file_get_contents
(
$file
);
if
(
$sign
)
{
$sign
=
json_decode
(
$sign
);
if
(
NOW_TIME
<
$sign
->
to_time
)
{
// return $sign->data;
}
}
}
}
$config
=
[
$config
=
[
'a'
=>
self
::
AppId
,
//appid
'a'
=>
self
::
AppId
,
//appid
...
@@ -106,7 +97,7 @@ class TxImgCloud extends Cloud{
...
@@ -106,7 +97,7 @@ class TxImgCloud extends Cloud{
}
}
$str
=
implode
(
"&"
,
$url
);
$str
=
implode
(
"&"
,
$url
);
$new_sign
=
base64_encode
(
hash_hmac
(
"sha1"
,
$str
,
self
::
SecretKey
,
true
)
.
$str
);
$new_sign
=
base64_encode
(
hash_hmac
(
"sha1"
,
$str
,
self
::
SecretKey
,
true
)
.
$str
);
file_put_contents
(
$file
,
json_encode
([
'to_time'
=>
$config
[
'e'
],
'data'
=>
$new_sign
])
);
$cache
->
save
(
$key
,
$new_sign
);
return
$new_sign
;
return
$new_sign
;
}
}
...
...
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