作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

合并分支 'heshupeng' 到 'master'

bug修改



查看合并请求 !124
... ... @@ -11,7 +11,6 @@ namespace app\api\controller;
use app\api\model\HouseComment;
use app\api\model\Message;
use app\api\validate\HotValidate;
use app\common\controller\Api;
use think\Cache;
use think\Db;
... ... @@ -362,7 +361,10 @@ class HouseBoard extends Api
*/
public function comment_add()
{
$param = (new HotValidate())->goCheck('house_comment_add');
$param = $this->request->param();
if(!$param['house_id'] || !$param['house_user_id']){
$this->error('缺少必要参数');
}
if(empty($param['content']) && empty($param['image'])) {
$this->error('请填写内容或上传图片');
}
... ...
<?php
namespace addons\wechat\controller;
use addons\wechat\model\WechatAutoreply;
use addons\wechat\model\WechatCaptcha;
use addons\wechat\model\WechatContext;
use addons\wechat\model\WechatResponse;
use addons\wechat\model\WechatConfig;
use EasyWeChat\Foundation\Application;
use addons\wechat\library\Wechat as WechatService;
use addons\wechat\library\Config as ConfigService;
use think\Log;
/**
* 微信接口
*/
class Index extends \think\addons\Controller
{
public $app = null;
public function _initialize()
{
parent::_initialize();
$this->app = new Application(ConfigService::load());
}
/**
* 微信API对接接口
*/
public function api()
{
$this->app->server->setMessageHandler(function ($message) {
$wechatService = new WechatService;
$matches = null;
$openid = $message->FromUserName;
$to_openid = $message->ToUserName;
$event = $message->Event;
$eventkey = $message->EventKey ? $message->EventKey : $message->Event;
switch ($message->MsgType) {
case 'event': //事件消息
//验证码消息
if (in_array($event, ['subscribe', 'SCAN'])) {
return $eventkey;
}
// switch ($event) {
// case 'subscribe'://添加关注
// $subscribeMessage = WechatConfig::value('default.subscribe.message');
// $subscribeMessage = $subscribeMessage ? $subscribeMessage : "欢迎关注我们!";
// return $subscribeMessage;
// case 'unsubscribe'://取消关注
// return '';
// case 'LOCATION'://获取地理位置
// return '';
// case 'VIEW': //跳转链接,eventkey为链接
// return '';
// case 'SCAN': //扫码
// return '';
// default:
// break;
// }
return "";
case 'text': //文字消息
case 'image': //图片消息
case 'voice': //语音消息
case 'video': //视频消息
case 'location': //坐标消息
case 'link': //链接消息
default: //其它消息
return "";
}
return ""; //SUCCESS
});
$response = $this->app->server->serve();
// 将响应输出
$response->send();
}
}
\ No newline at end of file
... ...