<?php
defined('IN_IA') or exit('Access Denied');
global $_GPC, $_W;
$settings = $this->module['config'];
$sql = "SELECT * FROM" . tablename("evzg_express_shop") . "WHERE openid='{$_W['openid']}' AND 	uniacid='{$_W['uniacid']}'";
$shop = pdo_fetch($sql);
$op = ! empty($_GPC['op']) ? $_GPC['op'] : 'display';
$shop_set = shop_get_set();
/* var_dump($shop_set);die(); */
if($op=='open'){
    $status =intval($_GPC['status']);
    $result = pdo_update('evzg_express_shop',array('enabled'=>$status),array('id'=>$shop['id']));
    if($result){
        ijson(array('code'=>200,'msg'=>'操作成功'));
    }else{
        ijson(array('code'=>401,'msg'=>'操作失败'));
    }
}
if (empty($shop)) {
    message("你不是门店管理者,请先注册", $this->createMobileUrl('login', array(
        'op' => 'reg'
    )), "error");
}
if(empty($shop['enabled'])){
    message("亲的店铺已被封停，请联系管理员开启",$this->createMobileUrl('shop'), "error");
}

// var_dump($shop);die();
$default='default/shop/';
include $this->template($default.'my');