當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Task::UpdateStatus方法代碼示例

本文整理匯總了PHP中Task::UpdateStatus方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::UpdateStatus方法的具體用法?PHP Task::UpdateStatus怎麽用?PHP Task::UpdateStatus使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Task的用法示例。


在下文中一共展示了Task::UpdateStatus方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dirname

 */
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
// test curl
$curl = curl_init();
curl_close($curl);
// 設置執行超時時間(秒)
set_time_limit(500);
// 更新腳本最後執行時間
$user = new User();
$user->update(array('last_exec' => time()), array());
$watch = new Stopwatch();
$watch->Start();
$task = new Task();
$tasks = $task->GetExecTasks();
$taskIds = array_keys($tasks);
$task->UpdateStatus(Task::EXECING, $taskIds);
$thirdAccount = new ThirdAccount();
foreach ($tasks as $id => $item) {
    $type_arr = explode('|', $item['type']);
    if (str_contains($item['msg'], '驗證碼') || str_contains($item['msg'], 'valCodeError') || $type_arr[0] == 'qzone_simula') {
        if (time() - $item['last_send'] < 10 * 60) {
            continue;
        }
    }
    if (str_contains($item['msg'], '重複發送') || str_contains($item['msg'], '用戶調用次數超過限製')) {
        $task->update(array('retry_count' => Task::RETRY_COUNT), array('id' => $id));
        continue;
    }
    $third = $thirdAccount->getThird($item['uid'], $type_arr[0], $type_arr[1]);
    if ($third && $third['valid'] == 1) {
        $api = Factory::CreateAPI2($type_arr[0], $type_arr[1], $third);
開發者ID:z445056647,項目名稱:phx-svns,代碼行數:31,代碼來源:task_exec.php

示例2: explode

	}
	$("#countdown").text(countd);
}, 1000);
</script>');
            if ($_POST['time'] != 'on') {
                $arr = explode('|', $item['type']);
                $thirdAccount = new ThirdAccount();
                $third = $thirdAccount->getThird($item['uid'], $arr[0], $arr[1]);
                $api = Factory::CreateAPI2($arr[0], $arr[1], $third);
                if ($item['cat'] == 'weibo') {
                    $ret = $api->upload($item['content'], $item['pic']);
                } else {
                    $ret = $api->publish($item['title'], $item['content']);
                }
                if ($ret === true) {
                    $task->UpdateStatus(Task::OK, $id);
                } else {
                    if (strpos($ret, '已過期') !== false) {
                        $thirdAccount->fail($third, $ret);
                    }
                    $task->UpdateStatus(Task::ERROR, $id, $ret);
                }
                $TEMPLATE['report'][$item['type']] = array('status' => $ret === true, 'msg' => $ret === true ? '發送成功!<a href="' . $third['url'] . '" target="_blank">查看</a>' : '發送失敗:' . $ret . ' <a href="list_err.php">重新發送</a>');
            } else {
                $TEMPLATE['report'][$item['type']] = array('status' => true, 'msg' => '將於 ' . date('Y-m-d H:i', $item['send_time']) . ' 定時發送!');
            }
            //redirect($_POST['return_url']);
        }
        break;
    case '取消':
        if ($data['status'] == Task::TASK_EDIT) {
開發者ID:z445056647,項目名稱:phx-svns,代碼行數:31,代碼來源:edit.php

示例3: dirname

<?php

/**
 * 發送成功列表
 * @author 潘洪學 panliu888@gmail.com
 * @create_date	2011-10
 */
include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'init.php';
Passport::RequireLogin();
$task = new Task();
switch (strtolower($_GET['action'])) {
    case 'del':
        $task->UpdateStatus(Task::DELETE_OK, intval($_GET['id']), '已取消');
        break;
    case 'clear':
        $task->update(array('status' => Task::DELETE_OK, 'msg' => '被清空'), array('uid' => Passport::GetLoginUid(), 'status' => Task::OK));
        redirect('?');
        break;
}
$pager = new Pager($task->GetCount(Task::OK), 20);
$TEMPLATE['list'] = $task->GetList(Task::OK, $pager->offset());
$TEMPLATE['pager'] = $pager->render();
$TEMPLATE['title'] = '已發送';
$TEMPLATE['login_name'] = Passport::GetLoginName();
$TEMPLATE['nav']['list_ok'] = 'current';
$smarty = new Template();
echo $smarty->r('list_ok');
開發者ID:z445056647,項目名稱:phx-svns,代碼行數:27,代碼來源:list_ok.php

示例4: Task

$task = new Task();
switch ($_GET['action']) {
    case 'send':
        $thirdAccount = new ThirdAccount();
        $id = intval($_GET['id']);
        $item = $task->get($id);
        if ($item) {
            $type = $item['type'];
            $arr = explode('|', $type);
            $third = $thirdAccount->getByType($arr[0], $arr[1], $item['uid']);
            $api = Factory::CreateAPI2($arr[0], $arr[1], $third);
            if ($item['cat'] == 'weibo') {
                $ret = $api->upload($item['content'], $item['pic']);
            } else {
                $ret = $api->publish($item['title'], $item['content']);
            }
            $TEMPLATE['report'] = array();
            $TEMPLATE['report'][$type] = array('id' => $id, 'status' => $ret === true, 'msg' => $ret === true ? '發送成功!<a href="' . $third['url'] . '" target="_blank">查看</a>' : '發送失敗:' . $ret);
            $task->UpdateStatus($ret === true ? Task::OK : Task::ERROR, $id, $ret, time());
        }
        break;
    case 'del':
        $task->UpdateStatus(Task::DELETE_TASK, intval($_GET['id']), '已取消');
        break;
}
$TEMPLATE['list'] = $task->GetList(Task::TASK);
$TEMPLATE['title'] = '定時發送任務';
$TEMPLATE['login_name'] = Passport::GetLoginName();
$TEMPLATE['nav']['task'] = 'current';
$smarty = new Template();
echo $smarty->r('task');
開發者ID:z445056647,項目名稱:phx-svns,代碼行數:31,代碼來源:task.php


注:本文中的Task::UpdateStatus方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。