:EcStore批量生成评论和购买记录插件,自动采集淘宝天猫评论APP,兼容所有ecs版本!!   智加设计技术支持技术支持:
   
当前位置: ECSTORE开发 > ecstore二次开发新增定时任务crontab方法
推荐() 收藏()

ecstore二次开发新增定时任务crontab方法

【 作者:admin     来源: 智加设计    点击数: 1968     更新时间: 2015-05-13
  摘要:  ecstore二次开发新增定时任务crontab方法,下面以定时采集淘宝天猫评论来说明。

ecstore二次开发新增定时任务crontab方法,下面以定时采集淘宝天猫评论来说明。

定时任务相关的文件和目录结构


文件中具体内容:

commmentcj/crontab.xml


 
   同步淘宝天猫评论
   */10 * * * *
   true
 


commentcj/lib/task/synctmallcomments

class commentcj_tasks_synctmallcomments implements base_interface_task{   #此类必须实现接口 base_interface_task
    function rule() {
        return '*/1 * * * *';
    }

    function exec($params=null) {
        $this->sync_comments();
    }

    function description() {
        return '同步淘宝天猫评论';
    }
    
    private function sync_comments()
    {
        
        $db = kernel::database();

                $db -> exec("delete sdb_b2c_member_comments from sdb_b2c_member_comments ,
                                        (select comment_id from sdb_b2c_member_comments group by comment having count(*)>1 ) as t2
                                        where sdb_b2c_member_comments.comment_id=t2.comment_id");

        $now = time()-300;
        $sql = "SELECT goods_id,url,cjtime,price FROM sdb_b2c_goods WHERE disabled='false' AND url != '' AND (scctime< $now OR scctime = 0)";
        $this->getComments($db->select($sql));
    }


添加完成后台更新和维护下后台应用中心即可在定时任务列表中看到同步淘宝天猫评论。

如有任何疑问都可以直接联系QQ:2392521892来解答。

评论加载中............
运行信息( 0.0295 秒):关闭X