⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shopex47.php

📁 本次新版本发布是在ECshop与ShopEx整合后的首次产品升级
💻 PHP
📖 第 1 页 / 共 3 页
字号:
            $address['address_id']      = $row['receiveid'];
            $address['address_name']    = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name']));
            $address['user_id']         = $row['memberid'];
            $address['consignee']       = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name']));
            $address['email']           = $row['email'];
            $address['address']         = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['address']));
            $address['zipcode']         = $row['zipcode'];
            $address['tel']             = $row['telphone'];
            $address['mobile']          = $row['mobile'];

            if (!$db->autoExecute($ecs->table('user_address'), $address, 'INSERT', '', 'SILENT'))
            {
                //return $db->error();
            }
        }

        /* 会员价格 */
        $temp_arr = array();
        $sql = "SELECT * FROM ".$this->sprefix."mall_member_price";
        $res = $this->sdb->query($sql);
        while ($row = $this->sdb->fetchRow($res))
        {
            if ($row['gid'] > 0 && $row['levelid'] > 0 && !isset($temp_arr[$row['gid']][$row['levelid']]))
            {
                $temp_arr[$row['gid']][$row['levelid']] = true;

                $member_price = array();
                $member_price['goods_id']   = $row['gid'];
                $member_price['user_rank']  = $row['levelid'];
                $member_price['user_price'] = $row['price'];

                if (!$db->autoExecute($ecs->table('member_price'), $member_price, 'INSERT', '', 'SILENT'))
                {
                    //return $db->error();
                }
            }
        }
        unset($temp_arr);

        /* 帐户明细 */
        $sql = "SELECT * FROM ".$this->sprefix."mall_member_advance";
        $res = $this->sdb->query($sql);
        while ($row = $this->sdb->fetchRow($res))
        {
            $user_account = array();
            $user_account['user_id']        = $row['memberid'];
            $user_account['admin_user']     = $row['doman'];
            $user_account['amount']         = $row['money'];
            $user_account['add_time']       = $row['date'];
            $user_account['paid_time']      = $row['date'];
            $user_account['admin_note']     = $row['description'];
            $user_account['process_type']   = $row['money'] >= 0 ? SURPLUS_SAVE : SURPLUS_RETURN;
            $user_account['is_paid']        = '1';

            if (!$db->autoExecute($ecs->table('user_account'), $user_account, 'INSERT', '', 'SILENT'))
            {
                //return $db->error();
            }
        }

        /* 返回 */
        return TRUE;
    }

    /**
     * 文章
     */
    function process_article()
    {
        global $db, $ecs;

        /* 清空文章类型、文章、友情链接 */
        truncate_table('article_cat');
        truncate_table('article');
        truncate_table('friend_link');

        /* 文章类型 */
        $sql = "SELECT * FROM ".$this->sprefix."mall_offer_ncat";
        $res = $this->sdb->query($sql);
        while ($row = $this->sdb->fetchRow($res))
        {
            $cat = array();
            $cat['cat_id']      = $row['catid'];
            $cat['cat_name']    = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['cat']));
            $cat['cat_type']    = '1';
            $cat['sort_order']  = $row['pid'];
            $cat['is_open']     = '1';

            if (!$db->autoExecute($ecs->table('article_cat'), $cat, 'INSERT', '', 'SILENT'))
            {
                //return $db->error();
            }
        }

        /* 文章 */
        $sql = "SELECT * FROM ".$this->sprefix."mall_offer_ncon";
        $res = $this->sdb->query($sql);
        while ($row = $this->sdb->fetchRow($res))
        {
            $article = array();
            $article['article_id']  = $row['newsid'];
            $article['cat_id']      = $row['catid'];
            $article['title']       = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['title']));
            $article['content']     = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['con']));
            $article['content']     = str_replace('pictures/newsimg/', 'images/upload/Image/', $article['content']);
            $article['article_type']= '0';
            $article['is_open']     = $row['ifpub'];
            $article['add_time']    = $row['uptime'];

            if (!$db->autoExecute($ecs->table('article'), $article, 'INSERT', '', 'SILENT'))
            {
                //return $db->error();
            }
        }

        /* 友情链接 */
        $sql = "SELECT * FROM ".$this->sprefix."mall_offer_link";
        $res = $this->sdb->query($sql);
        while ($row = $this->sdb->fetchRow($res))
        {
            $link = array();
            $link['link_id']     = $row['linkid'];
            $link['link_name']   = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['linktitle']));
            $link['link_url']    = $row['linkurl'];
            $link['show_order']  = '0';

            if ($row['linktype'] == 'image')
            {
                $link['link_logo']   = 'data/afficheimg/'.$row['imgurl'];
            }

            if (!$db->autoExecute($ecs->table('friend_link'), $link, 'INSERT', '', 'SILENT'))
            {
                //return $db->error();
            }
        }

        /* 返回 */
        return TRUE;
    }

    /**
     * 订单
     */
    function process_order()
    {
        global $db, $ecs;

        /* 清空订单、订单商品 */
        truncate_table('order_info');
        truncate_table('order_goods');
        truncate_table('order_action');

        /* 订单 */
        $sql = "SELECT o.*, t.tmethod, p.payment FROM ".$this->sprefix."mall_orders AS o " .
                "LEFT JOIN ".$this->sprefix."mall_offer_t AS t ON o.ttype = t.id " .
                "LEFT JOIN ".$this->sprefix."mall_offer_p AS p ON o.ptype = p.id";
        $res = $this->sdb->query($sql);
        while ($row = $this->sdb->fetchRow($res))
        {
            $order = array();
            $order['order_sn']          = $row['orderid'];
            $order['user_id']           = $row['userid'];
            $order['add_time']          = $row['ordertime'];
            $order['consignee']         = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name']));
            $order['address']           = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['addr']));
            $order['zipcode']           = $row['zip'];
            $order['tel']               = $row['tel'];
            $order['mobile']            = $row['mobile'];
            $order['email']             = $row['email'];
            $order['postscript']        = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo']));
            $order['shipping_name']     = is_null($row['tmethod']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tmethod']));
            $order['pay_name']          = is_null($row['payment']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['payment']));
            $order['inv_payee']         = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['invoiceform']));
            $order['goods_amount']      = $row['item_amount'];
            $order['shipping_fee']      = $row['freight'];
            $order['order_amount']      = $row['total_amount'];
            $order['pay_time']          = $row['paytime'];
            $order['shipping_time']     = $row['sendtime'];

            /* 状态 */
            if ($row['ordstate'] == '0')
            {
                $order['order_status']      = OS_UNCONFIRMED;
                $order['shipping_status']   = SS_UNSHIPPED;
            }
            elseif ($row['ordstate'] == '1')
            {
                $order['order_status']      = OS_CONFIRMED;
                $order['shipping_status']   = SS_UNSHIPPED;
            }
            elseif ($row['ordstate'] == '9')
            {
                $order['order_status']      = OS_INVALID;
                $order['shipping_status']   = SS_UNSHIPPED;
            }
            else // 3 发货 4 归档
            {
                $order['order_status']      = OS_CONFIRMED;
                $order['shipping_status']   = SS_SHIPPED;
            }

            if ($row['ifsk'] == '1')
            {
                $order['pay_status']        = PS_PAYED;
            }
            else // 0 未付款 5 退款
            {
                $order['pay_status']        = PS_UNPAYED;
            }

            if ($row['userrecsts'] == '1') // 用户操作了
            {
                if ($row['recsts'] == '1') // 到货
                {
                    if ($order['shipping_status'] == SS_SHIPPED)
                    {
                        $order['shipping_status'] = SS_RECEIVED;
                    }
                }
                elseif ($row['recsts'] == '2') // 取消
                {
                    $order['order_status']      = OS_CANCELED;
                    $order['pay_status']        = PS_UNPAYED;
                    $order['shipping_status']   = SS_UNSHIPPED;
                }
            }

            /* 如果已付款,修改已付款金额为订单总金额,修改订单总金额为0 */
            if ($order['pay_status'] > PS_UNPAYED)
            {
                $order['money_paid']    = $order['order_amount'];
                $order['order_amount']  = 0;
            }

            if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT'))
            {
                //return $db->error();
            }

            /* 订单商品 */
            $order_id = $db->insert_id();
            $sql = "SELECT i.*, g.priceintro FROM ".$this->sprefix."mall_items AS i " .
                    "LEFT JOIN ".$this->sprefix."mall_goods AS g ON i.gid = g.gid " .
                    "WHERE orderid = '$row[orderid]'";
            $res1 = $this->sdb->query($sql);
            while ($row = $this->sdb->fetchRow($res1))
            {
                $goods = array();
                $goods['order_id']      = $order_id;
                $goods['goods_id']      = $row['gid'];
                $goods['goods_name']    = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['goods']));
                $goods['goods_sn']      = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['bn']));
                $goods['goods_number']  = $row['nums'];
                $goods['goods_price']   = $row['price'];
                $goods['market_price']  = is_null($row['priceintro']) ? $row['goods_price'] : $row['priceintro'];
                $goods['is_real']       = 1;
                $goods['parent_id']     = 0;
                $goods['is_gift']       = 0;

                if (!$db->autoExecute($ecs->table('order_goods'), $goods, 'INSERT', '', 'SILENT'))
                {
                    //return $db->error();
                }
            }
        }

        /* 返回 */
        return TRUE;
    }

    /**
     * 商店设置
     */
    function process_config()
    {
        global $ecs, $db;

        /* 查询设置 */
        $sql = "SELECT * FROM ".$this->sprefix."mall_offer " .
                "WHERE offerid = '1'";
        $row = $this->sdb->getRow($sql);

        $config = array();
        $config['shop_name']        = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_name']));
        $config['shop_title']       = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_shoptitle']));
        $config['shop_desc']        = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_metadesc']));
        $config['shop_address']     = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_addr']));
        $config['service_email']    = $row['offer_email'];
        $config['service_phone']    = $row['offer_tel'];
        $config['icp_number']       = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_certtext']));
        //$config['integral_scale']   = $row['offer_pointtype'] == '0' ? '0' : $row['offer_pointnum'] * 100;
        $config['thumb_width']      = $row['offer_smallsize_w'];
        $config['thumb_height']     = $row['offer_smallsize_h'];
        $config['image_width']      = $row['offer_bigsize_w'];
        $config['image_height']     = $row['offer_bigsize_h'];
        $config['promote_number']   = $row['offer_tejianums'];
        $config['best_number']      = $row['offer_tjnums'];
        $config['new_number']       = $row['offer_newgoodsnums'];
        $config['hot_number']       = $row['offer_hotnums'];
        $config['smtp_host']        = $row['offer_smtp_server'];
        $config['smtp_port']        = $row['offer_smtp_port'];
        $config['smtp_user']        = $row['offer_smtp_user'];
        $config['smtp_pass']        = $row['offer_smtp_password'];
        $config['smtp_mail']        = $row['offer_smtp_email'];

        /* 更新 */
        foreach ($config as $code => $value)
        {
            $sql = "UPDATE " . $ecs->table('shop_config') . " SET " .
                    "value = '$value' " .
                    "WHERE code = '$code' LIMIT 1";
            if (!$db->query($sql, 'SILENT'))
            {
                //return $db->error();
            }
        }

        /* 返回 */
        return TRUE;
    }

}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -