|
|
@@ -14,6 +14,7 @@ namespace App\Services\Api;
|
|
|
use App\Helpers\Jwt;
|
|
|
use App\Models\ActionLogModel;
|
|
|
use App\Models\MemberModel;
|
|
|
+use App\Models\VipModel;
|
|
|
use App\Services\BaseService;
|
|
|
use App\Services\MpService;
|
|
|
use App\Services\RedisService;
|
|
|
@@ -206,6 +207,7 @@ class MemberService extends BaseService
|
|
|
'nickname'=> $phone? '微信用户'.substr($phone,-6,6) : '微信用户'.$userId,
|
|
|
'openid'=> $openid,
|
|
|
'mobile'=> $phone,
|
|
|
+ 'password'=> $phone? get_password(substr($phone,-6,6)) : get_password('123456'),
|
|
|
'login_ip'=> get_client_ip(),
|
|
|
'create_time'=> time(),
|
|
|
'login_time'=> time(),
|
|
|
@@ -307,7 +309,7 @@ class MemberService extends BaseService
|
|
|
return $info;
|
|
|
}
|
|
|
|
|
|
- $defaultField = ['id', 'user_type', 'realname', 'mobile', 'nickname','is_zg_vip','zg_vip_expired','is_zsb_vip','is_zsb_vip','zsb_vip_expired','is_video','video_vip_expired','balance', 'code', 'openid', 'status', 'avatar'];
|
|
|
+ $defaultField = ['id', 'user_type', 'realname', 'mobile', 'nickname','is_zg_vip','zg_vip_expired','is_zsb_vip','is_zsb_vip','zsb_vip_expired','is_video_vip','video_vip_expired','balance', 'code', 'openid', 'status', 'avatar'];
|
|
|
$field = $field ? $field : $defaultField;
|
|
|
if (is_array($where)) {
|
|
|
$info = $this->model->where(['mark' => 1])->where($where)->select($field)->first();
|
|
|
@@ -332,21 +334,24 @@ class MemberService extends BaseService
|
|
|
$idVip = 0;
|
|
|
$vipExpired = '';
|
|
|
$isZgVip = isset($info['is_zg_vip'])? $info['is_zg_vip'] : 0;
|
|
|
- $zgVipExpired = isset($info['zg_vip_expired']) && $info['zg_vip_expired']? $info['zg_vip_expired'] : '';
|
|
|
+ $zgVipExpired = isset($info['zg_vip_expired']) && !empty($info['zg_vip_expired'])? $info['zg_vip_expired'] : '';
|
|
|
if($isZgVip && $zgVipExpired && $zgVipExpired>date('Y-m-d H:i:s')){
|
|
|
$idVip = 1;
|
|
|
$vipExpired = $zgVipExpired;
|
|
|
}
|
|
|
|
|
|
$isZsbVip = isset($info['is_zsb_vip'])? $info['is_zsb_vip'] : 0;
|
|
|
- $zsbVipExpired = isset($info['zsb_vip_expired']) && $info['zsb_vip_expired']? $info['zsb_vip_expired'] : '';
|
|
|
+ $zsbVipExpired = isset($info['zsb_vip_expired']) && !empty($info['zsb_vip_expired'])? $info['zsb_vip_expired'] : '';
|
|
|
if($isZsbVip && $zsbVipExpired && $zgVipExpired>date('Y-m-d H:i:s')){
|
|
|
$idVip = 1;
|
|
|
$vipExpired = $zsbVipExpired>$vipExpired? $zsbVipExpired : $vipExpired;
|
|
|
}
|
|
|
$info['is_vip'] = $idVip;
|
|
|
$info['vip_expired'] = $vipExpired;
|
|
|
- RedisService::set($cacheKey, $info, rand(10, 20));
|
|
|
+ $info['zg_vip_expired'] = $zgVipExpired;
|
|
|
+ $info['zsb_vip_expired'] = $zsbVipExpired;
|
|
|
+ $info['video_vip_expired'] = isset($info['video_vip_expired']) && !empty($info['video_vip_expired'])? $info['video_vip_expired'] : '';
|
|
|
+ RedisService::set($cacheKey, $info, rand(5, 10));
|
|
|
}
|
|
|
|
|
|
return $info;
|
|
|
@@ -478,7 +483,6 @@ class MemberService extends BaseService
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 设置入口类型
|
|
|
* @param $userId
|
|
|
@@ -521,4 +525,29 @@ class MemberService extends BaseService
|
|
|
RedisService::clear($cacheLockKey);
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取VIP类别
|
|
|
+ * @param int $type
|
|
|
+ * @return array|mixed
|
|
|
+ */
|
|
|
+ public function getVipList($type=1)
|
|
|
+ {
|
|
|
+ $cacheKey = "caches:members:vipList:{$type}";
|
|
|
+ $datas = RedisService::get($cacheKey);
|
|
|
+ if($datas){
|
|
|
+ return $datas;
|
|
|
+ }
|
|
|
+
|
|
|
+ $datas = VipModel::where(['type'=> $type,'status'=>1,'mark'=>1])
|
|
|
+ ->select(['id','name','type','price','day','remark','status'])
|
|
|
+ ->orderBy('id','asc')
|
|
|
+ ->get();
|
|
|
+ $datas = $datas? $datas->toArray() : [];
|
|
|
+ if($datas){
|
|
|
+ RedisService::set($cacheKey, $datas, rand(3600, 7200));
|
|
|
+ }
|
|
|
+
|
|
|
+ return $datas;
|
|
|
+ }
|
|
|
}
|