shish hace 4 años
padre
commit
bbcce175e1

+ 8 - 0
app-ghs/controllers/BookController.php

@@ -43,4 +43,12 @@ class BookController extends BaseController
         util::success(['list' => $info]);
     }
 
+    //关闭手册 shish 20211211
+    public function actionCloseBook()
+    {
+        $cacheKey = 'close_book_' . $this->shopAdminId;
+        Yii::$app->redis->executeCommand('SET', [$cacheKey, 'has']);
+        util::complete();
+    }
+
 }

+ 12 - 0
app-ghs/controllers/ConsoleController.php

@@ -12,6 +12,7 @@ use bizHd\stat\services\StatUserService;
 use common\components\dict;
 use common\components\httpUtil;
 use common\components\util;
+use Yii;
 
 class ConsoleController extends BaseController
 {
@@ -85,12 +86,23 @@ class ConsoleController extends BaseController
             ];
         }
 
+        //已经关闭手册或注册满60天不显示
+        $cacheKey = 'close_book_' . $this->shopAdminId;
+        $hasClose = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
+        $showBook = 1;
+        $shopAddTime = $this->shop->addTime;
+        $shopTime = strtotime($shopAddTime) + 60 * 24 * 60 * 60;
+        if (!empty($hasClose) || $shopTime < time()) {
+            $showBook = 0;
+        }
+
         util::success([
             'asset' => $shopInfo,
             'notice' => $notice,
             'todayData' => $todayData,
             'incomeStat' => $incomeStat,
             'menu' => $menu,
+            'showBook' => $showBook,
         ]);
     }