123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- <?php
- /**
- * DayPayLogic.php UTF-8
- *
- *
- * @date : 2017/12/18 11:42
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : liguanglong <lgl@huosdk.com>
- * @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'),
- ];
- }
- }
|