Example #1
0
 private function autoPosting()
 {
     if ($this->auto_post_999) {
         $poster_999 = new \frontend\components\AutoPoster999();
         $poster_999->title = $this->title;
         $poster_999->content = $this->content;
         $poster_999->postMarket();
     }
     if ($this->auto_post_makler) {
         $poster_makler = new \frontend\components\AutoPosterMarkler();
         $poster_makler->postMarket($this->title, $this->content);
     }
     if ($this->auto_post_ebay) {
         $poster_ebay = new \frontend\components\AutoPosterEbay();
         $poster_ebay->addItem($this->title, '377', '25', $this->content);
     }
 }
Example #2
0
 public function actionAddProposal()
 {
     $market_id = Yii::$app->request->post('market_id');
     $price = Yii::$app->request->post('price');
     if (Yii::$app->getRequest()->isAjax && $market_id && $price) {
         $propose = new MarketsProposes();
         $propose->user_id = !Yii::$app->user->isGuest ? Yii::$app->user->id : null;
         $propose->markets_id = $market_id;
         $propose->currency_id = 1;
         $propose->xrl_price = $price;
         $propose->price = $price;
         $propose->save();
         $market = Markets::findOne($market_id);
         //TODO сделать проверку, откуда пришло объявление
         $msg = new \frontend\components\AutoPoster999();
         $msg->postMessage('', "Привет, куплю {$market->title} за {$price}");
     }
 }