Skip to content

Commit

Permalink
change to Susi
Browse files Browse the repository at this point in the history
  • Loading branch information
kol4k committed Mar 1, 2018
1 parent ee23903 commit b8b87be
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/GetMessageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use App\Http\Requests\GetMessageRequest;
use App\Http\Services\GetMessageService;

class GetMessageController extends Controller
class GetMessageController
{
/**
* @var GetMessageService
Expand Down
13 changes: 11 additions & 2 deletions app/Http/Services/GetMessageService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use LINE\LINEBot;
use LINE\LINEBot\HTTPClient\CurlHTTPClient;
use App\Http\Controllers\Library\SusiController;

class GetMessageService
{
Expand All @@ -15,7 +16,15 @@ class GetMessageService
* @var HTTPClient
*/
private $client;

/**
* @var susi
*/
private $susi;

public function __construct(SusiController $susi)
{
$this->susi = $susi;
}

public function replySend($formData)
{
Expand All @@ -24,7 +33,7 @@ public function replySend($formData)
$this->client = new CurlHTTPClient(env('LINE_BOT_ACCESS_TOKEN'));
$this->bot = new LINEBot($this->client, ['channelSecret' => env('LINE_BOT_SECRET')]);

$response = $this->bot->replyText($replyToken, 'hello!');
$response = $this->bot->replyText($replyToken, $susi->getFunction($replyToken));

if ($response->isSucceeded()) {
logger("reply success!!");
Expand Down
1 change: 1 addition & 0 deletions routes/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
logger("message request : ", $request->all());
});
Route::post('/get-message', ['as' => 'line.bot.message', 'uses' => 'GetMessageController@getMessage']);
Route::get('x/{query}', 'GetMessageController@test');

0 comments on commit b8b87be

Please sign in to comment.