Cathay

Cathay

实践大于一切设想。

  • 财富值3500
  • 威望值40
  • 总积分4140

个人信息

  • 2019-10-15 已签到
    连续签到1天,获得了5个金钱
  • 赞了说说
    舰长,昨天夸我很骚,这我就很难受,没想到,装了这么久居然被发现了。
  • 回复了 的说说
    舰长,昨天夸我很骚,这我就很难受,没想到,装了这么久居然被发现了。
    舰长说的没错
  • 赞了说说
    人生有好多遗憾,我现在的遗憾是北马和杭马都中了,接下来该怎么办?
  • 2019-10-10 已签到
    连续签到1天,获得了5个金钱
  • 2019-10-08 已签到
    连续签到1天,获得了5个金钱
  • 赞了回答

    从我贴的那个链接中 截两段话
    图1:
    1.png
    认证状态不能保持,每一次请求都是通过 access token 实时认证的

    图2:
    2.png
    认证成功后 才会进行频率限制,所以 RateLimit 类的这个方法中

    public function beforeAction($action)
        {
            if ($this->user === null && Yii::$app->getUser()) {
                $this->user = Yii::$app->getUser()->getIdentity(false);
            }
    
            if ($this->user instanceof RateLimitInterface) {
                Yii::debug('Check rate limit', __METHOD__);
                $this->checkRateLimit($this->user, $this->request, $this->response, $action);
            } elseif ($this->user) {
                Yii::info('Rate limit skipped: "user" does not implement RateLimitInterface.', __METHOD__);
            } else {
                Yii::info('Rate limit skipped: user not logged in.', __METHOD__);
            }
    
            return true;
        }
    

    并不会进入第一个 if 判断

  • 2019-10-05 已签到
    连续签到1天,获得了5个金钱
  • 2019-10-02 已签到
    连续签到3天,获得了15个金钱
  • 你可以在fields里定一个值,等于你需要的with值,然后用toarray获取?
    like this ?

    public function fields() 
    {
        ...,
        // 想了一下,这样有点多余,直接 ’coupons‘就行了。
        // return ArrayHelper::merge(parents::fields(), ['coupons']);
        'coupons' => function() {
            return $this->coupons;
        }    
    }
    
    public function getCoupons()
    {
        return $this-hasMany(Coupons::class, 'coupon_id' => 'id');
    }
    
总监 等级规则
4140/5000
资料完整度
100/100
用户活跃度
0/100

Ta的关注

4

Ta的粉丝

6

Ta的访客

24