Ver Fonte

Wesmiler

wesmiler há 3 meses atrás
pai
commit
a0114c0765

+ 2 - 1
app/Http/Controllers/Api/v1/MeetingController.php

@@ -38,11 +38,12 @@ class MeetingController extends webApp
     {
         $params = request()->all();
         $id = isset($params['id'])? intval($params['id']) : 0;
+        $type = isset($params['type']) && $params['type']? intval($params['type']) : 1;
         if(empty($id)){
             return message(1036, false);
         }
 
-        if($info = MeetingService::make()->getInfo($id,$this->userId)){
+        if($info = MeetingService::make()->getInfo($id,$this->userId,$type)){
             return message(1010, true, $info);
         }else{
             return message(1009, false);

+ 33 - 30
app/Services/Api/MeetingService.php

@@ -58,9 +58,9 @@ class MeetingService extends BaseService
      * @param int $userId
      * @return array|mixed
      */
-    public function getInfo($id,$userId=0)
+    public function getInfo($id,$userId=0,$type=1)
     {
-        $cacheKey = "caches:meeting:info_{$id}_{$userId}";
+        $cacheKey = "caches:meeting:info_{$id}_{$userId}_{$type}";
         $info = RedisService::get($cacheKey);
         if($info){
             return $info;
@@ -71,39 +71,42 @@ class MeetingService extends BaseService
             ->first();
         $info = $info? $info->toArray() : [];
         if($info){
-            $info['qrcode'] = MpService::make()->getMiniQrcode('pagesSub/pages/meeting/books',$id);
-            $info['qrcode'] = $info['qrcode']? get_image_url($info['qrcode']):'';
+            if($type == 2){
+                $info['qrcode'] = MpService::make()->getMiniQrcode('pagesSub/pages/meeting/books',$id);
+                $info['qrcode'] = $info['qrcode']? get_image_url($info['qrcode']):'';
+            }else{
+                $areaIds = [];
+                if($info['city_id']){
+                    $areaIds[] = $info['city_id'];
+                }
 
-            $areaIds = [];
-            if($info['city_id']){
-                $areaIds[] = $info['city_id'];
-            }
+                if($info['district_id']){
+                    $areaIds[] = $info['district_id'];
+                }
 
-            if($info['district_id']){
-                $areaIds[] = $info['district_id'];
-            }
+                $areas = CityModel::whereIn('citycode', $areaIds)->pluck('name');
+                $areas = $areas?$areas->toArray() :[];
+                $info['area'] = $areas? implode('/',$areas) : '';
+                $stores = '';
+                if($info['store_ids']){
+                    $stores = UserModel::whereIn('id', $info['store_ids'])
+                        ->select(['id','avatar','realname','nickname as company','mobile','department','position','status'])
+                        ->where(['mark'=>1])
+                        ->get();;
+                }
 
-            $areas = CityModel::whereIn('citycode', $areaIds)->pluck('name');
-            $areas = $areas?$areas->toArray() :[];
-            $info['area'] = $areas? implode('/',$areas) : '';
-            $stores = '';
-            if($info['store_ids']){
-                $stores = UserModel::whereIn('id', $info['store_ids'])
-                    ->select(['id','avatar','realname','nickname as company','mobile','department','position','status'])
-                    ->where(['mark'=>1])
-                    ->get();;
+                $info['stores'] = $stores?$stores->toArray() : [];
+                $supervisors = '';
+                if($info['supervisor_ids']){
+                    $supervisors = SupervisorsModel::whereIn('id', $info['supervisor_ids'])
+                        ->select(['id','name','avatar','mobile','company','occupation','department','position','status'])
+                        ->where(['mark'=>1])
+                        ->get();
+                }
+                $info['supervisors'] = $supervisors?$supervisors->toArray() :[];
+                $info['guest_count'] = count($info['stores']) + count($info['supervisors']);
             }
 
-            $info['stores'] = $stores?$stores->toArray() : [];
-            $supervisors = '';
-            if($info['supervisor_ids']){
-                $supervisors = SupervisorsModel::whereIn('id', $info['supervisor_ids'])
-                    ->select(['id','name','avatar','mobile','company','occupation','department','position','status'])
-                    ->where(['mark'=>1])
-                    ->get();
-            }
-            $info['supervisors'] = $supervisors?$supervisors->toArray() :[];
-            $info['guest_count'] = count($info['stores']) + count($info['supervisors']);
             RedisService::set($cacheKey, $info,   rand(5,10));
         }