12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- /**
- * Created by PhpStorm.
- * User: shensong
- * Date: 2019/11/27
- * Time: 17:06
- */
- namespace App;
- use Illuminate\Database\Eloquent\Model;
- class CustomerVip extends Model
- {
- public $timestamps = false;
- protected $table = 'customer_vip';
- /**
- * 获取会员信息
- * @param $phone
- * @return mixed
- */
- public static function getCustomerInformation($phone){
- $self = new self();
- $date = date('Y-m-d');
- $info = $self->where('phone',$phone)->where('is_del',0)->where('vip_end_time','>=',$date)->first();
- return $info;
- }
- /**
- * 判断用户是否为会员
- * @param $phone
- * @return bool
- */
- public static function judgeWhetherTheUserIsAMember($phone){
- $info = CustomerVip::getCustomerInformation($phone);
- if(!$info || (strtotime($info->vip_end_time) < time())){
- return false;
- }
- return true;
- }
- }
|