예제 #1
0
파일: common.php 프로젝트: superman1982/ddd
function do_nodemgr_get_common_task($post)
{
    #print_r($post);
    $post_type = $post['type'];
    $post_opt = $post['opt'];
    $post_data = $post['data'];
    $sid = $post_data['sid'];
    $db = new DBObj();
    $db->conn(DBS_MAIN);
    $db->select_db(DB_DNSPRO);
    $sql = "select * from `task_list` where \n\t\t\t`type` = '{$post_type}' and \n\t\t\t`status` = 'init' and \n\t\t\t`id` in (SELECT taskid FROM `task_feedback` where \n\t\t\t\t`sid` = '{$sid}' and `status` = 'init'\n\t\t\t\tand `task_feedback`.`tried` <= `task_feedback`.`retry`)";
    $result = $db->query($sql);
    $tasks = array();
    while ($row = mysql_fetch_array($result)) {
        $task_id = $row['id'];
        $task_type = $row['type'];
        $task_opt = $row['opt'];
        $task_data = $row['data'];
        $tasks[$task_id] = array('type' => $task_type, 'opt' => $task_opt, 'data' => $task_data);
    }
    mysql_free_result($result);
    $ret = array('ret' => 0, 'error' => '', 'result' => $tasks);
    print_r(json_encode($ret));
}