zoukankan      html  css  js  c++  java
  • ecshop后台 计划任务

    计划任务定时清理掉设置后的内容

    主要针对单表删除(日志,);对于多表删除,不太好用(订单+订单商品+订单日志)

    结构:

    1.计划任务语言包:languageszh_cncron

    2.php文件:includesmodulescron

    实例

    a.语言包

    <?php
    
    global $_LANG;
    
    $_LANG['depot_order']            = '微仓采购订单';
    $_LANG['depot_order_desc']       = '删除微仓采购订单,无效订单+订单商品';
    $_LANG['depot_order_day']   = '删除几天前未确认订单';
    $_LANG['depot_order_day_range']['1'] = '1天';
    $_LANG['depot_order_day_range']['7'] = '7天';
    $_LANG['depot_order_day_range']['15'] = '15天';
    $_LANG['depot_order_day_range']['30'] = '30天';
    $_LANG['depot_order_day_range']['90'] = '90天';
    ?>

    b.php文件

    <?php
    
    if (!defined('IN_ECS'))
    {
        die('Hacking attempt');
    }
    $cron_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/cron/depot_order.php';
    if (file_exists($cron_lang))
    {
        global $_LANG;
    
        include_once($cron_lang);
    }
    
    /* 模块的基本信息 */
    if (isset($set_modules) && $set_modules == TRUE)
    {
        $i = isset($modules) ? count($modules) : 0;
    
        /* 代码 */
        $modules[$i]['code']    = basename(__FILE__, '.php');
    
        /* 描述对应的语言项 */
        $modules[$i]['desc']    = 'depot_order_desc';
    
        /* 作者 */
        $modules[$i]['author']  = '亮星科技';
    
        /* 网址 */
        $modules[$i]['website'] = 'http://www.brightdiva.hk';
    
        /* 版本号 */
        $modules[$i]['version'] = '1.0.0';
    
        /* 配置信息 */
        $modules[$i]['config']  = array(
            array('name' => 'depot_order_day', 'type' => 'select', 'value' => '1'),
        );
    
        return;
    }
    
    empty($cron['depot_order_day']) && $cron['depot_order_day'] = 7;
    
    $deltime = gmtime() - $cron['depot_order_day'] * 3600 * 24;
    
    $sql = "DELETE o,g FROM ".$ecs->table('depot_order')." AS o,".$ecs->table('depot_goods')." AS g where o.order_id = g.order_id and o.order_status=0 and o.pay_status= 0 and o.add_time < '$deltime'";
    $db->query($sql);
    ?>
  • 相关阅读:
    ARCGIS JAVASCRIPT API (3.2)部署
    WINFORM 只能运行一个实例问题
    iOS 版本号
    同步和异步的区别
    简单的手机号判断
    "_inflateEnd", referenced from "_inflateInit_"等。这时需要在工程中加入libz.dlib 文件
    iOS 实现打电话
    assign retain copy iOS
    iOS 长按事件 UILongPressGestureRecognizer
    UITableView 滑动删除
  • 原文地址:https://www.cnblogs.com/wesky/p/5485140.html
Copyright © 2011-2022 走看看