Fecmall

第 2 位会员

会员
个人信息
  • 加入于 2017-05-31 17:38:45
  • 城市 Qingdao
  • GitHub https://github.com/fecshop
  • 最后登录时间 10天前
  • 签名 净化自己,潜心编码
个人简介
Terry,Fecmall开源产品作者,12年电商经验一线程序员开发者,擅长规划产品,架构设计。
个人成就
  • 发表文章次数 744
  • 发布回复次数 5760
  • 个人主页浏览次数 683
产品添加Add to Favorites 失败。7年前

你可以试试先退出账户,然后重新登录,是否还是看不到收藏列表?

产品添加Add to Favorites 失败。7年前

对于

protected function renewAuthStatus()
    {
        $session = Yii::$app->getSession();
        $id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($this->idParam) : null;
        var_dump($session->getHasSessionId());
        var_dump($this->idParam);
        var_dump($session->get($this->idParam));
        var_dump($id);
        if ($id === null) {
            $identity = null;
        } else {
            /* @var $class IdentityInterface */
            $class = $this->identityClass;
            $identity = $class::findIdentity($id);
        }

我的输出为 bool(true) string(4) "__id" int(432) int(432)

$session = Yii::$app->getSession();

这个 $session , 得看配置

打开@common/config/main-local.php 看一下你的session的配置

'session' => [
            'class'   => 'yii\redis\Session',

fecshop 默认推荐使用redis,你的session的class是否是'yii\redis\Session'

对于上面的session值的写入,是在账户login的时候,还是 yii/web/User.php文件,我给你罗列下代码

登录函数

public function login(IdentityInterface $identity, $duration = 0)
    {
        if ($this->beforeLogin($identity, false, $duration)) {
            $this->switchIdentity($identity, $duration);
            $id = $identity->getId();
            $ip = Yii::$app->getRequest()->getUserIP();
            if ($this->enableSession) {
                $log = "User '$id' logged in from $ip with duration $duration.";
            } else {
                $log = "User '$id' logged in from $ip. Session not enabled.";
            }
            Yii::info($log, __METHOD__);
            $this->afterLogin($identity, false, $duration);
        }

        return !$this->getIsGuest();
    }

里面有一行代码:$this->switchIdentity($identity, $duration);

这个函数的代码:

public function switchIdentity($identity, $duration = 0)
    {
        $this->setIdentity($identity);

        if (!$this->enableSession) {
            return;
        }

        /* Ensure any existing identity cookies are removed. */
        if ($this->enableAutoLogin && ($this->autoRenewCookie || $identity === null)) {
            $this->removeIdentityCookie();
        }

        $session = Yii::$app->getSession();
        if (!YII_ENV_TEST) {
            $session->regenerateID(true);
        }
        $session->remove($this->idParam);
        $session->remove($this->authTimeoutParam);

        if ($identity) {
            $session->set($this->idParam, $identity->getId());
            if ($this->authTimeout !== null) {
                $session->set($this->authTimeoutParam, time() + $this->authTimeout);
            }
            if ($this->absoluteAuthTimeout !== null) {
                $session->set($this->absoluteAuthTimeoutParam, time() + $this->absoluteAuthTimeout);
            }
            if ($this->enableAutoLogin && $duration > 0) {
                $this->sendIdentityCookie($identity, $duration);
            }
        }

        // regenerate CSRF token
        Yii::$app->getRequest()->getCsrfToken(true);
    }

这个函数里面有一行: $session->set($this->idParam, $identity->getId());

也就是这里把这个id的值塞进去的,你可以退出下账户,然后重新登录,打印一下这个$identity->getId()的值,是否是int。

大致说的差不多了,你自己排查下原因把。

打开首页,返回{"code":500,"error_no":"5acf1b0a653aa90005395cd1"}7年前

this domain is not config in store component , 搜索可以找到解决的帖子

打开首页,返回{"code":500,"error_no":"5acf1b0a653aa90005395cd1"}7年前

上面是dev设置成prod的方式,反过来,就是prod设置成dev 环境的方式

环境设置成dev(就是develop,开发环境),即可直接查看报错。

打开首页,返回{"code":500,"error_no":"5acf1b0a653aa90005395cd1"}7年前

1.整理一下排版,markdown格式:http://www.fecshop.com/markdown

2.这个是fecshop封装的errorHandler机制,将prod模式的报错信息隐藏掉

2.1prod模式,你可以在后台查看报错信息,在后台 控制面板 -> ErrorHandle 处查看

2.2你可以将fecshop的环境改成dev模式,这样错误就会直接在页面中显示出来

至于如何操作,参看文档:Fecshop Error Handler

添加新语言后,PC端新语言商店的输出样式是移动端样式,非PC端样式7年前

@htony [#3楼](#comment3) 是不是,你测试下不就知道了?

脑子转动一下,灵活一点,别那么死脑筋

你在 @appfront/web/index.php 加个断点 echo 1; exit; 输出下不就知道了吗?

产品添加Add to Favorites 失败。7年前

对于appfront user组件的配置

@fecshop/app/appfront/config/appfront.php

'user' => [
            'class'            => 'fecshop\yii\web\User',
            'identityClass'    => 'fecshop\models\mysqldb\Customer',
            // 是否cookie 登录。
            /*
             * @var boolean whether to enable cookie-based login. Defaults to false.
             * Note that this property will be ignored if [[enableSession]] is false.
             * 设置为true的好处为,当浏览器关掉在打开,可以自动登录。
             */
            'enableAutoLogin'    => true,

            /*
             * authTimeout => 56666,
             * 这里请不要设置authTimeout,为了让customer账户session
             * 和cart的session保持一致,设置超时时间请统一在session组件
             * 中设置超时时间。
             */
            //'authTimeout' 		=> 56666,
        ],

fecshop\yii\web\User 继承于 yii\web\User

Yii::$app->user->identity 这个执行的函数为:

protected function renewAuthStatus()
    {
        $session = Yii::$app->getSession();
        $id = $session->getHasSessionId() || $session->getIsActive() ? $session->get($this->idParam) : null;

        if ($id === null) {
            $identity = null;
        } else {
            /* @var $class IdentityInterface */
            $class = $this->identityClass;
            $identity = $class::findIdentity($id);
        }

        $this->setIdentity($identity);

        if ($identity !== null && ($this->authTimeout !== null || $this->absoluteAuthTimeout !== null)) {
            $expire = $this->authTimeout !== null ? $session->get($this->authTimeoutParam) : null;
            $expireAbsolute = $this->absoluteAuthTimeout !== null ? $session->get($this->absoluteAuthTimeoutParam) : null;
            if ($expire !== null && $expire < time() || $expireAbsolute !== null && $expireAbsolute < time()) {
                $this->logout(false);
            } elseif ($this->authTimeout !== null) {
                $session->set($this->authTimeoutParam, time() + $this->authTimeout);
            }
        }

        if ($this->enableAutoLogin) {
            if ($this->getIsGuest()) {
                $this->loginByCookie();
            } elseif ($this->autoRenewCookie) {
                $this->renewIdentityCookie();
            }
        }
    }

你可以输出一下,看看这个id是哪里搞成了string。我从来没有遇到过,也没有人提到这个问题。

产品添加Add to Favorites 失败。7年前

你输出一下: Yii::$app->user->identity

var_dump( Yii::$app->user->identity)

你是提这个问题的第一个人,其他人没有遇到过。

添加新语言后,PC端新语言商店的输出样式是移动端样式,非PC端样式7年前

一个问题,一个帖子,这里只回答你的样式问题,添加语言问题,请另开新帖

你的nginx,应该是配置错了,配置到 域名对应的文件路径,配置到 @apphtml5/web 路径下了

产品添加Add to Favorites 失败。7年前

@myred08 #7楼 和window应该没有关系的,window可能出现大小写问题,但是不会出现类型搞错的问题。

产品添加Add to Favorites 失败。7年前

你的 $identity->id,为什么是字符串类型,这个是数据库customer表的id,是int类型。

不应该是string的,你是第一个提这个错误的

你是不是改代码改错了?我在demo输出了一下,是int类型,而不是字符串,这个不是bug,应该是你自己改了哪里东西导致的。

产品添加Add to Favorites 失败。7年前

类型导致的bug

linux composer 安装出错 Your requirements could not be resolved to an installable set of packages.7年前

如果网络实在不行,可以使用百度网盘,安装文档部分有写:

如果因为墙无法使用composer,可以访问百度云盘,下载地址为:http://pan.baidu.com/s/1hs1iC2C 下载日期最新的压缩包即可

linux composer 安装出错 Your requirements could not be resolved to an installable set of packages.7年前

网络问题导致,参看:http://www.fecshop.com/topic/412

第三部分 3.当composer下载失败后,进入fecshop文件夹,然后打开文件composer.json, 找到配置代码:

重新composer update试试

云端线上lets 证书已安装在主域名上,同一个证书可否用在其他域名上吗7年前

@wubuyun [#4楼](#comment4)

需要nginx设置一下, 保证图片通过http和https两种方式都可以访问

详参:http://www.fecshop.com/topic/837

产品添加Add to Favorites 失败。7年前

您的是最新版本吗?

http://fecshop.appfront.fancyecommerce.com/raglan-sleeves-letter-printed-crew-neck-sweatshirt-53386451-77774122

我在演示网站测试了一下,是可以的,如图:

您追踪下代码看看,是什么原因导致的?

Your Site Analytics