RegisterModel::audit PHP Метод

audit() публичный Метод

审核用户
public audit ( array $uids, integer $type = 1 ) : boolean
$uids array 用户UID数组
$type integer 类型,0表示取消审核,1表示通过审核
Результат boolean 是否审核成功
    public function audit($uids, $type = 1)
    {
        // 处理数据
        !is_array($uids) && ($uids = explode(',', $uids));
        $uids = array_unique(array_filter(array_map('intval', $uids)));
        // 审核指定用户
        $map['uid'] = array('IN', $uids);
        $result = $this->_user_model->where($map)->setField('is_audit', $type);
        model('User')->cleanCache($uids);
        if (!$result) {
            $this->_error = L('PUBLIC_REVIEW_FAIL');
            // 审核失败
            return false;
        } else {
            if ($type == 0) {
                $this->_error = L('PUBLIC_CANCEL_REVIEW_SUCCESS');
                // 取消审核成功
                // 发送取消审核邮件
                foreach ($uids as $touid) {
                    model('Notify')->sendNotify($touid, 'audit_error');
                }
                return true;
            }
            // 发送通过审核邮件
            foreach ($uids as $uid) {
                $this->sendActivationEmail($uid, 'audit_ok');
            }
            $this->_error = L('PUBLIC_REVIEW_SUCCESS');
            // 审核成功
            return true;
        }
    }