Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
pingan-marathon
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e12e0e22
authored
Nov 11, 2019
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
cd336f47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
60 deletions
+103
-60
Application/Common/Conf/config.php
+1
-1
Application/Home/Controller/IndexController.class.php
+78
-55
Public/static/js/common.js
+24
-4
No files found.
Application/Common/Conf/config.php
View file @
e12e0e22
...
...
@@ -35,7 +35,7 @@ return array(
'driverConfig'
=>
array
(
'accessKey'
=>
'ggMPohY9_87Q69nDYUMwvR7XqlLYAREH-btbJG3U'
,
'secrectKey'
=>
'OPzIqCWVMDs7tAYjPi9Hn7JkxBj2CtHARCCEnrdd'
,
'domain'
=>
'
7xou29.media1.z0.glb.clouddn.com
'
,
'domain'
=>
'
geely-cdn.izhida.cn
'
,
'bucket'
=>
'zhida-stream'
,
// 'domain' => '7xjtzd.com2.z0.glb.qiniucdn.com',
// 'bucket' => 'zhida-yingxiaoyi',
...
...
Application/Home/Controller/IndexController.class.php
View file @
e12e0e22
...
...
@@ -26,7 +26,13 @@ class IndexController extends Controller
public
function
index
()
{
$this
->
display
();
$user
=
$this
->
get_user_info_from_cookie
();
// 如果没有获取到用户信息,引导用户授权
if
(
!
$user
)
{
$this
->
request_auth
(
$this
->
get_url
());
return
;
}
$this
->
display
();
}
public
function
detectSensitiveWords
(
$text
){
...
...
@@ -78,61 +84,78 @@ class IndexController extends Controller
}
}
// private function detectSensitiveWords($name){
// $text = $name;
// $resp = file_get_contents('http://nex3-avatar.dev.izhida.cn/index/detectSensitiveWords?text='.$text);
// // $text = $name;
// // $text = '胡锦涛';
// // $cred = new Credential("AKID9B4pPq5YBgz9Yo7qDRkspgOQK3c89PrD", "MXWK3DKNFzYgpvWwCKH4kKoma0O1Yu8A");
// // $httpProfile = new HttpProfile();
// // $httpProfile->setEndpoint("nlp.tencentcloudapi.com");
public
function
upload
()
{
$user
=
$this
->
get_user_info_from_cookie
();
if
(
!
$user
)
{
$this
->
ajaxReturn
(
array
(
'status'
=>
404
,
'msg'
=>
'用户不存在'
));
return
;
}
if
(
!
$_POST
[
'image'
])
{
$this
->
ajaxReturn
(
array
(
'status'
=>
-
1
,
'msg'
=>
'请填写完整信息'
));
return
;
}
$url
=
$this
->
saveCommonImageToQiniu
(
$_POST
[
'image'
],
uniqid
(
'missfresh_poster__'
));
if
(
$_POST
[
'source'
]
==
'poster'
)
{
M
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
save
([
'poster_url'
=>
$url
,
]);
$this
->
ajaxReturn
(
array
(
'status'
=>
1
,
'img_url'
=>
$url
,
'msg'
=>
'信息提交成功!'
));
return
;
}
else
{
M
(
'User'
)
->
where
([
'id'
=>
$user
[
'id'
]])
->
save
([
'headposter_url'
=>
$url
,
]);
$this
->
ajaxReturn
(
array
(
'status'
=>
1
,
'img_url'
=>
$url
,
'msg'
=>
'信息提交成功!'
));
return
;
}
// // $clientProfile = new ClientProfile();
// // $clientProfile->setHttpProfile($httpProfile);
// // $client = new NlpClient($cred, "ap-guangzhou", $clientProfile);
// // $req = new SensitiveWordsRecognitionRequest();
// // $params = '{"Text":"+'. $text .'+"}';
// // $req->fromJsonString($params);
// // $resp = $client->SensitiveWordsRecognition($req);
// // $resp = $resp->toJsonString();
// // return $resp;
// return json_decode($resp,1);
// }
// public function checkWord() {
// $name = $_POST['name'];
// if(empty($name))
// {
// $this->ajaxReturn(array(
// 'status' => 0,
// 'msg' => '非法',
// 'step' => 3
// ));
// return;
// }
// $detectResult = $this->detectSensitiveWords($name);
// if($detectResult['SensitiveWords'] != null)
// {
// $this->ajaxReturn(array(
// 'status' => -1,
// 'msg' => '您提交的姓名包含敏感词',
// 'step' => 3
// ));
// return;
// }
// else
// {
// $this->ajaxReturn(array(
// 'status' => 1,
// 'msg' => '通过',
// 'step' => 3
// ));
// return;
// }
// }
}
private
function
saveCommonImageToQiniu
(
$imgData
,
$fileNameWithoutExt
)
{
$head
=
substr
(
$imgData
,
0
,
20
);
$type
=
'png'
;
if
(
stripos
(
$head
,
'data:image/jpg;'
)
!==
false
||
stripos
(
$head
,
'data:image/jpeg;'
)
!==
false
)
{
$type
=
'jpg'
;
$imgData
=
substr
(
$imgData
,
strlen
(
'data:image/jpeg;base64,'
));
}
else
{
$imgData
=
substr
(
$imgData
,
strlen
(
'data:image/png;base64,'
));
}
$imgData
=
str_replace
(
' '
,
'+'
,
$imgData
);
$data
=
base64_decode
(
$imgData
);
if
(
strlen
(
$data
)
==
0
)
{
return
false
;
}
$fileName
=
$fileNameWithoutExt
.
'.'
.
$type
;
$upfile
=
array
(
'name'
=>
'file'
,
'fileName'
=>
$fileName
,
'fileBody'
=>
$data
,
);
$config
=
C
(
'UPLOAD_SITEIMG_QINIU'
)[
'driverConfig'
];
$qiniu
=
new
QiniuStorage
(
$config
);
$opt
=
array
();
$result
=
$qiniu
->
upload
(
$opt
,
$upfile
);
$url
=
$qiniu
->
downlink
(
$fileName
);
return
$url
;
}
// 计算中文字符串长度
function
utf8_strlen
(
$string
=
null
)
{
...
...
Public/static/js/common.js
View file @
e12e0e22
...
...
@@ -260,7 +260,10 @@ function creatPoster() {
txtDraw
(
posterctx
,
$
(
'[name=customize]'
).
val
(),
50
,
'normal'
,
'#fff'
,
90
,
231
);
$
(
'#poster'
).
attr
(
'src'
,
getManBase64
(
posterCanvas
));
var
src
=
getManBase64
(
posterCanvas
);
$
(
'#poster'
).
attr
(
'src'
,
src
);
uplodImg
(
'poster'
,
src
);
$
(
'.upload-page'
).
fadeOut
(
300
);
$
(
'.poster-page'
).
fadeIn
(
300
);
...
...
@@ -294,7 +297,10 @@ function creatPoster() {
frameimg
.
onload
=
function
()
{
posterctx
.
drawImage
(
frameimg
,
51
*
2
,
184
*
2
,
387
*
2
,
387
*
2
);
$
(
'#poster'
).
attr
(
'src'
,
getManBase64
(
posterCanvas
));
var
src
=
getManBase64
(
posterCanvas
);
$
(
'#poster'
).
attr
(
'src'
,
src
);
uplodImg
(
'poster'
,
src
);
$
(
'.upload-page'
).
fadeOut
(
300
);
$
(
'.poster-page'
).
fadeIn
(
300
);
...
...
@@ -352,7 +358,10 @@ function createHeadimg() {
txtDraw
(
headimgctx
,
$
(
'[name=customize]'
).
val
(),
41
,
'normal'
,
'#fff'
);
headimgctx
.
restore
();
$
(
'#headimg'
).
attr
(
'src'
,
getManBase64
(
headimgCanvas
));
var
src
=
getManBase64
(
headimgCanvas
);
$
(
'#headimg'
).
attr
(
'src'
,
src
);
uplodImg
(
'headimg'
,
src
);
$
(
'.upload-page'
).
fadeOut
(
300
);
$
(
'.headimg-page'
).
delay
(
0
).
fadeIn
(
300
);
...
...
@@ -380,7 +389,10 @@ function createHeadimg() {
frameimg
.
onload
=
function
()
{
headimgctx
.
drawImage
(
frameimg
,
0
,
0
,
headimgCanvas
.
width
,
headimgCanvas
.
height
);
$
(
'#headimg'
).
attr
(
'src'
,
getManBase64
(
headimgCanvas
));
var
src
=
getManBase64
(
headimgCanvas
);
$
(
'#headimg'
).
attr
(
'src'
,
src
);
uplodImg
(
'headimg'
,
src
);
$
(
'.upload-page'
).
fadeOut
(
300
);
$
(
'.headimg-page'
).
delay
(
0
).
fadeIn
(
300
);
...
...
@@ -390,6 +402,14 @@ function createHeadimg() {
}
function
uploadImg
(
source
,
src
)
{
$
.
ajax
({
type
:
"POST"
,
url
:
"Index/upload"
,
data
:
{
image
:
src
,
source
:
source
}
});
}
function
homeBtnGoHandleClick
()
{
$
(
'.subtitle,.copywriting1,.btn-go'
).
fadeOut
(
300
);
...
...
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