Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Anymarket_ToggleController extends SellerCenter_Controller_Api
- {
- public function postAction()
- {
- $auth = SellerCenter_Auth::getInstance();
- $sellerId = $auth->getSellerId();
- $sellerService = new User_Service_Seller();
- $modelCatalogBrand = SellerCenter_ServiceManager::getModel(SellerCenter_Model_Catalog_Brand::class);
- $service = new Api_Service_Seller($sellerService, $modelCatalogBrand, $this->get('service.seller.config'));
- $status = $service->v10GetSellerById($sellerId);
- if ($status['account_status'] == 1) {
- $status_account = ['account_status' => 0];
- } else {
- $status_account = ['account_status' => 1];
- }
- $sellerService = new User_Service_Seller();
- $sellerService->updateSeller($status_account, $sellerId);
- return true;
- }
- // verificar se o comando enviado é activado, desativado ou em branco
- public function verify($request)
- {
- $request = $this->getRequest()->getParam('status_account', null);
- if(!$request == 'activating'){
- throw new Exception('Activanting failed');
- }elseif (!$request == 'deactivating'){
- throw new Exception('Deactivating');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement