<?php

use App\Base\Base;
use App\Services\shop\ShopService;
use App\Exception\custom\ShopException;
class ShopController extends Base
{
    
    /**
     * 创建店铺
     *
     */
    public function add_shopAction()
    {
    	$params = $this->params;
        $shop = ShopService::addShop($params);
        if (!empty($shop)) {
        	$this->success();
        }else{
            throw new ShopException(['cus'=>5]);
        }
    }
    
    /**
     * 门店列表
     *
     */
    public function get_shop_listAction()
    {
        $params = $this->params;
        $subShopList = ShopService::getShopList($params);
        $this->success(['result' => $subShopList]);
    }

    /**
     * 店铺编辑接口
     *
     */
    public function update_shopAction()
    {
        $params = $this->params;
        $where['stores_id'] = !empty($params['stores_id']) ? $params['stores_id'] : '';
        $subShopList = ShopService::updateShop($params,$where);
    }

    /**
     * 获取数据
     *
     */
    public function get_shop_infoAction($value='')
    {
        $params = $this->params;
        $param['stores_id'] = !empty($params['stores_id']) ? $params['stores_id'] : '';
        $subShopList = ShopService::getShopInfo($param);
    }

    /**
     * 后台门店列表
     *
     */
    public function shop_listAction()
    {
        $params = $this->params;
        $subShopList = ShopService::opShopList($params);
        $this->success($subShopList);
    }

 


}