wufeng hace 2 años
padre
commit
9c6cba26a8
Se han modificado 2 ficheros con 51 adiciones y 0 borrados
  1. 33 0
      app/youzan/logic/Tag.php
  2. 18 0
      app/youzan/model/YzTag.php

+ 33 - 0
app/youzan/logic/Tag.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace app\youzan\logic;
+
+use app\youzan\model\YzTag;
+use think\facade\Cache;
+
+//有赞标签 处理层
+class Tag
+{
+
+    private static $cache_key = 'yz_tag_list';
+
+    //获取分类列表
+    public static function getYzTagList()
+    {
+
+        $rs = Cache::get(self::$cache_key);
+
+        if (empty($rs)) {
+
+            $rs = YzTag::field('id tag_id,name,type')
+                ->where('is_del', YzTag::$is_del_normal)
+                ->order('id')
+                ->select()
+                ->toArray();
+
+            Cache::set(self::$cache_key, $rs, 3600);
+        }
+
+        return $rs;
+    }
+}

+ 18 - 0
app/youzan/model/YzTag.php

@@ -0,0 +1,18 @@
+<?php
+
+namespace app\youzan\model;
+
+use think\Model;
+
+//有赞标签表
+class YzTag extends Model
+{
+    protected $connection = 'mysql_yz';//切换连接参数
+    protected $table = 'yz_tag';
+    protected $pk = 'id';
+    protected $autoWriteTimestamp = false;
+
+    public static $is_del_normal = 0;//状态:正常
+    public static $is_del_delete = 1;//状态:删除
+
+}