<?php
/**
 *定时任务
 */
defined('IN_IA') or exit('Access Denied');
ob_clean();
global $_GPC, $_W;
$settings = $this->module['config'];
$op = $_GPC['op'];
//处理回调的物流信息
if($op=='trends'){
    header('Content-Type:application/json');
    $trendOrder = pdo_get("evzg_express_trends",array('expresssn'=>$_GPC['expresssn'],'uniacid'=>$_GPC['uniacid'],'expresscode'=>$_GPC['expresscode'],'status'=>'1'));
    if(empty($trendOrder)){
       $msg = json_encode(array("code"=>'4001','msg'=>'信息不存在'));
    }
   $result = pdo_update("evzg_express_trends",array('trends'=>$_GPC['trends'],'status'=>$_GPC['status']),array('expresssn'=>$_GPC['expresssn'],'uniacid'=>$_GPC['uniacid'],'expresscode'=>$_GPC['expresscode']));
   if($result){
       $tpl = array(
           'openid'=>$trendOrder['openid'],
           "template_id" => $settings['msg']['order_dt_id'],
           "url" => $_W['siteroot'] . 'app/' . $this->createMobileUrl('expressline',array('op'=>'ajax','expressn'=>$trendOrder['expresssn'])),
           "data" => array(
               'first' => "您好，你的快递{$trendOrder['expressshop']}:{$trendOrder['expresssn']}有新动态",
               'keyword1' => $trendOrder['expressshop'],
               'keyword2' => $trendOrder['expresssn'],
               'keyword3' => date('Y年m月d日 H:i', time()),
               'keyword4' => $_GPC['trends'],
               'remark' => "感谢您的使用"
              )
       );
       sendMsgTpl($tpl);
       $msg = json_encode(array("code"=>'200','msg'=>'信息更新完毕'),JSON_UNESCAPED_UNICODE);
   }else{
       $msg = json_encode(array("code"=>'4002','msg'=>'信息更新错误'),JSON_UNESCAPED_UNICODE);
   }
   echo($msg);
}