<?php namespace App\Console\Commands\WechatPlatform; use App\Jobs\WechatPlatform\GZHSendKFMessage; use App\Service\Util\Support\Trace\TraceContext; use App\Service\WechatPlatform\WechatPlatformConstService; use EasyWeChat\Factory; use Illuminate\Console\Command; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; class Test extends Command { /** * The name and signature of the console command. * * @var string */ protected $signature = 'WechatPlatform:Test'; /** * The console command description. * * @var string */ protected $description = 'Command description'; /** * Execute the console command. */ public function handle() { $config = [ 'app_id' => 'wxf313b3506bac2647', 'secret' => 'aaf348571cbc5d554e4de1bcd3cb0342', 'token' => 'jXP3Cdl6GofhWVsQTtgwLv2tMZG9nHlPgErZm6ixaSl', 'aes_key' => 'GtG7s1v7QV8kRfpWeGmDnwhwdPPKSrA35rIhmrwenpq', 'http' => [ 'max_retries' => 1, 'retry_delay' => 500, 'timeout' => 5.0, ], ]; $openPlatform = Factory::openPlatform($config); $openPlatform->rebind('cache', Cache::store('redis')); $officialAccount = $openPlatform->officialAccount('wxebcb86ec4b80eaca', 'refreshtoken@@@pOdN-RBZ1f475kZxXM66IcG2keHkv8V0mDs97JYa2TQ'); $res = $officialAccount->customer_service->message('hello, '. date('Y-m-d H:i:s')) ->to('oHhd20dzCcfVjWt4OcGzFWISp6A4') ->send(); dump($res); } }