Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
e9f54dc7
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e9f54dc7
编写于
3月 31, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
问答新增/编辑
上级
8e5b4d76
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
173 addition
and
17 deletion
+173
-17
application/admin/controller/Answer.php
application/admin/controller/Answer.php
+61
-0
application/admin/view/default/answer/index.html
application/admin/view/default/answer/index.html
+12
-3
application/admin/view/default/answer/save_info.html
application/admin/view/default/answer/save_info.html
+66
-0
application/api/controller/Answer.php
application/api/controller/Answer.php
+1
-1
application/plugins/answers/Index.php
application/plugins/answers/Index.php
+1
-1
application/plugins/commonrightnavigation/Index.php
application/plugins/commonrightnavigation/Index.php
+1
-1
application/service/AnswerService.php
application/service/AnswerService.php
+26
-6
config/shopxo.sql
config/shopxo.sql
+5
-5
未找到文件。
application/admin/controller/Answer.php
浏览文件 @
e9f54dc7
...
...
@@ -92,6 +92,67 @@ class Answer extends Common
return
$this
->
fetch
();
}
/**
* [SaveInfo 添加/编辑页面]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-14T21:37:02+0800
*/
public
function
SaveInfo
()
{
// 参数
$params
=
input
();
// 数据
$data
=
[];
if
(
!
empty
(
$params
[
'id'
]))
{
// 获取列表
$data_params
=
array
(
'm'
=>
0
,
'n'
=>
1
,
'where'
=>
[
'id'
=>
intval
(
$params
[
'id'
])],
'field'
=>
'*'
,
);
$ret
=
AnswerService
::
AnswerList
(
$data_params
);
$data
=
empty
(
$ret
[
'data'
][
0
])
?
[]
:
$ret
[
'data'
][
0
];
}
$this
->
assign
(
'data'
,
$data
);
// 状态
$this
->
assign
(
'common_is_show_list'
,
lang
(
'common_is_show_list'
));
// 是否
$this
->
assign
(
'common_is_text_list'
,
lang
(
'common_is_text_list'
));
// 参数
unset
(
$params
[
'id'
]);
$this
->
assign
(
'params'
,
$params
);
return
$this
->
fetch
();
}
/**
* [Save 保存]
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-25T22:36:12+0800
*/
public
function
Save
()
{
// 是否ajax请求
if
(
!
IS_AJAX
)
{
return
$this
->
error
(
'非法访问'
);
}
// 开始处理
$params
=
input
();
return
AnswerService
::
AnswerSave
(
$params
);
}
/**
* 问答删除
* @author Devil
...
...
application/admin/view/default/answer/index.html
浏览文件 @
e9f54dc7
...
...
@@ -39,6 +39,12 @@
</form>
<!-- form end -->
<!-- operation start -->
<div
class=
"am-g m-t-15"
>
<a
href=
"{{:MyUrl('admin/answer/saveinfo')}}"
class=
"am-btn am-btn-secondary am-radius am-btn-xs am-icon-plus"
>
新增
</a>
</div>
<!-- operation end -->
<!-- list start -->
<table
class=
"am-table am-table-striped am-table-hover am-text-middle m-t-10"
>
<thead>
...
...
@@ -93,7 +99,7 @@
<td>
{{$v.title}}
</td>
<td
class=
"am-hide-sm-only reply-content"
>
{{$v.content}}
</td>
<td
class=
"am-hide-sm-only reply-content"
>
{{if
$v['is_reply'] eq 1
}}
{{if
!empty($v['reply'])
}}
{{$v.reply}}
{{else /}}
<span
class=
"cr-ddd"
>
未回复
</span>
...
...
@@ -161,7 +167,7 @@
<dt>
回复内容
</dt>
<dd>
{{if
$v['is_reply'] eq 1
}}
{{if
!empty($v['reply'])
}}
{{$v.reply}}
{{else /}}
<span
class=
"cr-ddd"
>
未回复
</span>
...
...
@@ -182,8 +188,11 @@
</div>
</td>
<td
class=
"view-operation"
>
<a
href=
"{{:MyUrl('admin/answer/saveinfo', array_merge($params, ['id'=>$v['id']]))}}"
>
<button
class=
"am-btn am-btn-secondary am-btn-xs am-radius am-icon-edit"
>
编辑
</button>
</a>
{{if $v['is_reply'] eq 0}}
<button
class=
"am-btn am-btn-s
econdary
am-btn-xs am-radius submit-reply am-icon-gavel"
data-am-modal=
"{target: '#my-popup-reply'}"
data-json=
'{{:json_encode($v)}}'
>
回复
</button>
<button
class=
"am-btn am-btn-s
uccess
am-btn-xs am-radius submit-reply am-icon-gavel"
data-am-modal=
"{target: '#my-popup-reply'}"
data-json=
'{{:json_encode($v)}}'
>
回复
</button>
{{/if}}
<button
class=
"am-btn am-btn-danger am-btn-xs am-radius am-icon-trash-o submit-delete"
data-url=
"{{:MyUrl('admin/answer/delete')}}"
data-id=
"{{$v.id}}"
>
删除
</button>
</td>
...
...
application/admin/view/default/answer/save_info.html
0 → 100644
浏览文件 @
e9f54dc7
{{include file="public/header" /}}
<!-- right content start -->
<div
class=
"content-right"
>
<div
class=
"content"
>
<!-- form start -->
<form
class=
"am-form form-validation view-save"
action=
"{{:MyUrl('admin/answer/save')}}"
method=
"POST"
request-type=
"ajax-url"
request-value=
"{{:MyUrl('admin/answer/index', $params)}}"
enctype=
"multipart/form-data"
>
<legend>
<span
class=
"fs-16"
>
{{if empty($data['id'])}}
问答添加
{{else /}}
问答编辑
{{/if}}
</span>
<a
href=
"{{:MyUrl('admin/answer/index', $params)}}"
class=
"fr fs-14 m-t-5 am-icon-mail-reply"
>
返回
</a>
</legend>
<div
class=
"am-form-group"
>
<label>
联系人
</label>
<input
type=
"text"
name=
"name"
placeholder=
"联系人"
maxlength=
"30"
data-validation-message=
"联系人格式最多 30 个字符"
class=
"am-radius"
value=
"{{if !empty($data['name'])}}{{$data.name}}{{/if}}"
/>
</div>
<div
class=
"am-form-group"
>
<label>
电话
</label>
<input
type=
"text"
name=
"tel"
placeholder=
"电话"
data-validation-message=
"请填写电话"
class=
"am-radius"
value=
"{{if !empty($data['tel'])}}{{$data.tel}}{{/if}}"
/>
</div>
<div
class=
"am-form-group"
>
<label>
标题
</label>
<input
type=
"text"
name=
"title"
placeholder=
"标题"
maxlength=
"60"
data-validation-message=
"标题格式最多 60 个字符"
class=
"am-radius"
value=
"{{if !empty($data['title'])}}{{$data.title}}{{/if}}"
/>
</div>
<div
class=
"am-form-group"
>
<label>
访问次数
</label>
<input
type=
"number"
name=
"access_count"
placeholder=
"访问次数"
data-validation-message=
"请填写有效的访问次数"
class=
"am-radius"
value=
"{{if !empty($data['access_count'])}}{{$data.access_count}}{{else /}}0{{/if}}"
/>
</div>
<div
class=
"am-form-group"
>
<label>
内容
<span
class=
"am-form-group-label-tips-must"
>
必填
</span></label>
<textarea
class=
"am-radius am-validate"
name=
"content"
rows=
"5"
minlength=
"5"
maxlength=
"230"
placeholder=
"5~230个字符之间"
data-validation-message=
"内容格式 5~230 个字符之间"
required
>
{{if !empty($data['content'])}}{{$data.content}}{{/if}}
</textarea>
</div>
<div
class=
"am-form-group"
>
<label>
回复内容
</label>
<textarea
class=
"am-radius am-validate"
name=
"reply"
rows=
"5"
maxlength=
"230"
placeholder=
"最多 230 个字符"
data-validation-message=
"内容格式最多 230 个字符"
>
{{if !empty($data['reply'])}}{{$data.reply}}{{/if}}
</textarea>
</div>
<div
class=
"am-form-group"
>
<label
class=
"block"
>
是否已回复
</label>
<input
name=
"is_reply"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
isset
($
data
['
is_reply
'])
and
$
data
['
is_reply
']
eq
1}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group"
>
<label
class=
"block"
>
是否显示
</label>
<input
name=
"is_show"
value=
"1"
type=
"checkbox"
data-off-text=
"否"
data-on-text=
"是"
data-size=
"xs"
data-on-color=
"success"
data-off-color=
"default"
data-handle-width=
"50"
data-am-switch
{{
if
isset
($
data
['
is_show
'])
and
$
data
['
is_show
']
eq
1}}
checked=
"true"
{{/
if
}}
/>
</div>
<div
class=
"am-form-group am-form-group-refreshing"
>
<input
type=
"hidden"
name=
"id"
{{
if
!
empty
($
data
['
id
'])}}
value=
"{{$data.id}}"
{{/
if
}}
/>
<input
type=
"hidden"
name=
"user_id"
{{
if
!
empty
($
data
['
user_id
'])}}
value=
"{{$data.user_id}}"
{{/
if
}}
/>
<button
type=
"submit"
class=
"am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100"
data-am-loading=
"{loadingText:'处理中...'}"
>
保存
</button>
</div>
</form>
<!-- form end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->
\ No newline at end of file
application/api/controller/Answer.php
浏览文件 @
e9f54dc7
...
...
@@ -94,7 +94,7 @@ class Answer extends Common
$params
=
$this
->
data_post
;
$params
[
'user'
]
=
$this
->
user
;
return
AnswerService
::
A
dd
(
$params
);
return
AnswerService
::
A
nswerSave
(
$params
);
}
}
?>
\ No newline at end of file
application/plugins/answers/Index.php
浏览文件 @
e9f54dc7
...
...
@@ -218,7 +218,7 @@ class Index extends Controller
{
$params
=
input
(
'post.'
);
$params
[
'user'
]
=
UserService
::
LoginUserInfo
();
return
AnswerService
::
A
dd
(
$params
);
return
AnswerService
::
A
nswerSave
(
$params
);
}
}
?>
\ No newline at end of file
application/plugins/commonrightnavigation/Index.php
浏览文件 @
e9f54dc7
...
...
@@ -36,7 +36,7 @@ class Index extends Controller
{
$params
=
input
(
'post.'
);
$params
[
'user'
]
=
UserService
::
LoginUserInfo
();
return
AnswerService
::
A
dd
(
$params
);
return
AnswerService
::
A
nswerSave
(
$params
);
}
/**
...
...
application/service/AnswerService.php
浏览文件 @
e9f54dc7
...
...
@@ -162,7 +162,7 @@ class AnswerService
}
/**
* 用户留言
添加
* 用户留言
保存
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
...
...
@@ -170,7 +170,7 @@ class AnswerService
* @desc description
* @param [array] $params [输入参数]
*/
public
static
function
A
dd
(
$params
=
[])
public
static
function
A
nswerSave
(
$params
=
[])
{
// 参数校验
$p
=
[
...
...
@@ -207,18 +207,38 @@ class AnswerService
// 开始操作
$data
=
[
'user_id'
=>
isset
(
$params
[
'user'
][
'id'
])
?
intval
(
$params
[
'user'
][
'id'
])
:
0
,
'user_id'
=>
isset
(
$params
[
'user'
][
'id'
])
?
intval
(
$params
[
'user'
][
'id'
])
:
(
isset
(
$params
[
'user_id'
])
?
intval
(
$params
[
'user_id'
])
:
0
)
,
'name'
=>
isset
(
$params
[
'name'
])
?
$params
[
'name'
]
:
''
,
'tel'
=>
isset
(
$params
[
'tel'
])
?
$params
[
'tel'
]
:
''
,
'title'
=>
isset
(
$params
[
'title'
])
?
$params
[
'title'
]
:
''
,
'content'
=>
$params
[
'content'
],
'reply'
=>
isset
(
$params
[
'reply'
])
?
$params
[
'reply'
]
:
''
,
'access_count'
=>
isset
(
$params
[
'access_count'
])
?
intval
(
$params
[
'access_count'
])
:
0
,
'is_reply'
=>
isset
(
$params
[
'is_reply'
])
?
intval
(
$params
[
'is_reply'
])
:
0
,
'is_show'
=>
isset
(
$params
[
'is_show'
])
?
intval
(
$params
[
'is_show'
])
:
0
,
'add_time'
=>
time
(),
];
if
(
Db
::
name
(
'Answer'
)
->
insertGetId
(
$data
)
>
0
)
// 回复时间
$data
[
'reply_time'
]
=
(
isset
(
$data
[
'is_reply'
])
&&
$data
[
'is_reply'
]
==
1
)
?
time
()
:
0
;
// 不存在添加,则更新
if
(
empty
(
$params
[
'id'
]))
{
return
DataReturn
(
'提交成功'
,
0
);
$data
[
'add_time'
]
=
time
();
if
(
Db
::
name
(
'Answer'
)
->
insertGetId
(
$data
)
>
0
)
{
return
DataReturn
(
'提交成功'
,
0
);
}
return
DataReturn
(
'提交失败'
,
-
100
);
}
else
{
$data
[
'upd_time'
]
=
time
();
if
(
Db
::
name
(
'Answer'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
update
(
$data
))
{
return
DataReturn
(
'编辑成功'
,
0
);
}
return
DataReturn
(
'编辑失败'
,
-
100
);
}
return
DataReturn
(
'提交失败'
,
-
100
);
}
/**
...
...
config/shopxo.sql
浏览文件 @
e9f54dc7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录