Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenDocCN
yii2_fecshop
提交
f41b5f70
Y
yii2_fecshop
项目概览
OpenDocCN
/
yii2_fecshop
通知
18
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
yii2_fecshop
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f41b5f70
编写于
9月 30, 2017
作者:
T
Terry
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
appserver contact us send email
上级
226f031f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
124 addition
and
0 deletion
+124
-0
app/appserver/modules/Customer/controllers/ContactController.php
...server/modules/Customer/controllers/ContactController.php
+124
-0
未找到文件。
app/appserver/modules/Customer/controllers/ContactController.php
0 → 100644
浏览文件 @
f41b5f70
<?php
/**
* FecShop file.
*
* @link http://www.fecshop.com/
* @copyright Copyright (c) 2016 FecShop Software LLC
* @license http://www.fecshop.com/license/
*/
namespace
fecshop\app\appserver\modules\Customer\controllers
;
use
fecshop\app\appserver\modules\AppserverController
;
use
Yii
;
/**
* @author Terry Zhao <2358269014@qq.com>
* @since 1.0
*/
class
ContactController
extends
AppserverController
{
public
$enableCsrfValidation
=
false
;
/**
* 登录用户的部分
*/
public
function
actionIndex
(){
$identity
=
Yii
::
$service
->
customer
->
loginByAccessToken
(
get_class
(
$this
));
$customer_name
=
''
;
$customer_email
=
''
;
if
(
$identity
){
$customer_name
=
$identity
[
'firstname'
]
.
' '
.
$identity
[
'lastname'
];
$customer_email
=
$identity
[
'email'
];
}
$contactsEmail
=
''
;
$contactsCaptcha
=
false
;
$contacts
=
Yii
::
$app
->
getModule
(
'customer'
)
->
params
[
'contacts'
];
if
(
isset
(
$contacts
[
'contactsCaptcha'
]))
{
$contactsCaptcha
=
$contacts
[
'contactsCaptcha'
]
?
true
:
false
;
}
if
(
isset
(
$contacts
[
'email'
][
'address'
]))
{
$contactsEmail
=
$contacts
[
'email'
][
'address'
];
}
if
(
!
$contactsEmail
)
{
$contactsEmail
=
Yii
::
$service
->
email
->
contactsEmailAddress
();
}
return
[
'code'
=>
200
,
'customer_name'
=>
$customer_name
,
'customer_email'
=>
$customer_email
,
'contactsCaptchaActive'
=>
$contactsCaptcha
,
'contactsEmail'
=>
$contactsEmail
,
];
}
public
function
actionSubmit
(){
$customer_name
=
Yii
::
$app
->
request
->
post
(
'customer_name'
);
$email
=
Yii
::
$app
->
request
->
post
(
'email'
);
$telephone
=
Yii
::
$app
->
request
->
post
(
'telephone'
);
$comment
=
Yii
::
$app
->
request
->
post
(
'comment'
);
$captcha
=
Yii
::
$app
->
request
->
post
(
'captcha'
);
if
(
!
$customer_name
){
return
[
'code'
=>
401
,
'content'
=>
'customer name can not empty'
,
];
}
if
(
!
$email
){
return
[
'code'
=>
401
,
'content'
=>
'email can not empty'
,
];
}
if
(
!
$telephone
){
return
[
'code'
=>
401
,
'content'
=>
'telephone can not empty'
,
];
}
if
(
!
$comment
){
return
[
'code'
=>
401
,
'content'
=>
'comment can not empty'
,
];
}
$contacts
=
Yii
::
$app
->
getModule
(
'customer'
)
->
params
[
'contacts'
];
$contactsCaptcha
=
$contacts
[
'contactsCaptcha'
]
?
true
:
false
;
if
(
$contactsCaptcha
){
if
(
!
Yii
::
$service
->
helper
->
captcha
->
validateCaptcha
(
$captcha
)){
return
[
'code'
=>
401
,
'content'
=>
'captcha ['
.
$captcha
.
'] is not right'
,
];
}
}
// 开始保存
$paramData
=
[
'name'
=>
$customer_name
,
'telephone'
=>
$telephone
,
'comment'
=>
$comment
,
'email'
=>
$email
,
];
if
(
Yii
::
$service
->
email
->
customer
->
sendContactsEmail
(
$paramData
))
{
return
[
'code'
=>
200
,
'content'
=>
'contact us success'
];
}
else
{
return
[
'code'
=>
401
,
'content'
=>
'contact us fail'
];
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录