* @version : HUOSDK 8.0 */ namespace huo\logic\data; use huo\model\common\CommonModel; use huo\model\member\VipModel; use think\Lang; class VipDataLogic extends CommonModel { /** * * 会员卡状态 * @param $data * * @return null|string */ static public function getVipStatus($data){ $status = null; /*试用*/ if($data['type_id'] == VipModel::NOT_MEMBER && time() <= $data['try_time']){ $status = lang('shakedown period'); } /*成功*/ else if($data['type_id'] != VipModel::NOT_MEMBER && time() <= $data['end_time']){ $status = lang('success'); } /*退订*/ else if($data['auto_renew'] == VipModel::NOT_AUTO_RENEW){ $status = lang('unsubscribe'); } /*宽限期*/ else if($data['auto_renew'] != VipModel::NOT_AUTO_RENEW && (time() <= $data['end_time'] || time() <= $data['try_time'])){ $status = lang('grace period'); } else{ $status = lang('overdue'); } return $status; } /** * * 会员卡类型显示 * @param int $type_id * * @return mixed */ static public function getVipTypeLabel($type_id = 1){ foreach (self::vipType() as $key => $val){ if($key == $type_id){ return $val; } } } /** * * 会员卡类型 * @return array */ static public function vipType(){ return [ VipModel::NOT_MEMBER => lang('outsider'), VipModel::DAY_MEMBER => lang('day card'), VipModel::WEEK_MEMBER => lang('week card'), VipModel::MONTH_MEMBER => lang('month card'), ]; } /** * 续(退)订类型 * @return array */ static public function vipRenewType(){ return [ VipModel::NOT_AUTO_RENEW => lang('not auto renew'), VipModel::AUTO_RENEW => lang('auto renew'), VipModel::NOT_RENEW => lang('unsubscribe'), ]; } }