Browse Source

Merge branch 'master' of http://47.112.106.152:10880/tangyuanwang/zhijiayun

public 3 days ago
parent
commit
9ffe4cf446

+ 15 - 0
app/Http/Controllers/Api/Wechat/OfficialNotify.php

@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
 use App\Models\Api\Personnel\EmployeeOpenid as EmployeeOpenidModel;
 use App\Facades\Servers\Logs\Log;
 use App\Servers\Wechat\Official;
+use App\Jobs\Manager\Process\SubscriptionJobs;
 
 class OfficialNotify extends Controller
 {
@@ -188,4 +189,18 @@ class OfficialNotify extends Controller
 
         return $array ?: [];
     }
+
+
+    /**
+     * 公众号测试消息订阅推送
+     * @author 唐远望
+     * @version 1.0
+     * @date 2026-03-10
+     */
+    public function test()
+    {
+        $message_data = ['notice_type'=>'low_price_goods'];
+        $response_data = SubscriptionJobs::dispatchSync($message_data);
+        return json_send(['code' => 'success', 'msg' => '执行成功', 'data' => $response_data]);
+    }
 }

+ 3 - 3
app/Jobs/Manager/Process/SubscriptionJobs.php

@@ -137,10 +137,10 @@ class SubscriptionJobs implements ShouldQueue
         $EmployeeModel = new EmployeeModel();
         foreach ($user_id_list as $key => $totle_number) {
             $user_info  = $EmployeeModel->join('personnel_employee_openid', 'personnel_employee_openid.employee_id', '=', 'personnel_employee.id')
-                ->select(['personnel_employee.*', 'personnel_employee_openid.employee_id', 'personnel_employee_openid.openid'])
+                ->select(['personnel_employee.*', 'personnel_employee_openid.employee_id', 'personnel_employee_openid.official_openid'])
                 ->where('personnel_employee.id', $key)->where([['personnel_employee.open_notice', '=', 0], ['personnel_employee.status', '=', 0]])->first();
             if (empty($user_info)) return true;
-            if ($user_info['openid'] == '') return true;
+            if ($user_info['official_openid'] == '') return true;
             $data           = [
                 'thing1'    => '数据违规预警',
                 'thing2'    => '低价挂网商品:共【' . $totle_number . '】条',
@@ -148,7 +148,7 @@ class SubscriptionJobs implements ShouldQueue
                 'phrase9'   => '待处理',
             ];
             $params     = [
-                'openid'            => $user_info['openid'],
+                'openid'            => $user_info['official_openid'],
                 'template_id'       => 't559Iagds7Av-YcqwIpeAaS5gt7LuOKuIBDvVKlyfm8',
                 'miniprogram'               => [
                     'appid' => config('wechat.mini.app_id'),

+ 2 - 0
routes/api.php

@@ -31,6 +31,8 @@ Route::any('login/wechat_phone', [App\Http\Controllers\Api\Login::class, 'wechat
 
 //公众号订阅回调通知
 Route::any('wechat/official/callback', [App\Http\Controllers\Api\Wechat\OfficialNotify::class, 'callback']);
+//公众号测试推送
+Route::any('wechat/official/test', [App\Http\Controllers\Api\Wechat\OfficialNotify::class, 'test']);
 
 // ------违规处理------
 // 低价挂网商品违规处理-列表