|
@@ -8,9 +8,12 @@ use app\common\model\TemplateView; |
|
@@ -8,9 +8,12 @@ use app\common\model\TemplateView; |
|
8
|
use app\school\model\basic\Teacher;
|
8
|
use app\school\model\basic\Teacher;
|
|
9
|
use app\school\model\content\Newscategory;
|
9
|
use app\school\model\content\Newscategory;
|
|
10
|
use app\school\model\ManystoreShop;
|
10
|
use app\school\model\ManystoreShop;
|
|
|
|
11
|
+use EasyWeChat\Factory;
|
|
|
|
12
|
+use Overtrue\Socialite\AuthorizeFailedException;
|
|
11
|
use think\Config;
|
13
|
use think\Config;
|
|
12
|
use think\Cookie;
|
14
|
use think\Cookie;
|
|
13
|
use think\Db;
|
15
|
use think\Db;
|
|
|
|
16
|
+use think\Exception;
|
|
14
|
use think\Request;
|
17
|
use think\Request;
|
|
15
|
|
18
|
|
|
16
|
class Index extends Frontend
|
19
|
class Index extends Frontend
|
|
@@ -73,6 +76,24 @@ class Index extends Frontend |
|
@@ -73,6 +76,24 @@ class Index extends Frontend |
|
73
|
$this->assign('elegant_product',$elegant_product);
|
76
|
$this->assign('elegant_product',$elegant_product);
|
|
74
|
$this->assign('links',$links);
|
77
|
$this->assign('links',$links);
|
|
75
|
$this->view->assign('index',$index='foot');//首页隐藏头部使用
|
78
|
$this->view->assign('index',$index='foot');//首页隐藏头部使用
|
|
|
|
79
|
+
|
|
|
|
80
|
+ if (isWechat()){
|
|
|
|
81
|
+ $config = [
|
|
|
|
82
|
+ 'app_id' => 'wx401d047673f1c578',
|
|
|
|
83
|
+ 'secret' => '2f99955f1964d30d6e962c345c268274',
|
|
|
|
84
|
+ 'response_type' => 'array',
|
|
|
|
85
|
+ ];
|
|
|
|
86
|
+ $app = Factory::officialAccount($config);
|
|
|
|
87
|
+ try {
|
|
|
|
88
|
+ $oauth = $app->oauth;
|
|
|
|
89
|
+ $user = $oauth->user();
|
|
|
|
90
|
+ session("open_id",$user->id);
|
|
|
|
91
|
+ }catch (AuthorizeFailedException $e){
|
|
|
|
92
|
+ $response = $app->oauth->scopes(['snsapi_userinfo'])
|
|
|
|
93
|
+ ->redirect($this->request->domain());
|
|
|
|
94
|
+ $response->send();
|
|
|
|
95
|
+ }
|
|
|
|
96
|
+ }
|
|
76
|
return $this->view->fetch("/index/school/{$this->template}");
|
97
|
return $this->view->fetch("/index/school/{$this->template}");
|
|
77
|
}
|
98
|
}
|
|
78
|
|
99
|
|