liugc 10 месяцев назад
Родитель
Сommit
abba20438a

+ 5 - 0
app/adminapi/controller/external/ExternalConsultationController.php

@@ -125,5 +125,10 @@ class ExternalConsultationController extends BaseAdminController
         return $this->data($result);
     }
 
+    public function selectConsultationNotific()
+    {
+        $notific_count = ExternalConsultationLogic::selectCache();
+        return $this->success('', ['type'=>'consultation','unique_code'=> md5($notific_count),'to_router'=>'/consumer/external_consultation','notific_count' => $notific_count], 1, 1);
+    }
 
 }

+ 15 - 0
app/adminapi/logic/external/ExternalConsultationLogic.php

@@ -20,6 +20,7 @@ use app\common\model\external\ExternalConsultation;
 use app\common\logic\BaseLogic;
 use app\common\model\external\ExternalConsultationFollowLog;
 use app\common\model\external\ExternalConsultationOrder;
+use think\facade\Cache;
 use think\facade\Db;
 
 
@@ -190,6 +191,7 @@ class ExternalConsultationLogic extends BaseLogic
             ]);
 
             Db::commit();
+            self::delCache($params['id']);
             return true;
         } catch (\Exception $e) {
             Db::rollback();
@@ -197,6 +199,19 @@ class ExternalConsultationLogic extends BaseLogic
             return false;
         }
     }
+    public static function delCache($id)
+    {
+        $consultation_notific_arr = Cache::store('common_redis')->get('consultation_notific');
+        unset($consultation_notific_arr[$id]);
+        Cache::store('common_redis')->set('consultation_notific',$consultation_notific_arr);
+        return true;
+    }
+    public static function selectCache()
+    {
+        $consultation_notific_arr = Cache::store('common_redis')->get('consultation_notific');
+        return count($consultation_notific_arr);
+    }
+
 
     /**
      * @notes 删除

+ 13 - 0
config/cache.php

@@ -37,5 +37,18 @@ return [
             // 缓存前缀
             'prefix' => 'la:',
         ],
+        // redis缓存
+        'common_redis'  =>  [
+            // 驱动方式
+            'type'   => 'redis',
+            // 服务器地址
+            'host'   => env('cache.host','127.0.0.1'),
+            // 端口
+            'port'   => env('cache.port','6379'),
+            // 密码
+            'password' => env('cache.password', ''),
+            // 缓存前缀
+            'prefix' => '',
+        ],
     ],
 ];

BIN
public/assets/audio/newconsultation.mp3


BIN
public/assets/audio/neworder.mp3