<?php
function shop_get_set(){
 global $_W;
 $shop = pdo_get("evzg_express_setting",array('uniacid'=>$_W['uniacid']));
 return $shop;
}
function shop_get_smsnum($sid){
 $shop = pdo_get("evzg_express_shop",array('id'=>$sid));
 if(empty($shop)){
     return 0;
 }
 return $shop['chitnum'];
}
/**
 * 获取指定店铺信息
 * @param 店铺id $sid
 * @return boolean|Ambigous <boolean, unknown>
 */
function shop_get_info($sid){
    $shop = pdo_get("evzg_express_shop",array('id'=>$sid));
    if(empty($shop)){
        return false;
    }
    return $shop;
}
/**
 * 更新店铺余额
 * @param unknown $sid
 * @param unknown $credit2
 */
function shop_update_credit2($sid,$credit2){
  if(empty($sid)||empty($credit2)){
      return false;
  }
  $shop = pdo_get("evzg_express_shop",array('id'=>$sid));
  pdo_update("evzg_express_shop",array('credit2'=>floatval($credit2)+$shop['credit2']),array('id'=>$sid));
  return true;
}
function shop_get_evzg_put($sid){
  global $_W;
  $sql ="SELECT COUNT(*) FROM".tablename("evzg_express_expres")."WHERE uniacid = '{$_W['uniacid']}' AND sid='{$sid}'";
  return  pdo_fetchcolumn($sql);
}
function shop_get_evzg_out($sid){
    global $_W;
    $sql ="SELECT COUNT(*) FROM".tablename("evzg_express_expres")."WHERE uniacid = '{$_W['uniacid']}' AND sid='{$sid}' AND status = 1";
    return  pdo_fetchcolumn($sql);

}
function shop_get_evzg_overplus($sid){
    global $_W;
    $sql ="SELECT COUNT(*) FROM".tablename("evzg_express_expres")."WHERE uniacid = '{$_W['uniacid']}' AND sid='{$sid}' AND status = 0 ";
    return  pdo_fetchcolumn($sql);
}