'活跃', self::IS_ACTIVE_NO => '不活跃', ]; //增加用户扩展信息 function addExtend($aItem): \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Builder|array|null { if(empty($aItem['uid'])) throw new ModelException('uid error'); if($this->findItem($aItem['uid'],['uid'])) return null; //已存在 $sDateTime = date('Y-m-d H:i:s'); $aItem['updated_at'] = $sDateTime; return $this->addItem($aItem); } //增加当前粉丝总数 function incrFansNum($uid): int { $oExtend = $this->findItem($uid,'uid'); if(!$oExtend) throw new ModelException('user extend not found'); return $this->newQuery()->where('uid',$uid)->increment('fans_num'); } //减去当前追随者总数 function decrFansNum($uid): int { $oExtend = $this->findItem($uid,'uid'); if(!$oExtend) throw new ModelException('user extend not found'); return $this->newQuery()->where('uid',$uid)->decrement('fans_num'); } //增加当前订阅总数 function incrFollowNum($uid): int { $oExtend = $this->findItem($uid,'uid'); if(!$oExtend) throw new ModelException('user extend not found'); return $this->newQuery()->where('uid',$uid)->increment('follow_num'); } //减去当前订阅总数 function decrFollowNum($uid): int { $oExtend = $this->findItem($uid,'uid'); if(!$oExtend) throw new ModelException('user extend not found'); return $this->newQuery()->where('uid',$uid)->decrement('follow_num'); } }