當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Module::className方法代碼示例

本文整理匯總了PHP中skeeks\cms\shop\Module::className方法的典型用法代碼示例。如果您正苦於以下問題:PHP Module::className方法的具體用法?PHP Module::className怎麽用?PHP Module::className使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在skeeks\cms\shop\Module的用法示例。


在下文中一共展示了Module::className方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: beforeUpdateCallback

 public function beforeUpdateCallback($e)
 {
     if ($this->isAttributeChanged('canceled')) {
         $this->canceled_at = \Yii::$app->formatter->asTimestamp(time());
     }
     if ($this->isAttributeChanged('payed')) {
         $this->payed_at = \Yii::$app->formatter->asTimestamp(time());
     }
     if ($this->isAttributeChanged('status_code')) {
         $this->status_at = \Yii::$app->formatter->asTimestamp(time());
         (new ShopOrderChange(['type' => ShopOrderChange::ORDER_STATUS_CHANGED, 'shop_order_id' => $this->id, 'data' => ['status' => $this->status->name]]))->save();
         //Письмо тому кто заказывает
         if ($this->user->email) {
             try {
                 \Yii::$app->mailer->view->theme->pathMap['@app/mail'][] = '@skeeks/cms/shop/mail';
                 \Yii::$app->mailer->compose('order-status-change', ['order' => $this])->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName . ''])->setTo($this->user->email)->setSubject(\Yii::$app->cms->appName . ': ' . \Yii::t('skeeks/shop/app', 'Change order status') . ' #' . $this->id)->send();
             } catch (\Exception $e) {
                 \Yii::error('Ошибка отправки email: ' . $e->getMessage(), Module::className());
             }
         }
     }
     if ($this->isAttributeChanged('allow_payment') && $this->allow_payment == Cms::BOOL_Y) {
         (new ShopOrderChange(['type' => ShopOrderChange::ORDER_ALLOW_PAYMENT, 'shop_order_id' => $this->id]))->save();
         //Письмо тому кто заказывает
         if ($this->user->email) {
             try {
                 \Yii::$app->mailer->view->theme->pathMap['@app/mail'][] = '@skeeks/cms/shop/mail';
                 \Yii::$app->mailer->compose('order-allow-payment', ['order' => $this])->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName . ''])->setTo($this->user->email)->setSubject(\Yii::$app->cms->appName . ': ' . \Yii::t('skeeks/shop/app', 'Resolution of payment on request') . ' #' . $this->id)->send();
             } catch (\Exception $e) {
                 \Yii::error('Ошибка отправки email: ' . $e->getMessage(), Module::className());
             }
         }
     }
     if ($this->isAttributeChanged('allow_delivery') && $this->allow_delivery == Cms::BOOL_Y) {
         (new ShopOrderChange(['type' => ShopOrderChange::ORDER_ALLOW_DELIVERY, 'shop_order_id' => $this->id]))->save();
         //Письмо тому кто заказывает
         if ($this->user->email) {
             try {
                 \Yii::$app->mailer->view->theme->pathMap['@app/mail'][] = '@skeeks/cms/shop/mail';
                 \Yii::$app->mailer->compose('order-allow-delivery', ['order' => $this])->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName . ''])->setTo($this->user->email)->setSubject(\Yii::$app->cms->appName . ': ' . \Yii::t('skeeks/shop/app', 'Resolution of payment on request') . ' #' . $this->id)->send();
             } catch (\Exception $e) {
                 \Yii::error('Ошибка отправки email: ' . $e->getMessage(), Module::className());
             }
         }
     }
     if ($this->isAttributeChanged('canceled') && $this->canceled == Cms::BOOL_Y) {
         (new ShopOrderChange(['type' => ShopOrderChange::ORDER_CANCELED, 'shop_order_id' => $this->id, 'data' => ['reason_canceled' => $this->reason_canceled]]))->save();
         //Письмо тому кто заказывает
         if ($this->user->email) {
             try {
                 \Yii::$app->mailer->view->theme->pathMap['@app/mail'][] = '@skeeks/cms/shop/mail';
                 \Yii::$app->mailer->compose('order-canceled', ['order' => $this])->setFrom([\Yii::$app->cms->adminEmail => \Yii::$app->cms->appName . ''])->setTo($this->user->email)->setSubject(\Yii::$app->cms->appName . ': ' . \Yii::t('skeeks/shop/app', 'Cancellations') . ' #' . $this->id)->send();
             } catch (\Exception $e) {
                 \Yii::error('Ошибка отправки email: ' . $e->getMessage(), Module::className());
             }
         }
     }
 }
開發者ID:skeeks-cms,項目名稱:cms-shop,代碼行數:58,代碼來源:ShopOrder.php


注:本文中的skeeks\cms\shop\Module::className方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。