Skip to content

Commit 5ced411

Browse files
committed
安装了微信SDK并集成了微信jssdk
1 parent e9673f9 commit 5ced411

File tree

7 files changed

+898
-2
lines changed

7 files changed

+898
-2
lines changed

app/Http/Controllers/ArticleController.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Http\Controllers;
44

55
use Illuminate\Http\Request;
6+
use EasyWeChat\Factory;
67
use App\Article;
78

89
class ArticleController extends Controller
@@ -32,7 +33,17 @@ public function show($id)
3233
Article::update_view($id);
3334
$article = Article::findOrFail($id);
3435
$article->created_at_date = $article->created_at->toDateString();
35-
return view('articles.show', compact('article'));
36+
37+
$config = [
38+
'app_id' => env('WECHAT_OFFICIAL_ACCOUNT_APPID'),
39+
'secret' => env('WECHAT_OFFICIAL_ACCOUNT_SECRET'),
40+
'log' => [
41+
'level' => 'debug',
42+
'file' => __DIR__.'/wechat.log'],
43+
];
44+
$app = Factory::officialAccount($config);
45+
46+
return view('articles.show', compact('article', 'app'));
3647
}
3748
/**
3849
* 返回某个文章 [API]

app/Http/Controllers/wechat.log

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[2018-02-08 16:13:35] easywechat.officialaccount.application.INFO: >>>>>>>> GET /cgi-bin/ticket/getticket?access_token=6_x9F0-BmKEf6DSJQerp8Yc317nd7KP09AD-ndOknLtZemDiJafexhlEm7LCxjoxu3cphdqGsG1PcKYXLDKsEKnn100VJ8HF8L_xkH-y9xAdjE98nCBPM85faFcNJfl-xYZqYULDBXBEJ6to5iYPEaAGAGXM&type=jsapi HTTP/1.1 Host: api.weixin.qq.com User-Agent: GuzzleHttp/6.2.1 curl/7.47.0 PHP/7.1.3-3+deb.sury.org~xenial+1 <<<<<<<< HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json; encoding=utf-8 Date: Thu, 08 Feb 2018 08:13:36 GMT Content-Length: 143 {"errcode":0,"errmsg":"ok","ticket":"HoagFKDcsGMVCIY2vOjf9ss7jQj8FIe4GiQge68XJG8WpI0TZnj77_Wwod7JT_WAT2ggtRgUYwJAyCeMdED0-w","expires_in":7200} -------- NULL [] []

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"fideloper/proxy": "~3.3",
1111
"laravel/framework": "5.5.*",
1212
"laravel/tinker": "~1.0",
13+
"overtrue/laravel-wechat": "~4.0",
1314
"qcloud/cos-sdk-v5": "^1.1"
1415
},
1516
"require-dev": {

0 commit comments

Comments
 (0)