geek преди 4 години
родител
ревизия
bfeafa4791
променени са 2 файла, в които са добавени 8 реда и са изтрити 0 реда
  1. 4 0
      application/index/controller/Index.php
  2. 4 0
      application/index/controller/User.php

+ 4 - 0
application/index/controller/Index.php

@@ -8,6 +8,7 @@ namespace app\index\controller;
 
 
 use app\common\service\CommonService;
+use app\index\exception\ApiException;
 use think\facade\Session;
 
 class Index {
@@ -18,6 +19,9 @@ class Index {
         $visitorId = input('visitorId');
         $notifyUrl = input('notify_url');
         $channelId = input('channelId');
+        if (empty($channelId)){
+            throw new ApiException('渠道id不为空');
+        }
         $data = CommonService::getSetData($channelId);
         if (empty(Session::get('wxId'))){
             header("Location:".CommonService::getAuthUrl($channelId));

+ 4 - 0
application/index/controller/User.php

@@ -9,12 +9,16 @@ namespace app\index\controller;
 
 use app\common\service\CommonService;
 use app\index\BaseController;
+use app\index\exception\ApiException;
 use think\facade\Session;
 
 class User extends BaseController {
 
     public function login() {
         $channelId = input('channelId');
+        if (empty($channelId)){
+            throw new ApiException('渠道id不为空');
+        }
         $params = [
             'id'     => $channelId,
             'userid' => input('unionid'),