Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.30 KB | None | 0 0
  1. <?php
  2.  
  3. class Anymarket_ToggleController extends SellerCenter_Controller_Api
  4. {
  5.     public function postAction()
  6.     {
  7.  
  8.         $auth = SellerCenter_Auth::getInstance();
  9.         $sellerId = $auth->getSellerId();
  10.  
  11.         $sellerService = new User_Service_Seller();
  12.         $modelCatalogBrand = SellerCenter_ServiceManager::getModel(SellerCenter_Model_Catalog_Brand::class);
  13.  
  14.         $service = new Api_Service_Seller($sellerService, $modelCatalogBrand, $this->get('service.seller.config'));
  15.         $status = $service->v10GetSellerById($sellerId);
  16.  
  17.         if ($status['account_status'] == 1) {
  18.             $status_account = ['account_status' => 0];
  19.         } else {
  20.             $status_account = ['account_status' => 1];
  21.         }
  22.  
  23.         $sellerService = new User_Service_Seller();
  24.         $sellerService->updateSeller($status_account, $sellerId);
  25.  
  26.         return true;
  27.     }
  28.  
  29. //  verificar se o comando enviado é activado, desativado ou em branco
  30.     public function verify($request)
  31.     {
  32.         $request = $this->getRequest()->getParam('status_account', null);
  33.  
  34.         if(!$request == 'activating'){
  35.             throw new Exception('Activanting failed');
  36.  
  37.         }elseif (!$request == 'deactivating'){
  38.             throw new Exception('Deactivating');
  39.         }
  40.  
  41.  
  42.  
  43.     }
  44.  
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement