dggzichahu/application/common/model/Ad.php

87 lines
2.5 KiB
PHP
Executable File

<?php
// +----------------------------------------------------------------------
// | 宏驰云科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | Author: HcyShop-kiki
// +----------------------------------------------------------------------
namespace app\common\model;
use think\Model;
class Ad extends Model{
const mobile = 1;
const pc = 2;
public static function getAdTypeDesc($from = true){
$desc = [
self::mobile => '移动端商城',
self::pc => 'pc端商城',
];
if($from === true){
return $desc;
}
return $desc[$from] ?? '';
}
public static function getLinkPage($type = true,$from = true){
$page = [
self::mobile => [
[
'name' => '商品分类',
'path' => '/pages/sort/sort',
'is_tab' => 1,
],
[
'name' => '领券中心',
'path' => '/pages/user_getcoupon/user_getcoupon',
'is_tab' => 0,
],
[
'name' => '个人中心',
'path' => '/pages/user/user',
'is_tab' => 1,
],
],
self::pc => [
[
'name' => '商品分类',
'path' => '/category',
'is_tab' => 0,
],
[
'name' => '领券中心',
'path' => '/get_coupons',
'is_tab' => 0,
],
[
'name' => '个人中心',
'path' => '/user/profile',
'is_tab' => 0,
],
],
];
if(true !== $type){
$page = $page[$type] ?? [];
}
if(true === $from){
return $page;
}
return $page[$from] ?? [];
}
public static function getGoodsPath($from = true){
$desc = [
self::mobile => '/pages/goods_details/goods_details',
self::pc => '/goods_details',
];
if(true === $from){
return $desc;
}
return $desc[$from] ?? '';
}
}