12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\api\controller\v1;
- use app\api\controller\Base;
- use app\hander\HelpHander;
- use think\Db;
- class PostReply extends Base
- {
- public function addReply(){
- $data=[
- 'post_id'=>input('postId'),
- 'content'=>trim(input('content')),
- 'user_id'=>$this->userId,
- 'enable'=>1,
- 'create_time'=>getTime(),
- 'update_time'=>getTime(),
- 'post_reply_id'=>input('replyId/d',0)
- ];
- if(!$data['content']){
- HelpHander::error('回复消息不能为空');
- }
- $ret=Db::name('post_reply')->insert($data);
- if($ret){
- HelpHander::success([],'回复成功');
- }else{
- HelpHander::error('回复失败');
- }
- }
- public function delReplay(){
- $id=input('id');
- $data=['del'=>1];
- $ret=Db::name('post_reply')
- ->where('id',$id)
- ->where('user_id',$this->userId)
- ->update($data);
- if($ret){
- HelpHander::success([],'删除成功');
- }else{
- HelpHander::error('删除失败');
- }
- }
- }
|