12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class NewsReply extends Base
- {
- public function addReply(){
- $data=[
- 'news_id'=>input('newsId'),
- 'content'=>trim(input('content')),
- 'user_id'=>$this->userId,
- 'enable'=>1,
- 'create_time'=>date('y-m-d h:i:s'),
- 'news_reply_id'=>input('replyId')
- ];
- if(!$data['content']){
- HelpHander::error('回复消息不能为空');
- }
- $ret=Db::name('news_reply')
- ->insert($data);
- if($ret){
- HelpHander::success([],'回复成功');
- }else{
- HelpHander::error('回复失败');
- }
- }
- public function delReplay(){
- $id=input('id');
- $data=['del'=>1];
- $ret=Db::name('news_reply')
- ->where('id',$id)
- ->where('user_id',$this->userId)
- ->update($data);
- if($ret){
- HelpHander::success([],'删除成功');
- }else{
- HelpHander::error('删除失败');
- }
- }
- }
|