当前位置: 首页>>代码示例>>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;未经允许,请勿转载。