Kaynağa Gözat

测试 easy 5.0

liuzejian 1 yıl önce
ebeveyn
işleme
d27aa25854

+ 54 - 0
app/Console/Commands/WechatPlatform/Test.php

@@ -0,0 +1,54 @@
+<?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\DB;
+
+
+class KFMessageSend 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);
+        $officialAccount = $openPlatform->officialAccount('wxebcb86ec4b80eaca',
+            'refreshtoken@@@pOdN-RBZ1f475kZxXM66IcG2keHkv8V0mDs97JYa2TQ');
+
+        $officialAccount->customer_service->message('hello, '. date('Y-m-d H:i:s'))
+            ->to('oHhd20dzCcfVjWt4OcGzFWISp6A4')
+            ->send();
+
+    }
+}

+ 5 - 3
composer.json

@@ -10,8 +10,9 @@
         "laravel/framework": "^10.8",
         "laravel/sanctum": "^3.2",
         "laravel/tinker": "^2.8",
-        "predis/predis": "^2.1",
-        "nwidart/laravel-modules": "^10.0"
+        "nwidart/laravel-modules": "^10.0",
+        "overtrue/wechat": "~5.0",
+        "predis/predis": "^2.1"
     },
     "require-dev": {
         "fakerphp/faker": "^1.9.1",
@@ -66,7 +67,8 @@
         "sort-packages": true,
         "allow-plugins": {
             "pestphp/pest-plugin": true,
-            "php-http/discovery": true
+            "php-http/discovery": true,
+            "easywechat-composer/easywechat-composer": true
         }
     },
     "minimum-stability": "stable",

Dosya farkı çok büyük olduğundan ihmal edildi
+ 796 - 77
composer.lock


+ 15 - 0
tests/Service/WechatPlatform/GZHSendKFMessageServiceTest.php

@@ -0,0 +1,15 @@
+<?php
+
+namespace Tests\Service\WechatPlatform;
+
+use App\Service\WechatPlatform\GZHSendKFMessageService;
+use PHPUnit\Framework\TestCase;
+
+class GZHSendKFMessageServiceTest extends \TestCase
+{
+
+    public function testSendText()
+    {
+
+    }
+}