|
@@ -221,24 +221,18 @@ class User extends Model
|
|
|
public function scorelog(){
|
|
|
return $this->hasMany(ScoreLog::class);
|
|
|
}
|
|
|
- public function notification(){
|
|
|
- return $this->hasMany(Notification::class);
|
|
|
- }
|
|
|
public function cart(){
|
|
|
return $this->hasMany(GoodsCart::class);
|
|
|
}
|
|
|
+ public function coupon(){
|
|
|
+ return $this->hasMany(UserCoupon::class);
|
|
|
+ }
|
|
|
public static function recharge($params,Payment $payment){
|
|
|
self::money($payment['amount'],$payment['uer_id'],MoneyLog::TYPE_CHARGE,'充值');
|
|
|
}
|
|
|
public function verification(){
|
|
|
return $this->hasOne(UserVerification::class);
|
|
|
}
|
|
|
- public function mobileHoldLog(){
|
|
|
- return $this->morphMany(MobileHoldLog::class,'holdable','user');
|
|
|
- }
|
|
|
- public function mobileOrderRefundLog(){
|
|
|
- return $this->morphMany(MobileOrderRefundLog::class,'refunduser','user');
|
|
|
- }
|
|
|
/** 模糊搜索 */
|
|
|
public function scopeDim(Query $query,$keyword){
|
|
|
$keyword="%{$keyword}%";
|
|
@@ -286,10 +280,6 @@ class User extends Model
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
/** attr */
|
|
|
#获取地区
|
|
|
public function appendArea(){
|
|
@@ -310,25 +300,4 @@ class User extends Model
|
|
|
}
|
|
|
return $a;
|
|
|
}
|
|
|
- protected function getIsVipAttr($a,$b){
|
|
|
- return $b['level']==self::LEVEL_20;
|
|
|
- }
|
|
|
- protected function getIsVisitorAttr($a,$b){
|
|
|
- return $b['level']==self::LEVEL_0;
|
|
|
- }
|
|
|
- protected function getHasAnsweredAttr($a,$b){
|
|
|
- $user=request()->_user;
|
|
|
- if(!$user){
|
|
|
- return false;
|
|
|
- }
|
|
|
- return Cache::get("user:question:{$user['id']}")==date('Ymd');
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /** set */
|
|
|
- public function setVip(){
|
|
|
- $this['level']=self::LEVEL_20;
|
|
|
- $this->save();
|
|
|
- }
|
|
|
}
|