zhoulj пре 4 година
родитељ
комит
be8c4caf50

+ 6 - 0
src/Controllers/BaseControllerConfig.php

@@ -60,6 +60,12 @@ trait BaseControllerConfig
     {
         return $this->channel->id;
     }
+    
+    //获取快应用子账号
+    protected function qapp_account(): string
+    {
+        return session('qapp_account');
+    }
 
     protected function channel_name(): string
     {

+ 4 - 0
src/Controllers/LandingPage/LinkController.php

@@ -165,12 +165,16 @@ class LinkController extends Controller
      */
     public function queryReportLog(QueryReportRequest $request)
     {
+        request()->offsetSet('qapp_account', $this->qapp_account);
+        
         $result = $this->service->findUserReportInfos($this->channel_id, $request->all());
         return response()->pagination(new ReportOrderTramsformer, $result);
     }
 
     public function reportLogExport(QueryReportRequest $request)
     {
+        request()->offsetSet('qapp_account', $this->qapp_account);
+        
         $result = $this->service->findUserReportInfos($this->channel_id, $request->all(), false);
         $result = collectionTransform(new ReportOrderTramsformer, $result);
         $headers = [

+ 4 - 3
src/Services/LandingPage/LandingPageLinkService.php

@@ -220,10 +220,11 @@ class LandingPageLinkService
             });
         }
         
+        $qapp_account = isset($params['qapp_account']) && !empty($params['qapp_account']) ? $params['qapp_account']:'';
+        \Log::info('findUserReportInfos:channel_id:'.$channel_id.' qapp_account:'.$qapp_account);
+        
         // 注意:快应用的子账号必须要限制下权限
-        if (isset($params['qapp_account']) && $params['qapp_account']) {
-            \Log::info('findUserReportInfos:channel_id:'.$channel_id.' qapp_account:'.$params['qapp_account']);
-            
+        if (!empty($qapp_account)) {
             $sql->join('qapp_send_orders', 'orders.send_order_id', 'qapp_send_orders.send_order_id')
             ->where('qapp_send_orders.account', $params['qapp_account']);
         }