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


PHP Profile::getHost方法代碼示例

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


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

示例1: createShop

 private function createShop($login, $buyer_bonus, $recommender_bonus)
 {
     $user = new User();
     $user->email = $login . '@mail.com';
     $user->setPassword($user->email);
     $user->generateAuthKey();
     $user->save(false);
     $profile = new Profile();
     $profile->user_id = $user->id;
     $profile->url = 'https://temp-mail.ru';
     $profile->buyer_bonus = $buyer_bonus;
     $profile->recommender_bonus = $recommender_bonus;
     $profile->status_id = 1;
     $profile->host = $profile->getHost($profile->url);
     $profile->save(false);
     $this->auth->assign($this->auth->createRole(User::ROLE_SHOP), $user->id);
     return $user;
 }
開發者ID:nicdnepr,項目名稱:skidos,代碼行數:18,代碼來源:UserController.php

示例2: addUrl

 public function addUrl($link)
 {
     $shop_id = null;
     $text = '';
     $profile = new Profile();
     $host = $profile->getHost($link);
     /* @var $shop Profile */
     $shop = Profile::find()->where(['host' => $host])->one();
     if ($shop) {
         $shop_id = $shop->user_id;
         $text .= 'магазин ' . $shop->url . '<br>';
         $text .= 'бонус покупателю ' . $shop->buyer_bonus . '<br>';
         $text .= 'бонус рекомендателю ' . $shop->recommender_bonus . '<br>';
         $text .= 'статус ' . $shop->status->name . '<br>';
     } elseif (!ModerateShop::find()->where(['url' => $host])->exists()) {
         $moderateShop = new ModerateShop(['user_id' => Yii::$app->user->identity->id, 'url' => $host]);
         $moderateShop->save();
     }
     $text .= 'Вы можете давать эту ссылку своим друзьям<br>';
     $url = new Url(['user_id' => Yii::$app->user->identity->id, 'link' => $link, 'shop_id' => $shop_id]);
     $url->save();
     return $text . \yii\helpers\Url::to(['purchase/create', 'affiliate_id' => Yii::$app->user->identity->id, 'url_id' => $url->id], true);
 }
開發者ID:nicdnepr,項目名稱:skidos,代碼行數:23,代碼來源:Url.php


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