123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\youzan\logic;
- use app\youzan\model\YzCat;
- use think\facade\Cache;
- //有赞 分类处理层
- class Cat
- {
- private static $cache_key = 'yz_cat_list_pid_';
- //获取分类列表
- public static function getYzCatList(int $parent_cid = 0)
- {
- $key = self::$cache_key . (string)$parent_cid;
- $rs = Cache::get($key);
- if (empty($rs)) {
- $rs = YzCat::field('id,yz_cat_id,yz_cat_name,parent_cid')
- ->where('status', YzCat::$status_normal)
- ->where('parent_cid', $parent_cid)
- ->order('id')
- ->select()
- ->toArray();
- Cache::set($key, $rs, 3600);
- }
- return $rs;
- }
- }
|