1 回答
TA贡献2065条经验 获得超14个赞
您可以将客户的所有时间保存在一个字符串中,一个列表中,然后在电子邮件中使用它
foreach( $client_emails as $client_email){
$cancelled_items=OrderItem::find()->where(['location_id'=>$model->location_name] and ['user_id'=>$client_email['id']])->andwhere(['between', 'date', $model->from_date, $model->to_date ])->all();
$body = "regarding cancellation
<ul>"; // create the ul element
foreach($cancelled_items as $cancelled_item){
$start_time = $cancelled_item->start_time;
$body .= "<li>". $start_time."</li>"; // add the li with the start_time content inside
}
$body .= "</ul>"; // close the list
\Yii::$app->mailer->compose()
->setFrom([$from_email => $from_name])
->setTo($client_email['email'])
->setSubject('Regarding Cancellation of Classes')
->setHtmlBody($body)
->send();
}
不要获取取消状态未设置为取消的用户。$orders像这样编辑你的变量
$order_items = OrderItem::find()->where(['location_id'=>$model->location_name])
->andwhere(['between', 'date', '', $model->from_date, $model->to_date ])
->andWhere("cancellation_status=:cancellation_status",array(':cancellation_status'=>'cancelled'))->all();
- 1 回答
- 0 关注
- 96 浏览
添加回答
举报