Пример #1
0
/**
 * 通过id获得楼盘数据
 *  查询结果反序列化产品及房型
 * @param $id
 * @param $isGuid  id是否为GUID
 * @param $unzip  是否解压属性
 */
function biz_getProject($id, $isGuid = true, $unzip = false)
{
    $key = 'P_' . $id;
    $info = cache()->get($key);
    if (empty($info)) {
        if (memcached_addKey('Add_' . $key)) {
            $info = db_getProject($id, $isGuid, $unzip);
            memcached_set($key, $info);
            memcached_delete('Add_' . $key);
        }
    }
    return $info;
}
Пример #2
0
<?php

defined('IN_IA') or exit('Access Denied');
if (!$_W['isfounder']) {
    message('非管理员,无权处理');
}
$do = !empty($_GPC['do']) ? $_GPC['do'] : 'display';
$pid = intval($_GPC['pid']);
$project = db_getProject($pid, false, false);
$stationGUID = trim($_GPC['StationGUID']);
if ($do == 'display') {
    $list = db_getAllStation($project['projguid'], 'StationGUID');
    foreach ($list as $k => $v) {
        $level = substr_count($v['HierarchyCode'], '.');
        if ($level > 0) {
            $list[$k]['subtree'] = str_pad('&nbsp;', $level) . '├';
        }
    }
    // 部门员工列表
    $keys = array_keys($list);
    if (!in_array($stationGUID, $keys)) {
        $stationGUID = $keys[0];
    }
    $station = $list[$stationGUID];
    $moduleRight = biz_getStationRight($stationGUID, $project['projguid']);
    $users = db_getUserOfStation($stationGUID);
    include template('project/user', TEMPLATE_INCLUDEPATH);
}
if ($do == 'set') {
    $backUrl = url('project/user/display', array('pid' => $pid, 'StationGUID' => $stationGUID));
    $url = url('project/user/set', array('pid' => $pid, 'StationGUID' => $stationGUID));
Пример #3
0
 public function doWebSet()
 {
     global $_W, $_GPC;
     $op = $_GPC['op'];
     $this->CheckRight('set');
     //检查项目状态,是否允许设置
     $project = db_getProject($_W['pid'], false, false);
     if (empty($project)) {
         //|| !empty($project['status'])
         if ($_W['isajax']) {
             echo '无效的项目数据或当前项目不允许设置!';
             exit;
         } else {
             message('无效的项目数据或当前项目不允许设置!', $this->createWebUrl('manage'));
         }
     }
     $url = $this->createWebUrl('set', array('op' => $op));
     if ($op == 'discount') {
         $discount = db_getDiscount($project['projguid'], 'DiscntGUID');
         $payform = db_getPayForm($project['projguid'], 'PayFormGUID');
         foreach ($payform as &$p) {
             if ($p['DisCount']) {
                 $p['title'] = $p['PayformName'] . "[{$p['DisCount']}%]";
             }
             if ($p['PreferentialPrice'] > 0) {
                 $p['title'] = $p['PayformName'] . "[-{$p['PreferentialPrice']}¥]";
             }
         }
         unset($p);
         $set = biz_unserializer($project, 'payform');
         if (empty($set)) {
             $set = array('pay_id' => '');
         } else {
             if (count($set['pay_id']) > 0) {
                 foreach ($discount as $k => $v) {
                     $discount[$k]['select'] = in_array($k, $set['dis_id']);
                 }
             }
         }
         if ($_W['isajax']) {
             include $this->template('discountSet');
             exit;
         }
         if ($_W['token'] == $_GPC['token']) {
             $pay_id = trim($_GPC['payform']);
             $calc = array('paydiscount' => 1.0, 'decmoney' => 0, 'discount' => 1.0);
             if (!empty($pay_id) && isset($payform[$pay_id])) {
                 $set['pay_id'] = $pay_id;
                 $set['Payform'] = $payform[$pay_id];
                 $set['title'] = $payform[$pay_id]['title'];
                 $set['details'] = db_getPaydetail($pay_id);
             }
             unset($set['dis_id']);
             foreach ($_GPC['discount'] as $d) {
                 if (isset($discount[$d])) {
                     $set['dis_id'][] = $d;
                 }
             }
             $calc = biz_getRoomPriceCalc($set, $discount, $payform);
             $set['calc'] = $calc;
             $tip = round($calc['discount'] * 100, 2);
             $set['discount'] = "减免{$calc['dec_money']},折扣{$tip}%";
             $data = array('payform' => iserializer($set));
             pdo_update('project', $data, array('id' => $_W['pid']));
             biz_mem_clearProject();
             $rooms = db_getRooms($_W['project']['projguid']);
             foreach ($rooms as $r) {
                 if (in_array($r['Status'], array('待售', '销控'))) {
                     biz_calcRoomPrice($r, $calc, true);
                 }
                 //calc_payorder($r,true);
             }
             message('数据已设置', $this->createWebUrl('manage'));
         }
     }
     if ($op == 'invoice') {
         load()->web('print');
         $set = biz_unserializer($project, 'finance');
         if (empty($set['prepay'])) {
             $prepay = $set;
         } else {
             $prepay = $set['prepay'];
         }
         $order = $set['order'];
         $prefix = $set['Prefix'];
         if ($_W['isajax']) {
             include $this->template('invoiceSet');
             exit;
         }
         if ($_W['token'] == $_GPC['token']) {
             $getInvoInfo = function ($set) use($project) {
                 $set['BatchNo'] = trim($set['BatchNo']);
                 $set['Prefix'] = trim($set['Prefix']);
                 $invo = biz_getInvoiceByBatchNo($set['BatchNo'], $set['Prefix'], $project);
                 $config = array('BatchNo' => $set['BatchNo'], 'Prefix' => $set['Prefix']);
                 if (!empty($invo)) {
                     $config['InvoGUID'] = $invo['InvoGUID'];
                 }
                 return $config;
             };
             $set = array();
             $set['prepay'] = $getInvoInfo($_GPC['prepay']);
             $set['order'] = $getInvoInfo($_GPC['order']);
             $set['Prefix'] = trim($_GPC['Prefix']);
             $set['ChipsPre'] = trim($_GPC['ChipsPre']);
             $data = array('finance' => iserializer($set));
             pdo_update('project', $data, array('id' => $_W['pid']));
             biz_mem_clearProject($project);
             message('数据已设置', $this->createWebUrl('manage'));
         }
     }
     if ($op == 'sign') {
         $set = biz_unserializer($project, 'signset');
         if (empty($set)) {
             $set = array('num' => 10, 'max' => 1);
         }
         if ($_W['isajax']) {
             include $this->template('signSet');
             exit;
         }
         if ($_W['token'] == $_GPC['token']) {
             $set = array('num' => intval($_GPC['num']), 'max' => intval($_GPC['max']));
             if ($set['num'] <= 0) {
                 $set['num'] = 10;
             }
             if ($set['max'] <= 0) {
                 $set['max'] = 1;
             }
             //只能一组
             $set['max'] = 1;
             $data = array('signset' => iserializer($set));
             pdo_update('project', $data, array('id' => $_W['pid']));
             if ($_GPC['clear']) {
                 pdo_update('sign', array('signed' => 0), array('pid' => $_W['pid']));
                 pdo_update('call_group', array('called' => 0), array('pid' => $_W['pid']));
                 //pdo_update('p_room',array('selectroom'=>0))
                 memcached_delete('global_sign_' . $project['id']);
             }
             biz_mem_clearProject($project);
             message('数据已设置', $this->createWebUrl('manage'));
         }
     }
     if ($op == 'project') {
         $status = biz_getDictionary('projstatus');
         //删除创建默认状态
         unset($status[0]);
         $set = biz_unserializer($project, 'sync');
         if ($_W['isajax']) {
             include $this->template('projSet');
             exit;
         }
         if ($_W['token'] == $_GPC['token']) {
             $selStatus = intval($_GPC['status']);
             $set = array('client' => trim($_GPC['client']));
             $data = array('status' => $selStatus, 'sync' => iserializer($set));
             pdo_update('project', $data, array('id' => $project['id']));
             biz_mem_clearProject($project);
             message('数据已设置', $this->createWebUrl('manage'));
         }
     }
     if ($op == 'build') {
         $set = biz_unserializer($project, 'builds');
         if (empty($set['timeout'])) {
             $set['timeout'] = 30;
         }
         $builds = db_getBuilds($_W['project']['projguid'], 'BldGUID');
         if ($_W['isajax']) {
             include $this->template('buildSet');
             exit;
         }
         if ($_W['token'] == $_GPC['token']) {
             $bids = $_GPC['m_ids'];
             $timeout = intval($_GPC['timeout']);
             if ($timeout < 0 || $timeout > 300) {
                 $timeout = 30;
             }
             //统计房间数量
             // 更新
             pdo_update('p_building', array('status' => '0'), array('ProjGUID' => $project['projguid']));
             $keys = array_keys($builds);
             foreach ($bids as $bldGuid) {
                 if (in_array($bldGuid, $keys)) {
                     pdo_update('p_building', array('status' => '1'), array('BldGUID' => $bldGuid));
                 }
             }
             $sql = 'SELECT count(*) as cnt FROM ims_p_room ';
             $sql .= ' a INNER JOIN ims_p_building b ON a.BldGUID = b.BldGUID ';
             $sql .= ' WHERE  b.`Status`=1 and b.ProjGUID=:projguid';
             $cnt = pdo_fetchcolumn($sql, array(':projguid' => $project['projguid']));
             $set = array('build' => $bids, 'timeout' => $timeout, 'roomnum' => $cnt);
             $data = array('builds' => iserializer($set));
             pdo_update('project', $data, array('id' => $_W['pid']));
             biz_mem_clearProject();
             message('数据已设置', $this->createWebUrl('manage'));
         }
     }
     if ($op == 'bank') {
         $banks = biz_getBanks($_W['project']['BUGUID']);
         $bk = empty($project['bank']) ? array() : iunserializer($project['bank']);
         if ($_W['isajax']) {
             include $this->template('bankSet');
             exit;
         }
         if ($_W['token'] == $_GPC['token']) {
             $bankid = $_GPC['bank'];
             $prebank = db_getPreBank($bankid);
             $data = array('bank' => iserializer($prebank));
             pdo_update('project', $data, array('id' => $_W['pid']));
             biz_mem_clearProject($project);
             message('数据已设置', $this->createWebUrl('manage'));
         }
     }
 }
Пример #4
0
//增加接口调用
define('IN_SYS', true);
error_reporting(E_ALL & ~E_NOTICE);
require './framework/bootstrap.inc.php';
load()->web('business');
load()->web('dbapi');
$func = strtolower($_GPC['func']);
$res = array('ok' => false, 'msg' => '');
//检查项目授权,是否允许项目传输
if ($func == 'get_token') {
    //检查是否存在token?
    $guid = trim($_GPC['guid']);
    $key = 'sync_' . $guid;
    $token = memcached_get($key);
    if ($token == '') {
        $project = db_getProject($guid, true);
        if (empty($project)) {
            $res['msg'] = '无效的参数';
            returnJson($res);
        }
        if (memcached_addKey('Add' . $key)) {
            $data = array('guid' => $guid, 'ip' => CLIENT_IP);
            $token = GUID();
            memcached_set($key, $token, 300);
            memcached_set('sync_t_' . $token, $data, 300);
            memcached_delete('Add' . $key);
            $res['ok'] = true;
            $res['token'] = $token;
        } else {
            $res['msg'] = '无法增加cache数据';
        }
Пример #5
0
<?php

defined('IN_IA') or exit('Access Denied');
$op = trim($_GPC['op']);
if (!in_array($op, array('delete', 'import', 'update'))) {
    message('无效的功能调用!', url('project/display/'));
}
if (!$_W['isfounder']) {
    message('非管理员,无权限操作!', url('project/display/'));
}
$guid = getInputGUID($_GPC['guid']);
if (empty($guid)) {
    message('请填写有效项目GUID!', url('project/display/'));
}
$project = db_getProject($guid, true, false);
if ($op == 'delete') {
    if (!empty($project)) {
        if ($project['status'] == 9) {
            biz_deleteProject($project);
            message('项目已删除!', url('project/display/'));
        } else {
            message('项目非关闭状态,禁止删除!', url('project/display/'));
        }
    } else {
        message('无效的参数!', url('project/display/'));
    }
    exit;
}
load()->web('progress');
if ($op == 'import') {
    if (empty($project)) {