where('is_publish', $where['is_publish']); if ($where['title'] != '') $model->where('title', 'like', "%$where[title]%"); return $model; } public static function getSytemVipList($where) { $model = self::setWhere($where)->order('sort DESC,add_time DESC'); $data = ($list = $model->page((int)$where['page'], (int)$where['limit']) ->select()) && count($list) ? $list->toArray() : []; foreach ($data as &$item) { if ($item['vip_day'] == -1) $item['vip_day'] = '永久'; } $count = self::setWhere($where)->count(); return compact('data', 'count'); } public static function getSytemVipSelect() { return self::where('mer_id', 0)->where('is_del', 0)->where('is_show', 1)->column('title', 'id'); } /**自定义设置会员 * @param $time * @param $user */ public static function setUserCustomMember($day, $userInfo) { switch ($userInfo['level']) { case 1: $overdue_time = bcadd(bcmul($day, 86400, 0), $userInfo['overdue_time'], 0); $res = User::edit(['overdue_time' => $overdue_time], $userInfo['uid'], 'uid'); break; case 0: $overdue_time = bcadd(bcmul($day, 86400, 0), time(), 0); $res = User::edit(['level' => 1, 'member_time' => time(), 'overdue_time' => $overdue_time], $userInfo['uid'], 'uid'); break; } return $res; } }