1.缺失信息提交
This commit is contained in:
33
app/api/controller/MenuController.php
Normal file
33
app/api/controller/MenuController.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\MenuLogic;
|
||||
|
||||
class MenuController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['lists'];
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$type = $this->request->get('type', 1);
|
||||
$list = MenuLogic::getMenu($type,$this->user_info);
|
||||
return $this->success('获取成功', $list);
|
||||
}
|
||||
}
|
||||
63
app/api/logic/MenuLogic.php
Normal file
63
app/api/logic/MenuLogic.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\api\logic;
|
||||
|
||||
use app\common\model\Menu_;
|
||||
use app\common\model\SelffetchVerifier;
|
||||
use app\common\service\ConfigServer;
|
||||
use app\common\service\UrlServer;
|
||||
use think\facade\Db;
|
||||
|
||||
class MenuLogic
|
||||
{
|
||||
public static function getMenu($type,$user_info)
|
||||
{
|
||||
$list = Db::name('menu_decorate')
|
||||
->where(['decorate_type' => $type, 'del' => 0, 'is_show' => 1])
|
||||
->field('name,image,link_type,link_address')
|
||||
->order('sort desc')
|
||||
->select();
|
||||
|
||||
$menu_list = [];
|
||||
|
||||
$is_open = ConfigServer::get('distribution', 'is_open', 1);
|
||||
|
||||
foreach ($list as $key => $menu) {
|
||||
//未登录时不显示核销订单入口,登陆用户非核销员时不显示核销订单入口
|
||||
if (($menu['link_address'] == Menu_::centre_writeoff_order && empty($user_info)) || ($menu['link_address'] == Menu_::centre_writeoff_order && !empty($user_info) && empty(SelffetchVerifier::where(['user_id'=>$user_info['id'],'status'=>1,'del'=>0])->select()->toArray()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$menu_content = Menu_::getMenuContent($type, $menu['link_address']);
|
||||
|
||||
if ($menu_content && !$is_open && 2 === $menu_content['menu_type']) {
|
||||
continue;
|
||||
}
|
||||
//处理图标
|
||||
$menu_list[] = [
|
||||
'name' => $menu['name'],
|
||||
'image' => UrlServer::getFileUrl($menu['image']),
|
||||
'link' => $menu_content['link'] ?? $menu['link_address'],
|
||||
'is_tab' => $menu_content['is_tab'] ?? '',
|
||||
'link_type' => $menu_content['link_type'] ?? $menu['link_type'],
|
||||
];
|
||||
}
|
||||
return $menu_list;
|
||||
}
|
||||
}
|
||||
267
app/common/model/Menu_.php
Normal file
267
app/common/model/Menu_.php
Normal file
@ -0,0 +1,267 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop开源商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用,未经许可不能去除前后端官方版权标识
|
||||
// | likeshop系列产品收费版本务必购买商业授权,购买去版权授权后,方可去除前后端官方版权标识
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | likeshop团队版权所有并拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshop.cn.team
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\common\model;
|
||||
class Menu_{
|
||||
/*
|
||||
* 首页菜单
|
||||
*/
|
||||
const index_seckill = 1;
|
||||
const index_team_activity = 2;
|
||||
const index_hot_sell = 3;
|
||||
const index_coupon_list = 4;
|
||||
const index_sign_in = 5;
|
||||
const index_member_centre = 6;
|
||||
const index_my_collect = 7;
|
||||
const index_store_news = 8;
|
||||
const index_store_help = 9;
|
||||
const index_delivery_address = 10;
|
||||
const index_goods_category = 11;
|
||||
const index_luckdraw = 12;
|
||||
const index_bargain = 13;
|
||||
const index_live_room = 14;
|
||||
/*
|
||||
* 个人中心菜单
|
||||
*/
|
||||
const centre_my_wallet = 10;
|
||||
const centre_generalize = 11;
|
||||
const centre_my_coupon = 12;
|
||||
const centre_level_serve = 13;
|
||||
const centre_store_help = 14;
|
||||
const centre_delivery_address = 15;
|
||||
const centre_my_collect = 16;
|
||||
const centre_service = 17;
|
||||
const centre_team_activity = 18;
|
||||
const centre_bargain = 19;
|
||||
const centre_writeoff_order = 20;
|
||||
const centre_invitation_poster = 21;
|
||||
|
||||
/**
|
||||
* Notes: 菜单内容
|
||||
* @param bool $scene 场景:1-首页导航;2-个人中心
|
||||
* @param bool $from 菜单来源:获取具体的某个菜单
|
||||
* @return array
|
||||
* name => '菜单名称'
|
||||
* link => 调整链接
|
||||
* is_tab => 是否的tab页
|
||||
* link_type => 菜单类型:1-跳转;2-web-view;3-按钮(微信小程序可调用客服)
|
||||
* menu_type => 菜单内容类型:1-正常内容;2-分销菜单
|
||||
*
|
||||
*/
|
||||
public static function getMenuContent($scene = true,$from = true){
|
||||
//首页菜单
|
||||
$config1 = [
|
||||
self::index_seckill => [
|
||||
'name' => '限时秒杀',
|
||||
'link' => '/bundle/pages/goods_seckill/goods_seckill',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_team_activity => [
|
||||
'name' => '拼团活动',
|
||||
'link' => '/bundle/pages/goods_combination/goods_combination',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_hot_sell => [
|
||||
'name' => '热销榜单',
|
||||
'link' => '/bundle/pages/hot_list/hot_list',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_coupon_list => [
|
||||
'name' => '领券中心',
|
||||
'link' => '/pages/user_getcoupon/user_getcoupon',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_sign_in => [
|
||||
'name' => '积分签到',
|
||||
'link' => '/bundle/pages/user_sign/user_sign',
|
||||
'is_tab' => 0,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_member_centre => [
|
||||
'name' => '会员中心',
|
||||
'link' => '/pages/user_vip/user_vip',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_my_collect => [
|
||||
'name' => '我的收藏',
|
||||
'link' => '/pages/user_collection/user_collection',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_store_news => [
|
||||
'name' => '商城资讯',
|
||||
'link' => '/pages/news_list/news_list',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_store_help => [
|
||||
'name' => '帮助中心',
|
||||
'link' => '/pages/news_list/news_list?type=1',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_delivery_address => [
|
||||
'name' => '收货地址',
|
||||
'link' => '/pages/user_address/user_address',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_goods_category => [
|
||||
'name' => '商品分类',
|
||||
'link' => '/pages/sort/sort',
|
||||
'is_tab' => 1,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_luckdraw => [
|
||||
'name' => '积分抽奖',
|
||||
'link' => '/bundle/pages/luckly_wheel/luckly_wheel',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_bargain => [
|
||||
'name' => '砍价活动',
|
||||
'link' => '/bundle/pages/bargain/bargain',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::index_live_room => [
|
||||
'name' => '商城直播',
|
||||
'link' => '/bundle/pages/live_broadcast/live_broadcast',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
];
|
||||
//个人中心菜单
|
||||
$config2 = [
|
||||
self::centre_my_wallet => [
|
||||
'name' => '我的钱包',
|
||||
'link' => '/bundle/pages/user_wallet/user_wallet',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_generalize => [
|
||||
'name' => '分销推广',
|
||||
'link' => '/bundle/pages/user_spread/user_spread',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 2,
|
||||
],
|
||||
self::centre_my_coupon => [
|
||||
'name' => '我的优惠券',
|
||||
'link' => '/pages/user_coupon/user_coupon',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_level_serve => [
|
||||
'name' => '等级服务',
|
||||
'link' => '/pages/user_vip/user_vip',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_store_help => [
|
||||
'name' => '帮助中心',
|
||||
'link' => '/pages/news_list/news_list?type=1',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_delivery_address => [
|
||||
'name' => '收货地址',
|
||||
'link' => '/pages/user_address/user_address',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_my_collect => [
|
||||
'name' => '我的收藏',
|
||||
'link' => '/pages/user_collection/user_collection',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_service => [
|
||||
'name' => '联系客服',
|
||||
'link' => '/bundle/pages/contact_offical/contact_offical',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_team_activity => [
|
||||
'name' => '我的拼团',
|
||||
'link' => '/bundle/pages/user_group/user_group',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_bargain => [
|
||||
'name' => '砍价记录',
|
||||
'link' => '/bundle/pages/bargain_code/bargain_code',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_writeoff_order => [
|
||||
'name' => '核销订单',
|
||||
'link' => '/bundle/pages/writeoff_order/writeoff_order',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
],
|
||||
self::centre_invitation_poster => [
|
||||
'name' => '邀请海报',
|
||||
'link' => '/bundle/pages/invite_fans/invite_fans',
|
||||
'is_tab' => 0,
|
||||
'link_type' => 1,
|
||||
'menu_type' => 1,
|
||||
]
|
||||
];
|
||||
$config_name = 'config'.$scene;
|
||||
$content = $$config_name;
|
||||
if($scene === true){
|
||||
$content = array_merge($config1,$config2);
|
||||
}
|
||||
if($from === true){
|
||||
return $content;
|
||||
}
|
||||
return $content[$from] ?? [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
75
app/common/model/SelffetchVerifier.php
Normal file
75
app/common/model/SelffetchVerifier.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeshop100%开源免费商用商城系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,保留版权即可
|
||||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||||
// | github下载:https://github.com/likeshop-github
|
||||
// | 访问官网:https://www.likeshop.cn
|
||||
// | 访问社区:https://home.likeshop.cn
|
||||
// | 访问手册:http://doc.likeshop.cn
|
||||
// | 微信公众号:likeshop技术社区
|
||||
// | likeshop团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeshopTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class SelffetchVerifier extends Model
|
||||
{
|
||||
//核销员状态
|
||||
const CLOSE = 0;//停用
|
||||
const OPEN = 1;//启用
|
||||
|
||||
/**
|
||||
* @notes 核销员状态
|
||||
* @param bool $status
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2021/8/16 3:27 下午
|
||||
*/
|
||||
public static function getVerifierStatus($status = true)
|
||||
{
|
||||
$desc = [
|
||||
self::CLOSE => '停用',
|
||||
self::OPEN => '启用',
|
||||
];
|
||||
if ($status === true) {
|
||||
return $desc;
|
||||
}
|
||||
return $desc[$status] ?? '未知';
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 核销员状态获取器
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return string|string[]
|
||||
* @author ljj
|
||||
* @date 2021/8/16 3:35 下午
|
||||
*/
|
||||
public function getStatusDescAttr($value,$data)
|
||||
{
|
||||
return self::getVerifierStatus($data['status']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 创建时间获取器
|
||||
* @param $value
|
||||
* @param $data
|
||||
* @return false|string
|
||||
* @author ljj
|
||||
* @date 2021/8/16 3:35 下午
|
||||
*/
|
||||
public function getCreateTimeAttr($value,$data)
|
||||
{
|
||||
return date('Y-m-d H:i:s',$value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user