<?php
|
|
namespace app\job\model\plus\vip;
|
|
use app\common\model\plus\vip\User as UserModel;
|
|
/**
|
* VIP用户模型
|
*/
|
class User extends UserModel
|
{
|
/**
|
* 获取需要升级的用户列表
|
*/
|
public function getUpgradeList()
|
{
|
return $this->where('is_delete', '=', 0)
|
->where('is_upgrade', '=', 1)
|
->select();
|
}
|
|
/**
|
* 获取需要降级的用户列表
|
*/
|
public function getDowngradeList()
|
{
|
return $this->where('is_delete', '=', 0)
|
->where('is_downgrade', '=', 1)
|
->select();
|
}
|
|
/**
|
* 批量处理用户等级变更
|
*/
|
public function processGradeChange($ids, $is_upgrade = true)
|
{
|
$field = $is_upgrade ? 'is_upgrade' : 'is_downgrade';
|
return $this->where('user_id', 'in', $ids)
|
->save([$field => 0]);
|
}
|
}
|