2020-06-28 11:32:50 +08:00
|
|
|
|
<?php
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | CatchAdmin [Just Like ~ ]
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
// | Author: JaguarJack [ njphper@gmail.com ]
|
|
|
|
|
// +----------------------------------------------------------------------
|
2020-06-29 19:51:44 +08:00
|
|
|
|
namespace catchAdmin\wechat\controller;
|
|
|
|
|
|
|
|
|
|
use catchAdmin\wechat\repository\WechatReplyRepository;
|
|
|
|
|
use catcher\base\CatchController;
|
|
|
|
|
use catcher\base\CatchRequest;
|
|
|
|
|
use catcher\CatchResponse;
|
|
|
|
|
|
|
|
|
|
class Reply extends CatchController
|
|
|
|
|
{
|
|
|
|
|
protected $reply;
|
|
|
|
|
|
|
|
|
|
public function __construct(WechatReplyRepository $reply)
|
|
|
|
|
{
|
|
|
|
|
$this->reply = $reply;
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-29 22:04:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* 列表
|
|
|
|
|
*
|
|
|
|
|
* @time 2020年06月29日
|
|
|
|
|
* @param CatchRequest $request
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
*/
|
2020-06-29 19:51:44 +08:00
|
|
|
|
public function index(CatchRequest $request)
|
|
|
|
|
{
|
|
|
|
|
return CatchResponse::paginate($this->reply->getList());
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-13 10:05:22 +08:00
|
|
|
|
/**
|
|
|
|
|
* 读取
|
|
|
|
|
*
|
|
|
|
|
* @time 2020年09月13日
|
|
|
|
|
* @param $id
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
*/
|
|
|
|
|
public function read($id)
|
|
|
|
|
{
|
|
|
|
|
return CatchResponse::success($this->reply->findBy($id));
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-29 22:04:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* 保存
|
|
|
|
|
*
|
|
|
|
|
* @time 2020年06月29日
|
|
|
|
|
* @param CatchRequest $request
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
*/
|
2020-06-29 19:51:44 +08:00
|
|
|
|
public function save(CatchRequest $request)
|
|
|
|
|
{
|
|
|
|
|
return CatchResponse::success($this->reply->storeBy($request->param()));
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-13 10:05:22 +08:00
|
|
|
|
/**
|
|
|
|
|
* 更新
|
|
|
|
|
*
|
|
|
|
|
* @time 2020年09月13日
|
|
|
|
|
* @param $id
|
|
|
|
|
* @param CatchRequest $request
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
*/
|
|
|
|
|
public function update($id, CatchRequest $request)
|
|
|
|
|
{
|
|
|
|
|
return CatchResponse::success($this->reply->updateBy($id, $request->param()));
|
|
|
|
|
}
|
2020-06-29 22:04:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* 删除
|
|
|
|
|
*
|
|
|
|
|
* @time 2020年06月29日
|
|
|
|
|
* @param $id
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
*/
|
|
|
|
|
public function delete($id)
|
2020-06-29 19:51:44 +08:00
|
|
|
|
{
|
2020-06-29 22:04:40 +08:00
|
|
|
|
return CatchResponse::success($this->reply->deleteBy($id));
|
2020-06-29 19:51:44 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-06-29 22:04:40 +08:00
|
|
|
|
/**
|
|
|
|
|
* 禁用启用
|
|
|
|
|
*
|
|
|
|
|
* @time 2020年06月29日
|
|
|
|
|
* @param $id
|
|
|
|
|
* @return \think\response\Json
|
|
|
|
|
*/
|
|
|
|
|
public function disOrEnable($id)
|
2020-06-29 19:51:44 +08:00
|
|
|
|
{
|
2020-06-29 22:04:40 +08:00
|
|
|
|
return CatchResponse::success($this->reply->disOrEnable($id));
|
2020-06-29 19:51:44 +08:00
|
|
|
|
}
|
|
|
|
|
}
|