作者 guosheng

vip页面菜单修改,我的会员、入驻身份判断

... ... @@ -110,6 +110,27 @@ class Frontend extends Controller
Config::set('upload', array_merge(Config::get('upload'), $upload));
// 如果已登录,判断入驻情况
$is_store = $store_type = $is_valid = 0;
if($this->auth->isLogin()) {
$store = Db::name('store')->where('user_id',$this->auth->id)->find();
if($store) {
$is_store = 1;
// 判断会员身份(普通、超级)
if($store['vip_passtime'] > time()) {
$is_valid = 1;
$store_type = 1;
}
if($store['svip_passtime'] > time()) {
$is_valid = 1;
$store_type = 2;
}
}
}
$this->assign('is_store', $is_store); // 是否已入驻
$this->assign('store_type', $store_type); // 入驻类型
$this->assign('is_valid', $is_valid); // 是否过期
// 配置信息后
Hook::listen("config_init", $config);
// 友情链接
... ...
... ... @@ -12,6 +12,7 @@ namespace app\index\controller;
use app\common\controller\Frontend;
use app\index\model\Firmstores;
use app\index\model\Minestore;
use think\Db;
class Enter extends Frontend
{
... ... @@ -34,6 +35,13 @@ class Enter extends Frontend
*/
public function index(){
$user_id = $this->auth->id;
$minestore = Db::name('minestore')->where('user_id',$this->auth->id)->find();
if($minestore) {
$url = url('vip/index');
} else {
$url = url('enter/index');
}
$this->redirect($url);
$userModel = new \app\index\model\User();
$user = $userModel->findData(['id'=>$user_id]);
if(empty($user)){
... ...
... ... @@ -298,6 +298,15 @@ class Member extends Frontend
{
$store_model = new Store();
$store = $store_model->where('user_id',$this->auth->id)->find();
if(!$store) {
$minestore = Db::name('minestore')->where('user_id',$this->auth->id)->find();
if($minestore) {
$url = url('vip/index');
} else {
$url = url('enter/index');
}
$this->redirect($url);
}
$is_vip = 0;
if($store) {
if($store['svip_passtime'] > time()) {
... ...
... ... @@ -22,6 +22,13 @@ class Vip extends Frontend
protected $noNeedLogin = [''];
protected $noNeedRight = ['*'];
public function _initialize()
{
parent::_initialize(); // TODO: Change the autogenerated stub
$this->view->assign('is_search', 0);
$this->view->assign('is_active', 0);
}
/**
* vip购买页面
* @return mixed
... ...
... ... @@ -591,7 +591,7 @@
if (res.code == 1) {
toast('提交成功,请耐心等待审核');
setTimeout(function(){
window.location.href = "{:url('index/index/index')}";
window.location.href = "{:url('index/vip/index')}";
},3000);
}
},
... ...
... ... @@ -24,7 +24,7 @@
</a>
{/notempty}
{notempty name="$token"}
{if condition="$user.identity eq 0"}
{if condition="$is_store eq 0"}
<a href="{:url('index/enter/index')}" class="btn">
<img src="__CDN__/assets/store/images/settled.png" alt="user">
我要入驻
... ...
... ... @@ -441,16 +441,7 @@
{include file="public/header"/}
<!--主要内容-->
<div class="content">
<div class="navBarBox">
<ul>
<li><a href="{:url('index/index')}">首页</a></li>
<li><a href="">采购中心</a></li>
<li><a href="">帮买服务</a></li>
<li><a href="">产品维修</a></li>
<li><a href="">关于我们</a></li>
</ul>
</div>
{include file="public/nav"}
<!--主要内容-->
<div class="contentBox">
<div class="contentMain">
... ...