You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
2.5 KiB
71 lines
2.5 KiB
10 months ago
|
<?php
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
|
||
|
// +----------------------------------------------------------------------
|
||
|
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
|
||
|
// +----------------------------------------------------------------------
|
||
|
|
||
|
namespace app\admin\model\user;
|
||
|
|
||
|
use traits\ModelTrait;
|
||
|
use basic\ModelBasic;
|
||
|
|
||
|
/**
|
||
|
* 会员设置 model
|
||
|
* Class MemberShip
|
||
|
* @package app\admin\model\user
|
||
|
*/
|
||
|
class MemberShip extends ModelBasic
|
||
|
{
|
||
|
use ModelTrait;
|
||
|
|
||
|
public static function setWhere($where)
|
||
|
{
|
||
|
$model = self::where('is_del', 0);
|
||
|
if ($where['is_publish'] != '') $model->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;
|
||
|
}
|
||
|
}
|