作者 王晓刚
1 个管道 的构建 通过 耗费 0 秒

自动加载

... ... @@ -32,33 +32,36 @@ class LoadController extends HomeBaseController
$where['o.order_about_time'] = array(array('<',$time),array('>',$time-30*24*60*60));
$whereor = "o.status = 1 and o.order_about_time < $time and o.order_about_time > ".($time-30*24*60*60)." and o.order_expire_time2 > $time";
$data = $orderInfoModel->selectData1($where,$whereor);
dump($data);
exit();
// foreach($data as $key1 => $vo){
// //判断是否已经发送
// $send_vice = Db::name('send_vice')->where(array('order_id'=>$vo['o_id'],'collocation_id'=>$vo['id'],'time'=>$vo['order_about_time'],'type'=>1))->find();
// if(empty($send_vice)){
// //模板消息
// $templateId = '83NoWJ74UmI-DY_FwrDrTBx1iysu9__6fosB-eMFm78';
// $data1 = array(
// 'first'=>"尊敬的用户,您有一份保单即将到期需要续费,请在保障截止日期前完成续保,否则保单将失效",
// 'keyword1'=>$vo['insurer'],
// 'keyword2'=>$vo['product_name'],
// 'keyword3'=>$vo['insurance_num'],
// 'keyword4'=>date('Y-m-d',$vo['order_about_time']+30*24*60*60),
// 'remark'=>"请在保障期间内续费",
// );
// $url = url('/index/all_guarantee/guarantee_info',array('id'=>$vo['o_id']),'',true);
// $user1 = Db::name('third_party_user')->where('user_id',$vo['user_id'])->find();
// $this->template($templateId,$data1,$url,$user1['openid']);
// //短信
// $user2 = Db::name('user')->where('id',$vo['user_id'])->find();
// $content = "【橙象保单】尊敬的用户,您有一份保单即将到期需要续费,请在保障截止日期前完成续保,否则保单将失效,保险单号$vo[insurance_num],请在".date('Y月m日d',$vo['order_about_time']+30*24*60*60)."之前续费。";
// $this->note($content,$user2['mobile']);
// Db::name('send_vice')->insert(array('order_id'=>$vo['o_id'],'collocation_id'=>$vo['id'],'time'=>$vo['order_about_time'],'user_id'=>$vo['user_id'],'create_time'=>time(),'type'=>1));
// //Db::name('order')->where(['id'=>$vo['o_id']])->setInc('order_about_time',30*24*60*60);
// }
// }
foreach($data as $key1 => $vo){
//判断是否已经发送
$send_vice = Db::name('send_vice')->where(array('order_id'=>$vo['o_id'],'collocation_id'=>$vo['id'],'time'=>$vo['order_about_time'],'type'=>1))->find();
if(empty($send_vice)){
//模板消息
$templateId = '83NoWJ74UmI-DY_FwrDrTBx1iysu9__6fosB-eMFm78';
$data1 = array(
'first'=>"尊敬的用户,您有一份保单即将到期需要续费,请在保障截止日期前完成续保,否则保单将失效",
'keyword1'=>$vo['insurer'],
'keyword2'=>$vo['product_name'],
'keyword3'=>$vo['insurance_num'],
'keyword4'=>date('Y-m-d',$vo['order_about_time']+30*24*60*60),
'remark'=>"请在保障期间内续费",
);
$url = url('/index/all_guarantee/guarantee_info',array('id'=>$vo['o_id']),'',true);
$user1 = Db::name('third_party_user')->where('user_id',$vo['user_id'])->find();
$this->template($templateId,$data1,$url,$user1['openid']);
//短信
$user2 = Db::name('user')->where('id',$vo['user_id'])->find();
$content = "【橙象保单】尊敬的用户,您有一份保单即将到期需要续费,请在保障截止日期前完成续保,否则保单将失效,保险单号$vo[insurance_num],请在".date('Y月m日d',$vo['order_about_time']+30*24*60*60)."之前续费。";
$this->note($content,$user2['mobile']);
Db::name('send_vice')->insert(array('order_id'=>$vo['o_id'],'collocation_id'=>$vo['id'],'time'=>$vo['order_about_time'],'user_id'=>$vo['user_id'],'create_time'=>time(),'type'=>1));
//Db::name('order')->where(['id'=>$vo['o_id']])->setInc('order_about_time',30*24*60*60);
if(($vo['order_about_time']+30*24*60*60)<time()){
if(($vo['order_about_time']+365*24*60*60)<$vo['order_expire_time']){
Db::name('order')->where(['id'=>$vo['o_id']])->setInc('order_about_time',365*24*60*60);
}
}
}
}
}else if($type == 2){
//$data['status'] eq 2 || $data['order_expire_time'] lt time() || ($data['order_about_time']+24*30*60*60) lt time()
// $where['o.status'] = ['eq',2];
... ...