|
|
<?php
|
|
|
|
|
|
namespace app\base\controller\wechat\admin;
|
|
|
|
|
|
use ali\oss\Oss;
|
|
|
use app\base\logic\weixin\Material;
|
|
|
use app\base\model\wechat\WechatClassify;
|
|
|
use app\base\model\wechat\WechatNews;
|
|
|
use app\base\model\wechat\WechatReply;
|
|
|
use app\BaseController;
|
|
|
use think\App;
|
|
|
use think\facade\View;
|
|
|
use EasyWeChat\Factory;
|
|
|
|
|
|
|
|
|
class Wechat extends BaseController
|
|
|
{
|
|
|
protected $easyWechatConfig; //easywechat微信配置文件
|
|
|
|
|
|
public function __construct(App $app)
|
|
|
{
|
|
|
parent::__construct($app);
|
|
|
|
|
|
$uid = input('param.uid');
|
|
|
defined('UID') || define('UID', $uid);
|
|
|
|
|
|
$weixin_param = get_weixin_config();
|
|
|
$this->easyWechatConfig = [
|
|
|
'app_id' => $weixin_param['app_id'],
|
|
|
'secret' => $weixin_param['app_secret'],
|
|
|
'token' => $weixin_param['token'],
|
|
|
'response_type' => 'array',
|
|
|
|
|
|
//日志 配置
|
|
|
'log' => [
|
|
|
'default' => 'dev', // 默认使用的 channel,生产环境可以改为下面的 prod
|
|
|
'channels' => [
|
|
|
// 测试环境
|
|
|
'dev' => [
|
|
|
'driver' => 'daily',
|
|
|
'path' => root_path() . 'runtime/easywechat/easywechat.log',
|
|
|
'level' => 'debug',
|
|
|
'days' => 1
|
|
|
]
|
|
|
],
|
|
|
],
|
|
|
|
|
|
//OAuth 配置
|
|
|
'oauth' => [
|
|
|
'scopes' => ['snsapi_userinfo'],
|
|
|
],
|
|
|
];
|
|
|
}
|
|
|
|
|
|
public function classify()
|
|
|
{
|
|
|
$classify_model = new WechatClassify();
|
|
|
if (request()->isPost()) {
|
|
|
$data = input('post.');
|
|
|
$data['uid'] = UID;
|
|
|
|
|
|
if (isset($data['name_0'])) {
|
|
|
$classify_one_name = $data['name_0'];
|
|
|
foreach ($classify_one_name as $k => $v) {
|
|
|
$button = [];
|
|
|
$cur = $k + 1;
|
|
|
if (!isset($data['type_' . $cur])) { //二级菜单不存在
|
|
|
if (!$data['type_0'][$k]) {
|
|
|
return ['ret' => 0, 'msg' => '请将自定义菜单填写完整'];
|
|
|
}
|
|
|
$button = ['name' => $v, 'type' => $data['type_0'][$k], 'content' => $data['content_0'][$k]];
|
|
|
} else { //二级菜单存在
|
|
|
$button['name'] = $v;
|
|
|
foreach ($data['type_' . $cur] as $k1 => $v1) {
|
|
|
if (!$v1) {
|
|
|
return ['ret' => 0, 'msg' => '请将自定义菜单填写完整'];
|
|
|
} else {
|
|
|
$button['sub_button'][] = ['name' => $data['name_' . $cur][$k1], 'type' => $v1, 'content' => $data['content_' . $cur][$k1]];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$classify[] = $button;
|
|
|
}
|
|
|
|
|
|
$data['content'] = $classify;
|
|
|
} else {
|
|
|
$data['content'] = '';
|
|
|
}
|
|
|
|
|
|
|
|
|
$res = $classify_model->dataUpdate($data);
|
|
|
if (!$res) {
|
|
|
return sendErrorMessage();
|
|
|
}
|
|
|
return sendSuccessMessage();
|
|
|
} else {
|
|
|
$data = $classify_model->getOneData(['uid' => UID]);
|
|
|
View::assign('data', $data);
|
|
|
return View::fetch();
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 发布菜单 2017-10-15
|
|
|
*/
|
|
|
public function classifypublish()
|
|
|
{
|
|
|
$classify_model = new WechatClassify();
|
|
|
$wechat_logic = new \app\base\logic\Wechat();
|
|
|
|
|
|
//自定义菜单格式化
|
|
|
$data = $classify_model->getOneData(['uid' => UID]);
|
|
|
$classify = [];
|
|
|
foreach ($data['content'] as $k => $v) {
|
|
|
$button = [];
|
|
|
if (isset($v['sub_button'])) { //二级菜单存在
|
|
|
$button['name'] = $v['name'];
|
|
|
foreach ($v['sub_button'] as $vv) {
|
|
|
$button['sub_button'][] = $classify_model->buttonFormat($vv['name'], $vv['type'], $vv['content']);
|
|
|
}
|
|
|
} else { //二级菜单不存在
|
|
|
$button = $classify_model->buttonFormat($v['name'], $v['type'], $v['content']);
|
|
|
}
|
|
|
$classify[] = $button;
|
|
|
}
|
|
|
|
|
|
//发布菜单
|
|
|
$res = $wechat_logic->classifyPublish($classify);
|
|
|
if ($res['errcode'] == 0) {
|
|
|
return sendSuccessMessage([], '菜单发布成功');
|
|
|
} else {
|
|
|
return sendErrorMessage(4001, $res['errmsg']);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除菜单 2017-10-15
|
|
|
*/
|
|
|
public function classifydel()
|
|
|
{
|
|
|
$weixin_classify_model = new WechatClassify();
|
|
|
$wechat_logic = new \app\base\logic\Wechat();
|
|
|
|
|
|
$res = $wechat_logic->classifyDel();
|
|
|
if ($res['errcode'] == 0) {
|
|
|
return sendSuccessMessage([], '菜单删除成功');
|
|
|
} else {
|
|
|
return sendErrorMessage(4001, $res['errmsg']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 设置菜单操作浮层
|
|
|
* @return string
|
|
|
*/
|
|
|
public function loadclassify()
|
|
|
{
|
|
|
$data = input('post.');
|
|
|
$data['keywords_id'] = 0;
|
|
|
$data['linkurl'] = '';
|
|
|
$data['appid'] = '';
|
|
|
$data['pagepath'] = '';
|
|
|
$data['url'] = '';
|
|
|
|
|
|
if ($data['type'] == 'click') {
|
|
|
$data['keywords_id'] = $data['content'];
|
|
|
} else if ($data['type'] == 'view') {
|
|
|
$data['linkurl'] = $data['content'];
|
|
|
} else if ($data['type'] == 'miniprogram') {
|
|
|
$data['content'] = explode(' ', $data['content']);
|
|
|
$data['appid'] = $data['content'][0];
|
|
|
$data['pagepath'] = $data['content'][1];
|
|
|
$data['url'] = $data['content'][2];
|
|
|
}
|
|
|
$reply_model = new WechatReply();
|
|
|
$keywordsList = $reply_model->getAllData(['trigger_type' => 1, 'uid' => UID]);
|
|
|
View::assign('data', $data);
|
|
|
View::assign('keywordsList', $keywordsList);
|
|
|
return View::fetch('loadclassify');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 菜单操作报存
|
|
|
* @return \think\response\Json
|
|
|
*/
|
|
|
public function classifysave()
|
|
|
{
|
|
|
$data = input('post.');
|
|
|
if ($data['type'] == 'click') {
|
|
|
$data['content'] = $data['keywords_id'];
|
|
|
} else if ($data['type'] == 'view') {
|
|
|
$data['content'] = $data['linkurl'];
|
|
|
} else if ($data['type'] == 'miniprogram') {
|
|
|
$data['content'] = $data['appid'] . ' ' . $data['pagepath'] . ' ' . $data['url'];
|
|
|
}
|
|
|
return sendSuccessMessage($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 图文素材列表
|
|
|
* @return mixed
|
|
|
*/
|
|
|
public function news()
|
|
|
{
|
|
|
$search = input('get.');
|
|
|
autoSearch(['keyword'], $search);
|
|
|
View::assign('search', $search);
|
|
|
$page = array_key_exists("page", $search) ? (string)$search['page'] : "1";
|
|
|
$where = [
|
|
|
'uid' => UID,
|
|
|
];
|
|
|
$news_model = new WechatNews();
|
|
|
$dataList = $news_model->getDataList($where, $page, '*', 'id desc');
|
|
|
View::assign('dataList', $dataList);
|
|
|
return View::fetch();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 添加图文素材
|
|
|
* @return array
|
|
|
*/
|
|
|
public function newsadd()
|
|
|
{
|
|
|
$news_model = new WechatNews();
|
|
|
if (request()->isPost()) {
|
|
|
$data = input('post.');
|
|
|
if (empty($data['title'])) {
|
|
|
return ['ret' => 0, 'msg' => '请至少添加一条完整图文消息'];
|
|
|
}
|
|
|
//数据信息
|
|
|
foreach ($data['title'] as $k => $v) {
|
|
|
if (!$v || !$data['image'][$k]) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
$data['content'][] = [
|
|
|
'title' => $v,
|
|
|
'description' => $data['description'][$k],
|
|
|
'image' => $data['image'][$k],
|
|
|
'url' => $data['url'][$k],
|
|
|
];
|
|
|
}
|
|
|
if (empty($data['content'])) {
|
|
|
return ['ret' => 0, 'msg' => '请至少添加一条完整图文消息1'];
|
|
|
}
|
|
|
$data['uid'] = UID;
|
|
|
$res = $news_model->dataUpdate($data);
|
|
|
if (!$res) {
|
|
|
return sendErrorMessage();
|
|
|
}
|
|
|
return sendSuccessMessage();
|
|
|
}
|
|
|
$id = input('param.id', 0);
|
|
|
$data = $news_model->getOneData(['id' => $id]);
|
|
|
|
|
|
View::assign('data', $data);
|
|
|
return View::fetch('newsadd');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 修改图文素材
|
|
|
* @return array
|
|
|
*/
|
|
|
public function newsupdate()
|
|
|
{
|
|
|
return $this->newsadd();
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 同步图文素材
|
|
|
* @date 2022-12-01
|
|
|
*/
|
|
|
public function updatePlatformNews()
|
|
|
{
|
|
|
$news_model = new WechatNews();
|
|
|
$wechat_logic = new \app\base\logic\Wechat();
|
|
|
|
|
|
$oss_param = get_ali_oss_config();
|
|
|
$ali_config = $oss_param;
|
|
|
$oss_class = new Oss($ali_config);
|
|
|
$material_logic = new Material();
|
|
|
|
|
|
// 获取所有素材
|
|
|
$news_list = $material_logic->listMaterial('news');
|
|
|
|
|
|
|
|
|
$media_ids = $news_model->where('media_id', 'not null')->column('id', 'media_id');
|
|
|
|
|
|
foreach ($news_list as $k => $v) {
|
|
|
if (array_key_exists($v['media_id'], $media_ids)) {
|
|
|
$data['id'] = $media_ids[$v['media_id']];
|
|
|
}
|
|
|
|
|
|
$data['media_id'] = $v['media_id'];
|
|
|
$data['platform_news_content'] = $v;
|
|
|
$data['name'] = $v['content']['news_item'][0]['title'];
|
|
|
$data['uid'] = UID;
|
|
|
$data['type'] = 2;
|
|
|
|
|
|
$content = [];
|
|
|
foreach ($v['content']['news_item'] as $k1 => $v1) {
|
|
|
$stream = $wechat_logic->getPermanentMaterial($v1['thumb_media_id']);
|
|
|
$picurl = '';
|
|
|
if ($stream instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
|
|
|
// 以内容 md5 为文件名
|
|
|
$file_path = $stream->save('./temp/', md5(microtime(true)));
|
|
|
$result = $oss_class->uploadFile('./temp/' . $file_path, 'uid' . UID . '/member/' . date("Ymd"));
|
|
|
$picurl = $result['url'];
|
|
|
}
|
|
|
$content[] = [
|
|
|
'title' => $v1['title'],
|
|
|
'description' => $v1['digest'],
|
|
|
'image' => $picurl,
|
|
|
'url' => $v1['url'],
|
|
|
];
|
|
|
}
|
|
|
|
|
|
$data['content'] = $content;
|
|
|
$news_model->dataUpdate($data);
|
|
|
}
|
|
|
|
|
|
return sendSuccessMessage([], '同步成功');
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 首关设置 2017-10-15
|
|
|
*/
|
|
|
public function event()
|
|
|
{
|
|
|
$reply_model = new WechatReply();
|
|
|
if (request()->isPost()) {
|
|
|
$param = input('post.');
|
|
|
$data = [
|
|
|
'id' => $param['id'],
|
|
|
'uid' => UID,
|
|
|
'trigger_type' => 2,
|
|
|
'matching_type' => 1,
|
|
|
'type' => $param['type'],
|
|
|
];
|
|
|
$app = Factory::officialAccount($this->easyWechatConfig);
|
|
|
|
|
|
if ($param['type'] == 'text') {
|
|
|
$data['content'] = [
|
|
|
'text' => $param['reply_text']
|
|
|
];
|
|
|
} else if ($param['type'] == 'image') {
|
|
|
$file = saveFileToLocal($param['image_url']);
|
|
|
$result = $app->media->uploadImage($file['local_file_url']);
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'image_url' => $param['image_url'],
|
|
|
'media_id' => $result['media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'voice') {
|
|
|
$file = saveFileToLocal($param['voice_url']);
|
|
|
$result = $app->media->uploadVoice($file['local_file_url']);
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'voice_url' => $param['voice_url'],
|
|
|
'media_id' => $result['media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'video') {
|
|
|
$file = saveFileToLocal($param['video_url']);
|
|
|
$result = $app->media->uploadVideo($file['local_file_url']);
|
|
|
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'title' => $param['video_title'],
|
|
|
'description' => $param['video_description'],
|
|
|
'video_url' => $param['video_url'],
|
|
|
'media_id' => $result['media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'music') {
|
|
|
$file = saveFileToLocal($param['thumb_url']);
|
|
|
$result = $app->media->uploadThumb($file['local_file_url']);
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'title' => $param['music_title'],
|
|
|
'description' => $param['music_description'],
|
|
|
'music_url' => $param['music_url'],
|
|
|
'hq_music_url' => $param['music_url'],
|
|
|
'thumb_url' => $param['thumb_url'],
|
|
|
'media_id' => $result['thumb_media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'news') {
|
|
|
$data['content'] = [
|
|
|
'news_id' => $param['news_id']
|
|
|
];
|
|
|
}
|
|
|
$res = $reply_model->dataUpdate($data);
|
|
|
if (!$res) {
|
|
|
return sendErrorMessage(4001, '操作失败');
|
|
|
}
|
|
|
|
|
|
return sendSuccessMessage([], '操作成功');
|
|
|
} else {
|
|
|
$id = input('param.id', 0);
|
|
|
$data = $reply_model->getOneData(['trigger_type' => 2]);
|
|
|
$news_model = new WechatNews();
|
|
|
$newsList = $news_model->getAllData(['uid' => UID]);
|
|
|
|
|
|
View::assign('data', $data);
|
|
|
View::assign('newsList', $newsList);
|
|
|
return View::fetch();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 回复设置
|
|
|
* @return mixed
|
|
|
*/
|
|
|
public function reply()
|
|
|
{
|
|
|
$search = input('get.');
|
|
|
autoSearch(['time', 'keyword', 'type'], $search);
|
|
|
|
|
|
$news_model = new WechatNews();
|
|
|
$news = $news_model->column('name', 'id');
|
|
|
|
|
|
$where = [
|
|
|
['uid', '=', UID],
|
|
|
// ['trigger_type', '=', 1]
|
|
|
];
|
|
|
|
|
|
$reply_model = new WechatReply();
|
|
|
|
|
|
if ($search['time']) {
|
|
|
$time = explode('-', $search['time']);
|
|
|
$where[] = ['create_time', 'between time', [$time[0], $time[1]]];
|
|
|
}
|
|
|
if ($search['keyword']) {
|
|
|
$where[] = ['name', 'like', '%' . $search['keyword'] . '%'];
|
|
|
}
|
|
|
if ($search['type']) {
|
|
|
$where[] = ['type', '=', $search['type']];
|
|
|
}
|
|
|
|
|
|
$dataList = $reply_model
|
|
|
->where($where)
|
|
|
->order('trigger_type desc')
|
|
|
->paginate([
|
|
|
'list_rows' => 20,
|
|
|
'page' => array_key_exists("page", $search) ? (string)$search['page'] : "1",
|
|
|
'query' => $search
|
|
|
], false)->each(function ($item, $key) use ($news) {
|
|
|
if ($item['type'] == 'news' && !empty($news[$item['content']['news_id']])) {
|
|
|
$item['news_name'] = $news[$item['content']['news_id']];
|
|
|
} else {
|
|
|
$item['news_name'] = '图文已被删除';
|
|
|
}
|
|
|
return $item;
|
|
|
});
|
|
|
|
|
|
View::assign('search', $search);
|
|
|
View::assign('dataList', $dataList);
|
|
|
return View::fetch();
|
|
|
}
|
|
|
|
|
|
//关键词回复设置添加
|
|
|
public function replyadd()
|
|
|
{
|
|
|
$reply_model = new WechatReply();
|
|
|
if (request()->isPost()) {
|
|
|
$param = input('post.');
|
|
|
$data = [
|
|
|
'id' => $param['id'],
|
|
|
'uid' => UID,
|
|
|
// 'name' => $param['name'],
|
|
|
'trigger_type' => $param['trigger_type'],
|
|
|
// 'matching_type' => $param['matching_type'],
|
|
|
'type' => $param['type']
|
|
|
];
|
|
|
if ($param['trigger_type'] == 1) {
|
|
|
$data['name'] = $param['name'];
|
|
|
$data['matching_type'] = $param['matching_type'];
|
|
|
}
|
|
|
|
|
|
if ($param['trigger_type'] == 2 || $param['trigger_type'] == 3) {
|
|
|
$where = [
|
|
|
['uid', '=', UID],
|
|
|
['trigger_type', '=', $param['trigger_type']],
|
|
|
];
|
|
|
|
|
|
if($param['id']){
|
|
|
$where[] = ['id', '<>', $param['id']];
|
|
|
}
|
|
|
|
|
|
$number = $reply_model->getNumber($where);
|
|
|
if ($number) {
|
|
|
return sendErrorMessage(1, '同类型事件只能有1个');
|
|
|
}
|
|
|
}
|
|
|
$app = Factory::officialAccount($this->easyWechatConfig);
|
|
|
|
|
|
if ($param['type'] == 'text') {
|
|
|
if (!$param['reply_text']) {
|
|
|
return sendErrorMessage(1, '请填写文本信息');
|
|
|
}
|
|
|
$data['content'] = [
|
|
|
'text' => $param['reply_text']
|
|
|
];
|
|
|
} else if ($param['type'] == 'image') {
|
|
|
if (!$param['image_url']) {
|
|
|
return sendErrorMessage(1, '请上传图片');
|
|
|
}
|
|
|
$file = saveFileToLocal($param['image_url']);
|
|
|
$result = $app->media->uploadImage($file['local_file_url']);
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'image_url' => $param['image_url'],
|
|
|
'media_id' => $result['media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'voice') {
|
|
|
if (!$param['voice_url']) {
|
|
|
return sendErrorMessage(1, '请上传语音文件');
|
|
|
}
|
|
|
$file = saveFileToLocal($param['voice_url']);
|
|
|
$result = $app->media->uploadVoice($file['local_file_url']);
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'voice_url' => $param['voice_url'],
|
|
|
'media_id' => $result['media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'video') {
|
|
|
if (!$param['video_title']) {
|
|
|
return sendErrorMessage(1, '请填写视频标题');
|
|
|
}
|
|
|
if (!$param['video_url']) {
|
|
|
return sendErrorMessage(1, '请上传视频文件');
|
|
|
}
|
|
|
if (!$param['video_description']) {
|
|
|
return sendErrorMessage(1, '请填写视频描述');
|
|
|
}
|
|
|
$file = saveFileToLocal($param['video_url']);
|
|
|
$result = $app->media->uploadVideo($file['local_file_url']);
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'title' => $param['video_title'],
|
|
|
'description' => $param['video_description'],
|
|
|
'video_url' => $param['video_url'],
|
|
|
'media_id' => $result['media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'music') {
|
|
|
if (!$param['music_title']) {
|
|
|
return sendErrorMessage(1, '请填写音乐标题');
|
|
|
}
|
|
|
if (!$param['thumb_url']) {
|
|
|
return sendErrorMessage(1, '请上传音乐封面');
|
|
|
}
|
|
|
if (!$param['music_url']) {
|
|
|
return sendErrorMessage(1, '请上传音乐文件');
|
|
|
}
|
|
|
if (!$param['music_description']) {
|
|
|
return sendErrorMessage(1, '请填写音乐描述');
|
|
|
}
|
|
|
|
|
|
$file = saveFileToLocal($param['thumb_url']);
|
|
|
$result = $app->media->uploadThumb($file['local_file_url']);
|
|
|
platformLog($file['local_file_url'], $result, 'wechat_upload_image_uid_' . UID);
|
|
|
unlink($file['local_file_url']);
|
|
|
$data['content'] = [
|
|
|
'title' => $param['music_title'],
|
|
|
'description' => $param['music_description'],
|
|
|
'music_url' => $param['music_url'],
|
|
|
'hq_music_url' => $param['music_url'],
|
|
|
'thumb_url' => $param['thumb_url'],
|
|
|
'media_id' => $result['thumb_media_id']
|
|
|
];
|
|
|
} else if ($param['type'] == 'news') {
|
|
|
if (!$param['news_id']) {
|
|
|
return sendErrorMessage(1, '请选择图文信息');
|
|
|
}
|
|
|
$data['content'] = [
|
|
|
'news_id' => $param['news_id']
|
|
|
];
|
|
|
}
|
|
|
// dump($data);exit();
|
|
|
$res = $reply_model->dataUpdate($data);
|
|
|
if (!$res) {
|
|
|
return sendErrorMessage(4001, '操作失败');
|
|
|
}
|
|
|
|
|
|
return sendSuccessMessage([], '操作成功');
|
|
|
} else {
|
|
|
$id = input('param.id', 0);
|
|
|
$data = $reply_model->getOneData(['id' => $id]);
|
|
|
$news_model = new WechatNews();
|
|
|
$newsList = $news_model->getAllData(['uid' => UID]);
|
|
|
|
|
|
View::assign('data', $data);
|
|
|
View::assign('newsList', $newsList);
|
|
|
return View::fetch('replyadd');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//修改关键词
|
|
|
public function replyupdate()
|
|
|
{
|
|
|
return $this->replyadd();
|
|
|
}
|
|
|
}
|