0, //通知状态:0=未通知,1=已通知 'order.status' => 1, //订单状态:-1=退货,0=取消订单,1=正常 'order.have_paid' => ['gt',0], //已支付 'order.have_received' => 0, //未核销 'order.refund_status' => 0, //未退款 'product.activetime' => ['gt',$todayend], ]; $list = Db::name('unishop_order')->alias('order') ->field('order.id,product.title,product.info,product.activetime,user.wxmini_openid') ->join('user','user.id = order.user_id','left') ->join('unishop_order_product op','order.id = op.order_id','left') ->join('unishop_product product','product.id = op.product_id','left') ->where($where)->limit(10)->select(); if(empty($list)){ echo '没有需要处理的订单'; exit; } $order_ids = array_column($list,'id'); Db::name('unishop_order')->where('id','IN',$order_ids)->update(['notice_status' => 1]); echo implode(',',$order_ids); try { foreach ($list as $k=>$v){ $config = config('wxMiniProgram'); $wechat = new Wechat($config['appid'],$config['secret']); //活动明天开始 $template_id = $config['mini_msgid_order']; $data = [ 'thing4' => ['value' => $v['title']], 'thing6' => ['value' => $v['info']], 'date5' => ['value' => date('Y-m-d H:i',$v['activetime'])], 'thing7' => ['value' => '活动明天开始,不要迟到哦'], ]; //dump($data); $rs = $wechat->send($template_id,$v['wxmini_openid'],$data); } }catch (Exception $e) { } } }