Example #1
0
 public function doWebCustomer()
 {
     global $_W, $_GPC;
     $step = 1;
     if (isset($_GPC['step'])) {
         $step = intval($_GPC['step']);
     }
     $id = intval($_GPC['id']);
     $chips = biz_getChips($id);
     if (empty($chips) || $chips['deleted']) {
         message('无效认筹单', $this->createWebUrl('chips'));
     }
     $op = $_GPC['op'];
     if (!in_array($op, array('change', 'add', 'delete'))) {
         message('无效操作', $this->createWebUrl('chips'));
     }
     $url = $this->createWebUrl('customer', array('op' => $op, 'id' => $id));
     if ($op == 'change') {
         $title = '认筹单换名';
     }
     if ($op == 'add') {
         $title = '增加附属权益人';
     }
     if (checksubmit('submit')) {
         if ($step == 1) {
             $user_info = biz_getCustomerByCardId($_GPC['cardid'], $_W['project']['projguid']);
             if (empty($user_info)) {
                 $user_info = $_GPC['user'];
                 $user_info['CardID'] = $_GPC['cardid'];
                 $user_info['Country'] = '中国';
                 $user_info['Gender'] = '男';
             }
             $step = 2;
         } else {
             if ($step == 2) {
                 $user_info = $_GPC['user'];
                 $customer = biz_getCustomerByCardId($user_info['CardID'], $_W['project']['projguid']);
                 if ($op == 'change') {
                     if (empty($customer)) {
                         $customer = $user_info;
                         biz_saveCustomer($customer, $_W['project']);
                     }
                     // 插入的数据
                     $data = array('cname' => $user_info['CstName'], 'cardid' => $user_info['CardID'], 'mobile' => $user_info['MobileTel'], 'grender' => $user_info['Gender']);
                     $data['cid'] = $customer['CstGUID'];
                     pdo_update('chips', $data, array('id' => $id));
                     message('认筹单换名成功!', $this->createWebUrl('chips'));
                 }
                 if ($op == 'add') {
                     if (empty($customer)) {
                         $customer = $user_info;
                         biz_saveCustomer($customer, $_W['project']);
                     }
                     $result = biz_saveHolder($chips, $customer);
                     if ($result['result']) {
                         message('数据增加成功!', $this->createWebUrl('chips', array('id' => $id)));
                     } else {
                         message('数据保存出错:' . $result['msg'], $this->createWebUrl('customer', array('op' => 'add', 'id' => $id)), 'error');
                     }
                 }
             }
         }
     }
     if ($step == 2) {
         $cardTypes = biz_getDictionary('CardType');
         $khTypes = biz_getDictionary('kehuType');
     }
     include $this->template('chips_change');
 }
Example #2
0
    $sql = "SELECT * FROM " . tablename('chips') . " WHERE {$condition} ORDER BY `printdate` DESC,`createtime` DESC  LIMIT {$start}, {$psize}";
    $pager = pagination($total, $pindex, $psize);
    $list = pdo_fetchall($sql, $pars);
    include $this->template('chips_list');
    exit;
}
if ($op == 'add') {
    $this->CheckRight('add');
    $step = 1;
    if (isset($_GPC['step'])) {
        $step = intval($_GPC['step']);
    }
    if (checksubmit('submit')) {
        if ($step == 1) {
            //检查用户信息是否存在
            $user_info = biz_getCustomerByCardId($_GPC['cardid'], $_W['project']['projguid']);
            if (empty($user_info)) {
                $user_info = $_GPC['user'];
                $user_info['CardID'] = $_GPC['cardid'];
                $user_info['Country'] = '中国';
                $user_info['Gender'] = '男';
            }
            $cardid = $_GPC['cardid'];
            $step = 2;
        } else {
            if ($step == 2) {
                $user_info = $_GPC['user'];
                $input_save = base64_encode(iserializer($user_info));
                $step = 3;
            } else {
                if ($step == 3) {