<?php
namespace Passport\Lib;

use Dever;

class Cron
{
    public function combine_api()
    {

    }
	# 定时合并
    public function combine()
    {
        $combine = Dever::project('combine');
        if ($combine) {
        	$where['status'] = 1;
        	$data = Dever::db('passport/combine')->state($where);

        	if ($data) {
        		foreach ($data as $k => $v) {
        			//$drop = implode(',', $v['old_uid']);
                    $drop = $v['old_uid'];
            		Dever::load('combine/lib/core.handle?uid=' . $v['new_uid'] . '&drop=' . $drop);

            		$update['where_id'] = $v['id'];
            		$update['status'] = 2;
            		Dever::db('passport/combine')->update($update);
        		}
        	}
            //Dever::daemon('lib/core.handle?uid=' . $cur . '&drop=' . $drop, 'combine');
        }
        return 'ok';
    }
}
