Przeglądaj źródła

prepare install meilisearch

joe 3 lat temu
rodzic
commit
897ff510ac

+ 1 - 1
crmeb/subscribes/OrderSubscribe.php

@@ -127,7 +127,7 @@ class OrderSubscribe
     }
 
     /**
-     * 订单支付成功
+     * 订单支付成功 OrderPaySuccess
      * @param array $event
      */
     public function onOrderPaySuccess($event)

+ 17 - 1
tw/command/Maintain.php

@@ -29,7 +29,7 @@ class Maintain extends Command
     protected function configure()
     {
         $this->setName('maintain')
-            ->addArgument('category', Argument::REQUIRED, 'act|prod|trash|none')
+            ->addArgument('category', Argument::REQUIRED, 'act|prod|trash|reindex|none')
             ->setDescription('maintain some application data.');
     }
 
@@ -309,7 +309,23 @@ class Maintain extends Command
         warnlog('backup database:' . json_encode($output));
     }
 
+    /**
+     * 重新索引商品
+     * 
+     * 1.用于常见的商品分类展示。
+     * 2.用于关键字搜索
+     * 3.用于按价格/销量/好评度/上线时间排序
+     * 
+     * - 新增/上架商品: 新增索引
+     * - 删除/下架商品:删除索引
+     */
+    protected function reindex()
+    {
+
+    }
+
     protected function none()
     {
+        
     }
 }

+ 1 - 0
tw/console.php

@@ -0,0 +1 @@
+<?php

+ 25 - 0
tw/lib/Meili.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace tw\lib;
+
+/**
+ * Meilisearch API for twong.
+ */
+class Meili
+{
+
+    public function indexProduct($product)
+    {
+
+    }
+
+    public function unIndexProduct($productId)
+    {
+
+    }
+
+    public function query()
+    {
+        
+    }
+}

+ 17 - 0
tw/redis/MeiliProdRds.php

@@ -0,0 +1,17 @@
+<?php
+namespace tw\redis;
+
+use tw\redis\traits\HashTrait;
+use tw\redis\traits\KeyTrait;
+
+
+class MeiliProdRds
+{
+    use HashTrait;
+    use KeyTrait;
+
+    protected function key($prod = false): string
+    {
+        return 'meili:prods';
+    }
+}

+ 0 - 0
tw/README.md → tw/redis/README.md