New file |
| | |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'order_id' => '185', |
| | | 'order_sn' => '2015071644576', |
| | | 'user_id' => '49', |
| | | 'order_status' => '未确认', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => '1234567', |
| | | 'country' => '1', |
| | | 'province' => '18', |
| | | 'city' => '256', |
| | | 'district' => '2149', |
| | | 'address' => '2121', |
| | | 'zipcode' => '121212', |
| | | 'tel' => '', |
| | | 'mobile' => '18729201736', |
| | | 'email' => '45672@qq.com', |
| | | 'best_time' => '仅工作日送货', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '1', |
| | | 'shipping_name' => '申通快递', |
| | | 'pay_id' => '2', |
| | | 'pay_name' => '支付宝', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '', |
| | | 'goods_amount' => '69.00', |
| | | 'shipping_fee' => '15.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '84.00', |
| | | 'from_ad' => '0', |
| | | 'referer' => '家装DIY', |
| | | 'add_time' => '2015-07-16 16:31:36', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '0.00', |
| | | 'supplier_id' => '12', |
| | | 'parent_order_id' => '183', |
| | | 'rebate_id' => '12', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'pc', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => NULL, |
| | | 'vat_inv_taxpayer_id' => NULL, |
| | | 'vat_inv_registration_address' => NULL, |
| | | 'vat_inv_registration_phone' => NULL, |
| | | 'vat_inv_deposit_bank' => NULL, |
| | | 'vat_inv_bank_account' => NULL, |
| | | 'inv_consignee_name' => NULL, |
| | | 'inv_consignee_phone' => NULL, |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => NULL, |
| | | 'inv_consignee_city' => NULL, |
| | | 'inv_consignee_district' => NULL, |
| | | 'inv_consignee_address' => NULL, |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '84.00', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201412/thumb_img/282_thumb_G_1419211504853.jpg', |
| | | 'rec_id' => '319', |
| | | 'order_id' => '185', |
| | | 'goods_id' => '282', |
| | | 'goods_name' => '高磁力降压保健枕 全棉单人枕头 高磁力降压枕 48*74cm*1', |
| | | 'goods_sn' => 'ECS000282', |
| | | 'product_id' => '0', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '82.80', |
| | | 'goods_price' => '69.00', |
| | | 'goods_attr' => '', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 84, |
| | | ), |
| | | 1 => |
| | | array ( |
| | | 'order_id' => '184', |
| | | 'order_sn' => '2015071632046', |
| | | 'user_id' => '49', |
| | | 'order_status' => '未确认', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => '1234567', |
| | | 'country' => '1', |
| | | 'province' => '18', |
| | | 'city' => '256', |
| | | 'district' => '2149', |
| | | 'address' => '2121', |
| | | 'zipcode' => '121212', |
| | | 'tel' => '', |
| | | 'mobile' => '18729201736', |
| | | 'email' => '45672@qq.com', |
| | | 'best_time' => '仅工作日送货', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '1', |
| | | 'shipping_name' => '申通快递', |
| | | 'pay_id' => '2', |
| | | 'pay_name' => '支付宝', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '', |
| | | 'goods_amount' => '442.00', |
| | | 'shipping_fee' => '15.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '457.00', |
| | | 'from_ad' => '0', |
| | | 'referer' => '科技', |
| | | 'add_time' => '2015-07-16 16:31:36', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '0.00', |
| | | 'supplier_id' => '3', |
| | | 'parent_order_id' => '183', |
| | | 'rebate_id' => '13', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'pc', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => NULL, |
| | | 'vat_inv_taxpayer_id' => NULL, |
| | | 'vat_inv_registration_address' => NULL, |
| | | 'vat_inv_registration_phone' => NULL, |
| | | 'vat_inv_deposit_bank' => NULL, |
| | | 'vat_inv_bank_account' => NULL, |
| | | 'inv_consignee_name' => NULL, |
| | | 'inv_consignee_phone' => NULL, |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => NULL, |
| | | 'inv_consignee_city' => NULL, |
| | | 'inv_consignee_district' => NULL, |
| | | 'inv_consignee_address' => NULL, |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '457.00', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201409/thumb_img/142_thumb_G_1411028051203.png', |
| | | 'rec_id' => '318', |
| | | 'order_id' => '184', |
| | | 'goods_id' => '142', |
| | | 'goods_name' => 'sdeer圣迪奥2014女秋装唯美气质设计师长袖全棉衬衫衬衣4180597', |
| | | 'goods_sn' => 'ECS000142', |
| | | 'product_id' => '429', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '530.40', |
| | | 'goods_price' => '442.00', |
| | | 'goods_attr' => '颜色:黑色 |
| | | ', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '498', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 457, |
| | | ), |
| | | 2 => |
| | | array ( |
| | | 'order_id' => '175', |
| | | 'order_sn' => '2015070854912', |
| | | 'user_id' => '49', |
| | | 'order_status' => '未确认', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => '1234567', |
| | | 'country' => '1', |
| | | 'province' => '18', |
| | | 'city' => '256', |
| | | 'district' => '2149', |
| | | 'address' => '2121', |
| | | 'zipcode' => '', |
| | | 'tel' => '', |
| | | 'mobile' => '', |
| | | 'email' => '45672@qq.com', |
| | | 'best_time' => '', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '3', |
| | | 'shipping_name' => '圆通速递', |
| | | 'pay_id' => '2', |
| | | 'pay_name' => '支付宝', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '0', |
| | | 'goods_amount' => '930.00', |
| | | 'shipping_fee' => '5.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '682.50', |
| | | 'from_ad' => '0', |
| | | 'referer' => '网站自营', |
| | | 'add_time' => '2015-07-08 16:33:04', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '252.50', |
| | | 'supplier_id' => '0', |
| | | 'parent_order_id' => '0', |
| | | 'rebate_id' => '0', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'app', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => '', |
| | | 'vat_inv_taxpayer_id' => '', |
| | | 'vat_inv_registration_address' => '', |
| | | 'vat_inv_registration_phone' => '', |
| | | 'vat_inv_deposit_bank' => '', |
| | | 'vat_inv_bank_account' => '', |
| | | 'inv_consignee_name' => '', |
| | | 'inv_consignee_phone' => '', |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => '0', |
| | | 'inv_consignee_city' => '0', |
| | | 'inv_consignee_district' => '0', |
| | | 'inv_consignee_address' => '', |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '682.50', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201409/thumb_img/44_thumb_G_1410946700203.jpg', |
| | | 'rec_id' => '309', |
| | | 'order_id' => '175', |
| | | 'goods_id' => '44', |
| | | 'goods_name' => '【一山半海】PEKOE精选 叶怡兰推荐 台湾文山包种茶 冷泡送女友', |
| | | 'goods_sn' => 'ECS000044', |
| | | 'product_id' => '0', |
| | | 'goods_number' => '12', |
| | | 'market_price' => '90.00', |
| | | 'goods_price' => '75.00', |
| | | 'goods_attr' => '', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | 1 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201409/thumb_img/41_thumb_G_1410947758862.jpg', |
| | | 'rec_id' => '310', |
| | | 'order_id' => '175', |
| | | 'goods_id' => '41', |
| | | 'goods_name' => '【果匠】纯手工自制芒果酱 果肉果粒果酱 烘焙蛋糕搭酸奶面包包邮', |
| | | 'goods_sn' => 'ECS000041', |
| | | 'product_id' => '0', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '36.00', |
| | | 'goods_price' => '30.00', |
| | | 'goods_attr' => '', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 682.5, |
| | | ), |
| | | 3 => |
| | | array ( |
| | | 'order_id' => '170', |
| | | 'order_sn' => '2015070851000', |
| | | 'user_id' => '49', |
| | | 'order_status' => '未确认', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => '1234567', |
| | | 'country' => '1', |
| | | 'province' => '18', |
| | | 'city' => '256', |
| | | 'district' => '2149', |
| | | 'address' => '2121', |
| | | 'zipcode' => '121212', |
| | | 'tel' => '', |
| | | 'mobile' => '18729201736', |
| | | 'email' => '45672@qq.com', |
| | | 'best_time' => '', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '3', |
| | | 'shipping_name' => '圆通速递', |
| | | 'pay_id' => '2', |
| | | 'pay_name' => '支付宝', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '0', |
| | | 'goods_amount' => '43.90', |
| | | 'shipping_fee' => '5.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '48.90', |
| | | 'from_ad' => '0', |
| | | 'referer' => '网站自营', |
| | | 'add_time' => '2015-07-08 09:42:28', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '0.00', |
| | | 'supplier_id' => '0', |
| | | 'parent_order_id' => '0', |
| | | 'rebate_id' => '0', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'app', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => '', |
| | | 'vat_inv_taxpayer_id' => '', |
| | | 'vat_inv_registration_address' => '', |
| | | 'vat_inv_registration_phone' => '', |
| | | 'vat_inv_deposit_bank' => '', |
| | | 'vat_inv_bank_account' => '', |
| | | 'inv_consignee_name' => '', |
| | | 'inv_consignee_phone' => '', |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => '0', |
| | | 'inv_consignee_city' => '0', |
| | | 'inv_consignee_district' => '0', |
| | | 'inv_consignee_address' => '', |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '48.90', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201507/thumb_img/314_thumb_G_1436136329249.jpg', |
| | | 'rec_id' => '304', |
| | | 'order_id' => '170', |
| | | 'goods_id' => '314', |
| | | 'goods_name' => '海飞丝去屑洗发露丝质顺滑型400ml', |
| | | 'goods_sn' => 'ECS000314', |
| | | 'product_id' => '0', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '52.68', |
| | | 'goods_price' => '43.90', |
| | | 'goods_attr' => '', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 48.9, |
| | | ), |
| | | 4 => |
| | | array ( |
| | | 'order_id' => '169', |
| | | 'order_sn' => '2015070734965', |
| | | 'user_id' => '49', |
| | | 'order_status' => '未确认', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => '`12345', |
| | | 'country' => '1', |
| | | 'province' => '16', |
| | | 'city' => '229', |
| | | 'district' => '1923', |
| | | 'address' => '1234', |
| | | 'zipcode' => '345678', |
| | | 'tel' => '', |
| | | 'mobile' => '18723441985', |
| | | 'email' => '45678@qq.com', |
| | | 'best_time' => '', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '1', |
| | | 'shipping_name' => '申通快递', |
| | | 'pay_id' => '2', |
| | | 'pay_name' => '支付宝', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '0', |
| | | 'goods_amount' => '299.00', |
| | | 'shipping_fee' => '15.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '314.00', |
| | | 'from_ad' => '0', |
| | | 'referer' => '网站自营', |
| | | 'add_time' => '2015-07-07 15:01:33', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '0.00', |
| | | 'supplier_id' => '0', |
| | | 'parent_order_id' => '0', |
| | | 'rebate_id' => '0', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'app', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => '', |
| | | 'vat_inv_taxpayer_id' => '', |
| | | 'vat_inv_registration_address' => '', |
| | | 'vat_inv_registration_phone' => '', |
| | | 'vat_inv_deposit_bank' => '', |
| | | 'vat_inv_bank_account' => '', |
| | | 'inv_consignee_name' => '', |
| | | 'inv_consignee_phone' => '', |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => '0', |
| | | 'inv_consignee_city' => '0', |
| | | 'inv_consignee_district' => '0', |
| | | 'inv_consignee_address' => '', |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '314.00', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201409/thumb_img/111_thumb_G_1411004660479.jpg', |
| | | 'rec_id' => '303', |
| | | 'order_id' => '169', |
| | | 'goods_id' => '111', |
| | | 'goods_name' => '[希夏邦马]hello BUGS系列单肩包', |
| | | 'goods_sn' => 'ECS000111', |
| | | 'product_id' => '0', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '414.00', |
| | | 'goods_price' => '299.00', |
| | | 'goods_attr' => '', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 314, |
| | | ), |
| | | 5 => |
| | | array ( |
| | | 'order_id' => '168', |
| | | 'order_sn' => '2015070711060', |
| | | 'user_id' => '49', |
| | | 'order_status' => '未确认', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => '`12345', |
| | | 'country' => '1', |
| | | 'province' => '16', |
| | | 'city' => '229', |
| | | 'district' => '1923', |
| | | 'address' => '1234', |
| | | 'zipcode' => '345678', |
| | | 'tel' => '', |
| | | 'mobile' => '18723441985', |
| | | 'email' => '45678@qq.com', |
| | | 'best_time' => '仅工作日送货', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '1', |
| | | 'shipping_name' => '申通快递', |
| | | 'pay_id' => '4', |
| | | 'pay_name' => '支付宝-网银直连', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '', |
| | | 'goods_amount' => '299.00', |
| | | 'shipping_fee' => '15.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '314.00', |
| | | 'from_ad' => '0', |
| | | 'referer' => '网站自营', |
| | | 'add_time' => '2015-07-07 15:00:26', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '0.00', |
| | | 'supplier_id' => '0', |
| | | 'parent_order_id' => '0', |
| | | 'rebate_id' => '0', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'pc', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => NULL, |
| | | 'vat_inv_taxpayer_id' => NULL, |
| | | 'vat_inv_registration_address' => NULL, |
| | | 'vat_inv_registration_phone' => NULL, |
| | | 'vat_inv_deposit_bank' => NULL, |
| | | 'vat_inv_bank_account' => NULL, |
| | | 'inv_consignee_name' => NULL, |
| | | 'inv_consignee_phone' => NULL, |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => NULL, |
| | | 'inv_consignee_city' => NULL, |
| | | 'inv_consignee_district' => NULL, |
| | | 'inv_consignee_address' => NULL, |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '314.00', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201409/thumb_img/111_thumb_G_1411004660479.jpg', |
| | | 'rec_id' => '302', |
| | | 'order_id' => '168', |
| | | 'goods_id' => '111', |
| | | 'goods_name' => '[希夏邦马]hello BUGS系列单肩包', |
| | | 'goods_sn' => 'ECS000111', |
| | | 'product_id' => '454', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '414.00', |
| | | 'goods_price' => '299.00', |
| | | 'goods_attr' => '颜色:粉色 |
| | | 尺寸:12 |
| | | ', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '404,513', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 314, |
| | | ), |
| | | 6 => |
| | | array ( |
| | | 'order_id' => '167', |
| | | 'order_sn' => '2015070727456', |
| | | 'user_id' => '49', |
| | | 'order_status' => '未确认', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => '`12345', |
| | | 'country' => '1', |
| | | 'province' => '16', |
| | | 'city' => '229', |
| | | 'district' => '1923', |
| | | 'address' => '1234', |
| | | 'zipcode' => '345678', |
| | | 'tel' => '', |
| | | 'mobile' => '18723441985', |
| | | 'email' => '45678@qq.com', |
| | | 'best_time' => '', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '1', |
| | | 'shipping_name' => '申通快递', |
| | | 'pay_id' => '2', |
| | | 'pay_name' => '支付宝', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '0', |
| | | 'goods_amount' => '299.00', |
| | | 'shipping_fee' => '15.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '314.00', |
| | | 'from_ad' => '0', |
| | | 'referer' => '网站自营', |
| | | 'add_time' => '2015-07-07 14:53:07', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '0.00', |
| | | 'supplier_id' => '0', |
| | | 'parent_order_id' => '0', |
| | | 'rebate_id' => '0', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'app', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => '', |
| | | 'vat_inv_taxpayer_id' => '', |
| | | 'vat_inv_registration_address' => '', |
| | | 'vat_inv_registration_phone' => '', |
| | | 'vat_inv_deposit_bank' => '', |
| | | 'vat_inv_bank_account' => '', |
| | | 'inv_consignee_name' => '', |
| | | 'inv_consignee_phone' => '', |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => '0', |
| | | 'inv_consignee_city' => '0', |
| | | 'inv_consignee_district' => '0', |
| | | 'inv_consignee_address' => '', |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '314.00', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201409/thumb_img/111_thumb_G_1411004660479.jpg', |
| | | 'rec_id' => '301', |
| | | 'order_id' => '167', |
| | | 'goods_id' => '111', |
| | | 'goods_name' => '[希夏邦马]hello BUGS系列单肩包', |
| | | 'goods_sn' => 'ECS000111', |
| | | 'product_id' => '0', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '414.00', |
| | | 'goods_price' => '299.00', |
| | | 'goods_attr' => '', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 314, |
| | | ), |
| | | 7 => |
| | | array ( |
| | | 'order_id' => '164', |
| | | 'order_sn' => '2015070422193', |
| | | 'user_id' => '49', |
| | | 'order_status' => '已取消', |
| | | 'shipping_status' => '未发货', |
| | | 'pay_status' => '未付款', |
| | | 'consignee' => 'hhh', |
| | | 'country' => '1', |
| | | 'province' => '14', |
| | | 'city' => '206', |
| | | 'district' => '1729', |
| | | 'address' => 'ttt', |
| | | 'zipcode' => '2423423', |
| | | 'tel' => '5555555', |
| | | 'mobile' => '111111', |
| | | 'email' => 'hhh@hh.com', |
| | | 'best_time' => '', |
| | | 'sign_building' => '', |
| | | 'postscript' => '', |
| | | 'shipping_id' => '1', |
| | | 'shipping_name' => '申通快递', |
| | | 'pay_id' => '2', |
| | | 'pay_name' => '支付宝', |
| | | 'how_oos' => '等待所有商品备齐后再发', |
| | | 'how_surplus' => '', |
| | | 'pack_name' => '', |
| | | 'card_name' => '', |
| | | 'card_message' => '', |
| | | 'inv_payee' => '', |
| | | 'inv_content' => '0', |
| | | 'goods_amount' => '299.00', |
| | | 'shipping_fee' => '15.00', |
| | | 'insure_fee' => '0.00', |
| | | 'pay_fee' => '0.00', |
| | | 'pack_fee' => '0.00', |
| | | 'card_fee' => '0.00', |
| | | 'money_paid' => '0.00', |
| | | 'surplus' => '0.00', |
| | | 'integral' => '0', |
| | | 'integral_money' => '0.00', |
| | | 'bonus' => '0.00', |
| | | 'order_amount' => '314.00', |
| | | 'from_ad' => '0', |
| | | 'referer' => '网站自营', |
| | | 'add_time' => '2015-07-04 14:25:18', |
| | | 'confirm_time' => '0', |
| | | 'pay_time' => '0', |
| | | 'shipping_time' => '0', |
| | | 'pack_id' => '0', |
| | | 'card_id' => '0', |
| | | 'bonus_id' => '0', |
| | | 'invoice_no' => '', |
| | | 'extension_code' => '', |
| | | 'extension_id' => '0', |
| | | 'to_buyer' => '', |
| | | 'pay_note' => '', |
| | | 'agency_id' => '0', |
| | | 'inv_type' => '', |
| | | 'tax' => '0.00', |
| | | 'is_separate' => '0', |
| | | 'parent_id' => '0', |
| | | 'discount' => '0.00', |
| | | 'supplier_id' => '0', |
| | | 'parent_order_id' => '0', |
| | | 'rebate_id' => '0', |
| | | 'rebate_ispay' => '1', |
| | | 'tb_nick' => '', |
| | | 'froms' => 'app', |
| | | 'is_pickup' => '0', |
| | | 'pickup_point' => '0', |
| | | 'vat_inv_company_name' => '', |
| | | 'vat_inv_taxpayer_id' => '', |
| | | 'vat_inv_registration_address' => '', |
| | | 'vat_inv_registration_phone' => '', |
| | | 'vat_inv_deposit_bank' => '', |
| | | 'vat_inv_bank_account' => '', |
| | | 'inv_consignee_name' => '', |
| | | 'inv_consignee_phone' => '', |
| | | 'inv_consignee_country' => '1', |
| | | 'inv_consignee_province' => '0', |
| | | 'inv_consignee_city' => '0', |
| | | 'inv_consignee_district' => '0', |
| | | 'inv_consignee_address' => '', |
| | | 'inv_status' => 'unprovided ', |
| | | 'inv_remark' => NULL, |
| | | 'inv_money' => '314.00', |
| | | 'inv_payee_type' => NULL, |
| | | 'xiang' => |
| | | array ( |
| | | 0 => |
| | | array ( |
| | | 'goods_thumb' => 'images/201409/thumb_img/111_thumb_G_1411004660479.jpg', |
| | | 'rec_id' => '298', |
| | | 'order_id' => '164', |
| | | 'goods_id' => '111', |
| | | 'goods_name' => '[希夏邦马]hello BUGS系列单肩包', |
| | | 'goods_sn' => 'ECS000111', |
| | | 'product_id' => '0', |
| | | 'goods_number' => '1', |
| | | 'market_price' => '414.00', |
| | | 'goods_price' => '299.00', |
| | | 'goods_attr' => '', |
| | | 'send_number' => '0', |
| | | 'is_real' => '1', |
| | | 'extension_code' => '', |
| | | 'parent_id' => '0', |
| | | 'is_gift' => '0', |
| | | 'goods_attr_id' => '', |
| | | 'comment_state' => '0', |
| | | 'shaidan_state' => '0', |
| | | 'package_attr_id' => '', |
| | | 'exclusive' => '-1', |
| | | ), |
| | | ), |
| | | 'count_amount' => 314, |
| | | ), |
| | | ) |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 我的收藏 |
| | | */ |
| | | require('includes/safety_mysql.php'); |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| | | $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $add_time=time(); |
| | | $result=array(); |
| | | $sql="SELECT * |
| | | FROM ".$ecs->table('collect_goods')." WHERE user_id='$uid' and goods_id='$id'"; |
| | | |
| | | $isCollect=$db ->getRow($sql); |
| | | if(!empty($isCollect)){ |
| | | $result['code']=1; |
| | | $result['info']="该商品已经在你的收藏夹"; |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | } |
| | | |
| | | $sql="INSERT INTO ".$ecs->table('collect_goods')." ( |
| | | `rec_id` , |
| | | `user_id` , |
| | | `goods_id` , |
| | | `add_time` , |
| | | `is_attention` |
| | | ) |
| | | VALUES ( |
| | | NULL , '$uid', '$id', '$add_time', '0' |
| | | );"; |
| | | $res = $db -> query($sql); |
| | | if($res){ |
| | | $result['code']=1; |
| | | $result['info']="收藏成功!"; |
| | | print_r(json_encode($result)); |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="收藏失败!"; |
| | | print_r(json_encode($result)); |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 我的收藏 |
| | | */ |
| | | require('includes/safety_mysql.php'); |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| | | $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $add_time=time(); |
| | | $result=array(); |
| | | $sql="SELECT * |
| | | FROM ".$ecs->table('collect_goods')." WHERE user_id='$uid' and goods_id='$id'"; |
| | | |
| | | $isCollect=$db ->getRow($sql); |
| | | |
| | | if(!empty($isCollect)){ |
| | | $sql="DELETE FROM ".$ecs->table('collect_goods')." WHERE user_id='$uid' AND goods_id='$id' "; |
| | | $res=$db -> query($sql); |
| | | if($res) |
| | | { |
| | | $result['code']=1; |
| | | $result['info']="取消收藏成功!"; |
| | | }else |
| | | { |
| | | $result['code']=1; |
| | | $result['info']="取消收藏失败!"; |
| | | } |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | } |
| | | |
| | | $sql="INSERT INTO ".$ecs->table('collect_goods')." ( |
| | | `rec_id` , |
| | | `user_id` , |
| | | `goods_id` , |
| | | `add_time` , |
| | | `is_attention` |
| | | ) |
| | | VALUES ( |
| | | NULL , '$uid', '$id', '$add_time', '0' |
| | | );"; |
| | | $res = $db -> query($sql); |
| | | if($res){ |
| | | $result['code']=1; |
| | | $result['info']="收藏成功!"; |
| | | print_r(json_encode($result)); |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="收藏失败!"; |
| | | print_r(json_encode($result)); |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | /** |
| | | * 我的账号资金 |
| | | */ |
| | | ob_start(); |
| | | define('IN_ECS', true); |
| | | define('INIT_NO_SMARTY', true); |
| | | |
| | | require('../includes/init.php'); |
| | | require('../includes/lib_clips.php'); |
| | | $result=array(); |
| | | $user_id = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $page = isset($_REQUEST['page']) ? intval($_REQUEST['page']) : 0; |
| | | //获取剩余余额 |
| | | |
| | | $sql = "SELECT user_money FROM " .$ecs->table('users'). |
| | | " WHERE user_id = '$user_id'"; |
| | | |
| | | $surplus_amount = $db->getOne($sql); |
| | | if(empty($surplus_amount)){ |
| | | $surplus_amount="0.00"; |
| | | |
| | | } |
| | | $result['surplus_amount']=$surplus_amount; |
| | | |
| | | //获取余额记录 |
| | | $account_log = array(); |
| | | $account_type = 'user_money'; |
| | | $sql = "SELECT * FROM " . $ecs->table('account_log') . |
| | | " WHERE user_id = '$user_id'" . |
| | | " AND $account_type <> 0 " . |
| | | " ORDER BY log_id DESC"; |
| | | $res = $GLOBALS['db']->selectLimit($sql, 10, 10*$page); |
| | | while ($row = $db->fetchRow($res)) |
| | | { |
| | | $row['change_time'] = local_date($_CFG['date_format'], $row['change_time']); |
| | | $row['type'] = $row[$account_type] > 0 ? "增加" : "减少"; |
| | | $row['user_money'] = price_format(abs($row['user_money']), false); |
| | | $row['frozen_money'] = price_format(abs($row['frozen_money']), false); |
| | | $row['rank_points'] = abs($row['rank_points']); |
| | | $row['pay_points'] = abs($row['pay_points']); |
| | | $row['short_change_desc'] = sub_str($row['change_desc'], 60); |
| | | $row['amount'] = $row[$account_type]; |
| | | $account_log[] = $row; |
| | | } |
| | | $result['account_log']=$account_log; |
| | | |
| | | print_r(json_encode($result)); |
| | | ob_end_flush(); |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | |
| | | define('IN_ECS', true); |
| | | |
| | | require('../includes/init.php'); |
| | | require('../includes/lib_order.php'); |
| | | include('../includes/cls_json.php'); |
| | | $json = new JSON; |
| | | /* 载入语言文件 */ |
| | | require_once('../languages/zh_cn/shopping_flow.php'); |
| | | require_once('../languages/zh_cn/user.php'); |
| | | |
| | | $smarty->template_dir = ROOT_PATH . 'json/tpl';//app部分模板所在位置 |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- PROCESSOR |
| | | /*------------------------------------------------------ */ |
| | | |
| | | $result = array('error'=>0,'result'=>''); |
| | | |
| | | $page = (isset($_REQUEST['page'])) ? intval($_REQUEST['page']) : 0; |
| | | $num = 1; |
| | | |
| | | assign_template(); |
| | | assign_dynamic('activity'); |
| | | |
| | | // 数据准备 |
| | | |
| | | /* 取得用户等级 */ |
| | | $user_rank_list = array(); |
| | | $user_rank_list[0] = $_LANG['not_user']; |
| | | $sql = "SELECT rank_id, rank_name FROM " . $ecs->table('user_rank'); |
| | | $res = $db->query($sql); |
| | | while ($row = $db->fetchRow($res)) |
| | | { |
| | | $user_rank_list[$row['rank_id']] = $row['rank_name']; |
| | | } |
| | | |
| | | // 开始工作 |
| | | |
| | | //$sql = "SELECT * FROM " . $ecs->table('favourable_activity'). " ORDER BY `sort_order` ASC,`end_time` DESC"; |
| | | $nowtime = time(); |
| | | $sql = "SELECT fa.* FROM " . $ecs->table('favourable_activity'). " AS fa ". |
| | | "WHERE fa.start_time<=".$nowtime." AND fa.end_time>=".$nowtime. |
| | | " ORDER BY fa.`sort_order` ASC,fa.`end_time` DESC LIMIT ".$page*$num.",".$num; |
| | | $res = $db->query($sql); |
| | | |
| | | $list = array(); |
| | | while ($row = $db->fetchRow($res)) |
| | | { |
| | | $row['start_time'] = local_date('Y-m-d H:i', $row['start_time']); |
| | | $row['end_time'] = local_date('Y-m-d H:i', $row['end_time']); |
| | | |
| | | //享受优惠会员等级 |
| | | $user_rank = explode(',', $row['user_rank']); |
| | | $row['user_rank'] = array(); |
| | | foreach($user_rank as $val) |
| | | { |
| | | if (isset($user_rank_list[$val])) |
| | | { |
| | | $row['user_rank'][] = $user_rank_list[$val]; |
| | | } |
| | | } |
| | | |
| | | //优惠范围类型、内容 |
| | | if ($row['act_range'] != FAR_ALL && !empty($row['act_range_ext'])) |
| | | { |
| | | if ($row['act_range'] == FAR_CATEGORY) |
| | | { |
| | | $row['act_range'] = $_LANG['far_category']; |
| | | $row['program'] = 'category.php?id='; |
| | | $sql = "SELECT cat_id AS id, cat_name AS name FROM " . $ecs->table('category') . |
| | | " WHERE cat_id " . db_create_in($row['act_range_ext']); |
| | | } |
| | | elseif ($row['act_range'] == FAR_BRAND) |
| | | { |
| | | $row['act_range'] = $_LANG['far_brand']; |
| | | $row['program'] = 'brand.php?id='; |
| | | $sql = "SELECT brand_id AS id, brand_name AS name FROM " . $ecs->table('brand') . |
| | | " WHERE brand_id " . db_create_in($row['act_range_ext']); |
| | | } |
| | | else |
| | | { |
| | | $row['act_range'] = $_LANG['far_goods']; |
| | | $row['program'] = 'goods.php?id='; |
| | | $sql = "SELECT goods_id AS id, goods_name AS name FROM " . $ecs->table('goods') . |
| | | " WHERE goods_id " . db_create_in($row['act_range_ext']); |
| | | } |
| | | $act_range_ext = $db->getAll($sql); |
| | | $row['act_range_ext'] = $act_range_ext; |
| | | } |
| | | else |
| | | { |
| | | $row['act_range'] = $_LANG['far_all']; |
| | | } |
| | | |
| | | //优惠方式 |
| | | $row['act_type_num'] = $row['act_type']; |
| | | switch($row['act_type']) |
| | | { |
| | | case 0: |
| | | $row['act_type'] = $_LANG['fat_goods']; |
| | | $row['gift'] = unserialize($row['gift']); |
| | | if(is_array($row['gift'])) |
| | | { |
| | | foreach($row['gift'] as $k=>$v) |
| | | { |
| | | $row['gift'][$k]['thumb'] = get_image_path($v['id'], $db->getOne("SELECT goods_thumb FROM " . $ecs->table('goods') . " WHERE goods_id = '" . $v['id'] . "'"), true); |
| | | } |
| | | } |
| | | break; |
| | | case 1: |
| | | $row['act_type'] = $_LANG['fat_price']; |
| | | $row['act_type_ext'] .= $_LANG['unit_yuan']; |
| | | $row['gift'] = array(); |
| | | break; |
| | | case 2: |
| | | $row['act_type'] = $_LANG['fat_discount']; |
| | | $row['act_type_ext'] .= "%"; |
| | | $row['gift'] = array(); |
| | | break; |
| | | } |
| | | |
| | | if($row['supplier_id'] > 0){ |
| | | $sql = "select code,value from " . $ecs->table('supplier_shop_config'). |
| | | " where supplier_id=".$row['supplier_id']. |
| | | " AND code in('shop_name','shop_logo')"; |
| | | $r = $db->getAll($sql); |
| | | foreach($r as $k=>$v){ |
| | | $row[$v['code']] = $v['value']; |
| | | } |
| | | }else{ |
| | | $row['shop_logo'] = './images/ziying.jpg'; |
| | | } |
| | | |
| | | |
| | | $list[] = $row; |
| | | } |
| | | |
| | | $smarty->assign('list', $list); |
| | | |
| | | $smarty->assign('lang', $_LANG); |
| | | |
| | | $result['result'] = $smarty->fetch('activity_app.lbi'); |
| | | |
| | | die($json->encode($result)); |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 我的红包列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $bonus_sn=$_GET['d']; |
| | | $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $result=array(); |
| | | $sql="SELECT ub.used_time,ub.bonus_sn, ub.user_id |
| | | FROM ".$ecs->table('user_bonus')." AS ub WHERE ub.bonus_sn='$bonus_sn' ;"; |
| | | //print_r($sql); |
| | | $row= $db -> getRow($sql); |
| | | if($row){ |
| | | if($row['user_id']==0){ |
| | | $row = $db -> query("update ".$ecs->table('user_bonus')." set user_id = '$uid' where bonus_sn = '$bonus_sn'"); |
| | | $result['code']=1; |
| | | $result['info']="红包添加成功!"; |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="红包添加失败!该红包系列已经发放过!"; |
| | | } |
| | | |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="红包添加失败!该红包系列不存在!"; |
| | | } |
| | | |
| | | print_r(json_encode($result)); |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 用户地址列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('../includes/init.php'); |
| | | require('../includes/lib_order.php'); |
| | | $result=array(); |
| | | $shipping_list=array(); |
| | | $user=$_POST['uid']; |
| | | $total=$_POST['total']; |
| | | |
| | | /*每100积分可抵多少元现金*/ |
| | | $sql="SELECT value FROM ".$ecs->table('shop_config')." WHERE id='211'"; |
| | | $shop_config=$db ->getRow($sql); |
| | | $shop_config_integral=$shop_config['value']; |
| | | |
| | | $address_id = $db -> getRow("SELECT address_id,user_money,pay_points FROM ".$GLOBALS['ecs']->table('users')." WHERE `user_id`='$user' "); |
| | | $result['user_money']=$address_id['user_money']; |
| | | $result['user_integral']=$address_id['pay_points']; |
| | | $address_id=$address_id['address_id']; |
| | | $address = $db -> getRow("SELECT * FROM ".$GLOBALS['ecs']->table('user_address')." WHERE `address_id`='$address_id'"); |
| | | if(!empty($address)){ |
| | | $region_id_list=array($address['country'], $address['province'], $address['city'], $address['district']); |
| | | |
| | | $region_id=$address['country']; |
| | | $province = $db -> getRow("SELECT * FROM ".$GLOBALS['ecs']->table('region')." WHERE region_type ='0' AND `region_id`='$region_id'"); |
| | | $address['country']=$province['region_name']; |
| | | |
| | | $region_id=$address['province']; |
| | | $province = $db -> getRow("SELECT * FROM ".$GLOBALS['ecs']->table('region')." WHERE region_type ='1' AND `region_id`='$region_id'"); |
| | | $address['province']=$province['region_name']; |
| | | |
| | | $region_id=$address['city']; |
| | | $province = $db -> getRow("SELECT * FROM ".$GLOBALS['ecs']->table('region')." WHERE region_type ='2' AND `region_id`='$region_id'"); |
| | | $address['city']=$province['region_name']; |
| | | |
| | | $region_id=$address['district']; |
| | | $province = $db -> getRow("SELECT * FROM ".$GLOBALS['ecs']->table('region')." WHERE region_type ='3' AND `region_id`='$region_id'"); |
| | | $address['district']=$province['region_name']; |
| | | |
| | | $sql = 'SELECT s.shipping_id, s.shipping_code, s.shipping_name, ' . |
| | | 's.shipping_desc, s.insure, s.support_cod, a.configure ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('shipping') . ' AS s, ' . |
| | | $GLOBALS['ecs']->table('shipping_area') . ' AS a, ' . |
| | | $GLOBALS['ecs']->table('area_region') . ' AS r ' . |
| | | 'WHERE r.region_id ' . db_create_in($region_id_list) . |
| | | ' AND r.shipping_area_id = a.shipping_area_id AND a.shipping_id = s.shipping_id AND s.enabled = 1 ORDER BY s.shipping_order'; |
| | | $shipping_list=$GLOBALS['db']->getAll($sql); |
| | | /** |
| | | * |
| | | *计算运费 |
| | | * |
| | | */ |
| | | $cart_weight_price['weight']=0; |
| | | $cart_weight_price['amount']=0; |
| | | $cart_weight_price['number']=0; |
| | | |
| | | $goods_id=$_POST['goods_id']; |
| | | $goods_number=$_POST['goods_number']; |
| | | |
| | | |
| | | $sql="SELECT |
| | | g.goods_id,g.is_shipping,g.shop_price,g.goods_weight,g.goods_number,g.integral,g.give_integral,g.rank_integral, |
| | | g.promote_price, |
| | | g.promote_start_date, |
| | | g.promote_end_date, |
| | | g.is_promote |
| | | FROM ". $GLOBALS['ecs']->table('goods') . " as g WHERE g.is_shipping=0 AND g.goods_id IN (".$goods_id.")"; |
| | | $cart_goods=$GLOBALS['db']->getAll($sql); |
| | | |
| | | $goods_idArr= explode(",",$goods_id); |
| | | $goods_numberArr= explode(",",$goods_number); |
| | | foreach ($cart_goods AS $k => $v) |
| | | { |
| | | for($i=0;$i<count($goods_idArr);$i++){ |
| | | if($v['goods_id']==$goods_idArr[$i]){ |
| | | $cart_weight_price['weight'] +=floatval($v['goods_weight'])*$goods_numberArr[$i]; |
| | | $cart_weight_price['amount'] +=floatval($v['shop_price'])*$goods_numberArr[$i]; |
| | | $result['integral'] +=floatval($v['integral'])*$goods_numberArr[$i]; |
| | | |
| | | if($v['give_integral']==-1){ |
| | | if($v['is_promote']==1&&$v['promote_start_date']<gmtime()&&$v['promote_end_date']>gmtime()){ |
| | | $v['give_integral']=$v['promote_price']; |
| | | }else{ |
| | | $v['give_integral']=$v['shop_price']; |
| | | } |
| | | |
| | | } |
| | | $result['give_integral'] +=floatval($v['give_integral'])*$goods_numberArr[$i]; |
| | | |
| | | if($v['rank_integral']==-1){ |
| | | if($v['is_promote']==1&&$v['promote_start_date']<gmtime()&&$v['promote_end_date']>gmtime()){ |
| | | $v['rank_integral']=$v['promote_price']; |
| | | }else{ |
| | | $v['rank_integral']=$v['shop_price']; |
| | | } |
| | | |
| | | } |
| | | $result['rank_integral'] +=floatval($v['rank_integral'])*$goods_numberArr[$i]; |
| | | $cart_weight_price['number'] +=$goods_numberArr[$i]; |
| | | } |
| | | } |
| | | } |
| | | foreach ($shipping_list AS $key => $val) |
| | | { |
| | | |
| | | |
| | | if(count($cart_goods)==0){$shipping_fee=0;}else{ |
| | | if (!is_array($val['configure'])) |
| | | { |
| | | $shipping_config = unserialize($val['configure']); |
| | | } |
| | | |
| | | $filename = '../includes/modules/shipping/' . $val['shipping_code'] . '.php'; |
| | | if (file_exists($filename)) |
| | | { |
| | | include_once($filename); |
| | | |
| | | $obj = new $val['shipping_code']($shipping_config); |
| | | |
| | | $shipping_fee=$obj->calculate($cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']); |
| | | |
| | | } |
| | | else |
| | | { |
| | | $shipping_fee= 0; |
| | | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | $shipping_list[$key]['shipping_fee'] = $shipping_fee; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | *计算运费code结束 |
| | | * |
| | | */ |
| | | |
| | | } |
| | | //获取红包 |
| | | $day = getdate(); |
| | | |
| | | $today = mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | $sql = "SELECT t.type_id, t.type_name, t.type_money, b.bonus_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," . |
| | | $GLOBALS['ecs']->table('user_bonus') . " AS b " . |
| | | "WHERE t.type_id = b.bonus_type_id " . |
| | | "AND t.use_start_date <= '$today' " . |
| | | "AND t.use_end_date >= '$today' " . |
| | | "AND t.min_goods_amount <= '$total' " . |
| | | "AND b.user_id<>0 " . |
| | | "AND b.user_id = '$user' " . |
| | | "AND b.order_id = 0"; |
| | | |
| | | $bonus=$GLOBALS['db']->getAll($sql); |
| | | |
| | | $sql="SELECT `user_money` FROM ". $GLOBALS['ecs']->table('users') ." WHERE `user_id`='$user' "; |
| | | $user_money=$db->getOne($sql); |
| | | if($user_money>$total) |
| | | { |
| | | $sql = "SELECT pay_id,pay_code,pay_name " . |
| | | "FROM " . $GLOBALS['ecs']->table('payment') . " WHERE (pay_code='alipay' OR pay_code='cod' OR pay_code='balance') AND enabled='1' "; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT pay_id,pay_code,pay_name " . |
| | | "FROM " . $GLOBALS['ecs']->table('payment') . " WHERE (pay_code='alipay' OR pay_code='cod') AND enabled='1' "; |
| | | $result['is_balance']=2; |
| | | } |
| | | |
| | | //获取支付方式(仅仅获取支付宝支付的方式和货到付款) |
| | | $payment=$GLOBALS['db']->getAll($sql); |
| | | |
| | | $result['address']=$address; |
| | | $result['bonus']=$bonus; |
| | | $result['payment']=$payment; |
| | | $result['integral']=$result['integral']/$shop_config_integral*100; |
| | | |
| | | $result['shipping_list']=$shipping_list; |
| | | |
| | | |
| | | |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 储值卡充值 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('../includes/init.php'); |
| | | $vc_pwd = isset($_REQUEST['vc_pwd']) ? $_REQUEST['vc_pwd'] : ''; |
| | | $vc_sn = isset($_REQUEST['vc_sn']) ? trim($_REQUEST['vc_sn']) : 0; |
| | | $user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; |
| | | $result=array(); |
| | | $nowtime =gmtime(); |
| | | if(!empty($user_id)&&$user_id!=0){ |
| | | $sql="select vc.*, vt.type_money, vt.use_start_date, vt.use_end_date from ". $ecs->table('valuecard') ." AS vc ". |
| | | " left join " . $ecs->table('valuecard_type')." AS vt ". |
| | | "on vc.vc_type_id = vt.type_id where vc.vc_sn= '$vc_sn' "; |
| | | $vcrow=$GLOBALS['db']->getRow($sql); |
| | | |
| | | if(!$vcrow) |
| | | { |
| | | $result['code']=0; |
| | | $result['info']="该储值卡号不存在"; |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | } |
| | | |
| | | if($vc_pwd!=$vcrow['vc_pwd']) |
| | | { |
| | | |
| | | $result['code']=0; |
| | | $result['info']="密码错误"; |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | } |
| | | if($nowtime < $vcrow['use_start_date']) |
| | | { |
| | | $result['code']=0; |
| | | $result['info']="对不起,该储值卡还未到开始使用日期"; |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | |
| | | } |
| | | if($nowtime > $vcrow['use_end_date']) |
| | | { |
| | | $result['code']=0; |
| | | $result['info']="对不起,该储值卡已过期"; |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | |
| | | } |
| | | if($vcrow['user_id']) |
| | | { |
| | | $result['code']=0; |
| | | $result['info']="对不起,该储值卡已使用"; |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | |
| | | } |
| | | |
| | | $sql = 'INSERT INTO ' .$GLOBALS['ecs']->table('user_account'). |
| | | ' (user_id, admin_user, amount, add_time, paid_time, admin_note, user_note, process_type, payment, is_paid)'. |
| | | " VALUES ('$user_id', '', '$vcrow[type_money]', '".gmtime()."', '". gmtime() ."', '', '储值卡充值', '0', '储值卡号:$vc_sn', 1)"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 插入帐户变动记录 */ |
| | | $account_log = array( |
| | | 'user_id' => $user_id, |
| | | 'user_money' => $vcrow['type_money'], |
| | | 'frozen_money' => 0, |
| | | 'rank_points' => 0, |
| | | 'pay_points' => 0, |
| | | 'change_time' => gmtime(), |
| | | 'change_desc' => '储值卡充值,卡号:'.$vc_sn, |
| | | 'change_type' => 0 |
| | | ); |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('account_log'), $account_log, 'INSERT'); |
| | | |
| | | /* 更新用户信息 */ |
| | | $user_money=$vcrow['type_money']; |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('users') . |
| | | " SET user_money = user_money + ('$user_money')," . |
| | | " frozen_money = frozen_money + ('0')," . |
| | | " rank_points = rank_points + ('0')," . |
| | | " pay_points = pay_points + ('0')" . |
| | | " WHERE user_id = '$user_id' LIMIT 1"; |
| | | $GLOBALS['db']->query($sql); |
| | | $sql="update ". $ecs->table('valuecard') ." set user_id='$user_id', used_time='$nowtime' where vc_id='$vcrow[vc_id]' "; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | $row = $GLOBALS['db'] -> getRow("SELECT * FROM ".$GLOBALS['ecs']->table('users')." WHERE `user_id`='$user_id'"); |
| | | $result['code']=1; |
| | | $result['info']=$row; |
| | | |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="非法操作"; |
| | | } |
| | | |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 用户地址列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $result=array(); |
| | | $row = $db -> getAll("SELECT * FROM ".$ecs->table('user_address')." WHERE `user_id`='$uid' "); |
| | | |
| | | $country = $db -> getAll("SELECT region_id,region_name FROM ".$ecs->table('region')." WHERE region_type='0' and parent_id='0' order by region_id asc"); |
| | | |
| | | |
| | | $result['country']=$country; |
| | | |
| | | for($i=0;$i<count($row);$i++){ |
| | | |
| | | $parent_id=$row[$i]['country']; |
| | | $province = $db -> getAll("SELECT region_id,region_name FROM ".$ecs->table('region')." WHERE region_type='1' and parent_id='$parent_id' order by region_id asc"); |
| | | $row[$i]['provinceList']=$province; |
| | | |
| | | $parent_id=$row[$i]['province']; |
| | | $city = $db -> getAll("SELECT region_id,region_name FROM ".$ecs->table('region')." WHERE region_type='2' and parent_id='$parent_id' order by region_id asc"); |
| | | $row[$i]['cityList']=$city; |
| | | |
| | | $parent_id=$row[$i]['city']; |
| | | $district = $db -> getAll("SELECT region_id,region_name FROM ".$ecs->table('region')." WHERE region_type='3' and parent_id='$parent_id' order by region_id asc"); |
| | | $row[$i]['districtList']=$district; |
| | | } |
| | | $result['address']=$row; |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 用户地址列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $act=$_GET['act']; |
| | | |
| | | |
| | | $result=array(); |
| | | if($act=="update"){ |
| | | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| | | $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $consignee=$_POST['consignee']; |
| | | $tel=$_GET['tel']; |
| | | $email=$_GET['email']; |
| | | $zipcode=$_GET['zipcode']; |
| | | $address=$_POST['address']; |
| | | $country=$_GET['country']; |
| | | $province=$_GET['province']; |
| | | $city=$_GET['city']; |
| | | $district=$_GET['district']; |
| | | $res = $db -> query("update ".$ecs->table('user_address')." set |
| | | consignee = '$consignee', |
| | | mobile = '$tel', |
| | | email = '$email', |
| | | zipcode = '$zipcode', |
| | | address = '$address', |
| | | country = '$country', |
| | | province = '$province', |
| | | city = '$city', |
| | | district = '$district' |
| | | where address_id = '$id'"); |
| | | $address_id = $db -> query("update ".$ecs->table('users')." set |
| | | address_id = '$id' |
| | | where user_id = '$uid'"); |
| | | $result['act']="update"; |
| | | if($res){ |
| | | $result['code']=1; |
| | | $result['info']="修改成功!"; |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="修改失败!"; |
| | | } |
| | | } |
| | | if($act=="add"){ |
| | | $consignee=$_GET['consignee']; |
| | | $user_id=$_GET['uid']; |
| | | $tel=$_GET['tel']; |
| | | $email=$_GET['email']; |
| | | $zipcode=$_GET['zipcode']; |
| | | $address=$_GET['address']; |
| | | $country=$_GET['country']; |
| | | $province=$_GET['province']; |
| | | $city=$_GET['city']; |
| | | $district=$_GET['district']; |
| | | |
| | | $address = array( |
| | | 'user_id' => $user_id, |
| | | 'address_id' => "", |
| | | 'country' => $country, |
| | | 'province' => $province, |
| | | 'city' => $city, |
| | | 'district' => $district, |
| | | 'address' => $address, |
| | | 'consignee' => $consignee, |
| | | 'email' => $email, |
| | | 'mobile' => $tel, |
| | | 'best_time' => '', |
| | | 'sign_building' => '', |
| | | 'zipcode' => $zipcode, |
| | | ); |
| | | /* 插入一条新记录 */ |
| | | $res=$db->autoExecute($ecs->table('user_address'), $address, 'INSERT'); |
| | | $address_id = $db->insert_id(); |
| | | $set_defaut_address= $db -> query("update ".$ecs->table('users')." set |
| | | address_id = '$address_id' |
| | | where user_id = '$user_id'"); |
| | | $result['add']="add"; |
| | | |
| | | if($res>0){ |
| | | $result['code']=1; |
| | | $result['info']="添加成功!"; |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="添加失败!"; |
| | | } |
| | | } |
| | | if($act=="del"){ |
| | | $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
| | | $sql="DELETE FROM ".$ecs->table('user_address')." WHERE address_id='$id' "; |
| | | $res=$db -> query($sql); |
| | | $result['act']="del"; |
| | | if($res){ |
| | | $result['code']=1; |
| | | $result['info']="删除成功!"; |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']="删除失败!"; |
| | | } |
| | | |
| | | } |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 文章内容 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $article_id = isset($_REQUEST['article_id']) ? intval($_REQUEST['article_id']) : 0; |
| | | $res = $db -> getRow("SELECT `title`,`content`,`add_time`,`add_time`,`click_count` FROM ".$ecs->table('article')." WHERE `article_id`='$article_id'"); |
| | | $click_count=$res['click_count']+1; |
| | | $db -> query("update ".$ecs->table('article')." set click_count = '$click_count' where article_id = '$article_id'"); |
| | | $res = $db -> getRow("SELECT `title`,`content`,`add_time`,`add_time`,`click_count` FROM ".$ecs->table('article')." WHERE `article_id`='$article_id'"); |
| | | $res['add_time']=date('Y-m-d',$res['add_time']); |
| | | print_r(json_encode($res)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 文章内容 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $article_id = 7; |
| | | $res = $db -> getRow("SELECT `title`,`content`,`add_time`,`add_time` FROM ".$ecs->table('article')." WHERE `article_id`='$article_id'");//,`click_count` |
| | | // $click_count=$res['click_count']+1; |
| | | // $db -> query("update ".$ecs->table('article')." set click_count = '$click_count' where article_id = '$article_id'"); |
| | | $res = $db -> getRow("SELECT `title`,`content`,`add_time`,`add_time` FROM ".$ecs->table('article')." WHERE `article_id`='$article_id'");//,`click_count` |
| | | $res['add_time']=date('Y-m-d',$res['add_time']); |
| | | print_r(json_encode($res)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 文章分类 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $result=array(); |
| | | $result2=array(); |
| | | $res = $db -> getAll("SELECT cat_id,cat_name FROM ".$ecs->table('article_cat')." WHERE parent_id='0' and cat_type='1' and show_in_nav='0' order by sort_order asc"); |
| | | foreach ($res as $key=>$val) |
| | | { |
| | | $parent_id=$val['cat_id']; |
| | | $result2['cat_id']=$val['cat_id']; |
| | | $result2['cat_name']=$val['cat_name']; |
| | | $rows = $db -> getAll("SELECT cat_id,cat_name FROM ".$ecs->table('article_cat')." WHERE parent_id='$parent_id' and cat_type='1' order by sort_order asc"); |
| | | $result2['list']=$rows; |
| | | $result[]=$result2; |
| | | } |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 文章列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | |
| | | $cat_id = isset($_REQUEST['cat_id']) ? intval($_REQUEST['cat_id']) : 0; |
| | | $page=$_GET['page']*10; |
| | | |
| | | $cat_id_list=$cat_id; |
| | | |
| | | if(!empty($cat_id)){ |
| | | $sql = "SELECT * FROM " .$ecs->table('article_cat'). " WHERE parent_id='$cat_id' "; |
| | | $cat_List=$db->getAll($sql); |
| | | for($i=0;$i<count($cat_List);$i++){ |
| | | $cat_id_list.=",".$cat_List[$i]['cat_id']; |
| | | $cat_id1=$cat_List[$i]['cat_id']; |
| | | $sql = "SELECT * FROM " .$ecs->table('article_cat'). " WHERE parent_id ='$cat_id1' "; |
| | | $cat_List2=$db->getAll($sql); |
| | | for($j=0;$j<count($cat_List2);$j++){ |
| | | $cat_id_list.=",".$cat_List2[$j]['cat_id']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | $res = $db -> getAll("SELECT article_id,title FROM ".$ecs->table('article')." WHERE cat_id in($cat_id_list) AND is_open=1 order by article_id asc LIMIT $page,10;"); |
| | | |
| | | |
| | | print_r(json_encode($res)); |
| | | |
| | | ?> |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 我的红包列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $page=$_GET['page']*5; |
| | | $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $result=array(); |
| | | $sql="SELECT ub.used_time,ub.bonus_sn ,bt.type_name,bt.type_money,bt.min_goods_amount,bt.use_end_date |
| | | FROM ".$ecs->table('user_bonus')." AS ub,".$ecs->table('bonus_type')." AS bt WHERE ub.user_id='$uid' AND ub.bonus_type_id=bt.type_id |
| | | LIMIT $page,5"; |
| | | //print_r($sql); |
| | | $result= $db -> getAll($sql); |
| | | $length=count($result); |
| | | for($i=0;$i<$length;$i++){ |
| | | if($result[$i]['used_time']==0){ |
| | | $result[$i]['is_used']="未使用"; |
| | | }else{ |
| | | $result[$i]['is_used']="已使用"; |
| | | } |
| | | if($result[$i]['bonus_sn']==0){ |
| | | $result[$i]['bonus_sn']="N/A"; |
| | | } |
| | | $result[$i]['use_end_date']=date("Y-m-d",$result[$i]['use_end_date']); |
| | | } |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 商品品牌 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | |
| | | $result = $db -> getAll("SELECT brand_id,brand_name FROM ".$ecs->table('brand')." order by sort_order asc"); |
| | | |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 支付宝回调 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | /* $_POST['notify_data']="<notify><partner>2088011455446653</partner><discount>0.00</discount><payment_type>1</payment_type><subject>测试支付</subject><trade_no>2013092333205432</trade_no><buyer_email>945586976@qq.com</buyer_email><gmt_create>2013-09-23 09:22:21</gmt_create><quantity>1</quantity><out_trade_no>2013092390803</out_trade_no><seller_id>2088011455446653</seller_id><trade_status>TRADE_FINISHED</trade_status><is_total_fee_adjust>N</is_total_fee_adjust><total_fee>0.01</total_fee><gmt_payment>2013-09-23 09:22:22</gmt_payment><seller_email>13518753698@163.com</seller_email><gmt_close>2013-09-23 09:22:22</gmt_close><price>0.01</price><buyer_id>2088502846564329</buyer_id><use_coupon>N</use_coupon></notify>"; */ |
| | | if(!empty($_POST['notify_data'])){ |
| | | $notify_data = $_POST['notify_data']; |
| | | $doc = new DOMDocument(); |
| | | $doc->loadXML($notify_data); |
| | | if( ! empty($doc->getElementsByTagName( "notify" )->item(0)->nodeValue) ) { |
| | | //商户订单号 |
| | | $out_trade_no = $doc->getElementsByTagName( "out_trade_no" )->item(0)->nodeValue; |
| | | //支付宝交易号 |
| | | $trade_no = $doc->getElementsByTagName( "trade_no" )->item(0)->nodeValue; |
| | | //交易状态 |
| | | $trade_status = $doc->getElementsByTagName( "trade_status" )->item(0)->nodeValue; |
| | | |
| | | if($trade_status == 'TRADE_FINISHED') { |
| | | |
| | | $row = $db -> query("update ".$ecs->table('order_info')." set pay_status = '2' where order_sn = '$out_trade_no'"); |
| | | if($row){ |
| | | echo "success"; |
| | | }else{ |
| | | echo "fail"; |
| | | } |
| | | |
| | | } |
| | | else if ($trade_status == 'TRADE_SUCCESS') { |
| | | |
| | | $row = $db -> query("update ".$ecs->table('order_info')." set pay_status = '2' where order_sn = '$out_trade_no'"); |
| | | |
| | | if($row){ |
| | | echo "success"; |
| | | }else{ |
| | | echo "fail"; |
| | | } |
| | | } |
| | | } |
| | | /* $of = fopen('post.txt','w');//创建并打开dir.txt |
| | | if($of){ |
| | | $str=date('Y-m-d h:m:s',time())."||"; |
| | | foreach ($_POST as $key => $value){ |
| | | $str.=$key."=>".$value."||"; |
| | | } |
| | | fwrite($of,$str);//把执行文件的结果写入txt文件 |
| | | } |
| | | fclose($of); */ |
| | | } |
| | | |
| | | |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 删除会员充值记录记录 |
| | | */ |
| | | require('includes/safety_mysql.php'); |
| | | define('IN_ECS', true); |
| | | require('../includes/init.php'); |
| | | $user_id=intval($_POST['user_id']); |
| | | $id=intval(substr($_POST['id'],10)); |
| | | // appjx 修改 |
| | | $sql = "SELECT user_money FROM " .$GLOBALS['ecs']->table('users'). |
| | | " WHERE user_id = '$user_id'"; |
| | | |
| | | $surplus_amount = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $sql="DELETE FROM ".$ecs->table('user_account')." WHERE id='$id' AND user_id = '$user_id' AND is_paid = '0' "; |
| | | $db -> query($sql); |
| | | |
| | | $sql = 'SELECT * FROM ' .$GLOBALS['ecs']->table('user_account'). |
| | | " WHERE user_id = '$user_id'" . |
| | | " ORDER BY add_time DESC"; |
| | | $res = $db -> getAll($sql); |
| | | $process_type = array('充值','退款'); |
| | | $is_paid = array('未确认','已完成'); |
| | | for($i=0;$i<count($res);$i++){ |
| | | $res[$i]['id'] = $res[$i]['add_time'].$res[$i]['id']; |
| | | $res[$i]['add_time'] = local_date($GLOBALS['_CFG']['date_format'], $res[$i]['add_time']); |
| | | $res[$i]['process_type'] = $process_type[$res[$i]['process_type']]; |
| | | $res[$i]['is_paid'] = $is_paid[$res[$i]['is_paid']]; |
| | | } |
| | | //appjx 修改 |
| | | print_r(json_encode(array('list'=>$res,'surplus_amount'=>$surplus_amount))); |
| | | |
| | | |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 取消订单 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $result=array(); |
| | | $result1=array(); |
| | | $order_sn = isset($_REQUEST['order_sn']) ? $_REQUEST['order_sn'] : 0; |
| | | $user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; |
| | | |
| | | |
| | | $row = $db -> query("update ".$ecs->table('order_info')." set order_status = '2' where order_sn = '$order_sn' AND `user_id`='$user_id'"); |
| | | |
| | | if($row){ |
| | | $result['code']=1; |
| | | $result['info']='订单取消成功!'; |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']='订单取消失败!'; |
| | | } |
| | | |
| | | $sql="SELECT * FROM ".$ecs->table('order_info')." WHERE order_sn='$order_sn' "; |
| | | |
| | | $res = $db -> getRow($sql); |
| | | |
| | | date_default_timezone_set('PRC'); |
| | | $res['add_time']=date('Y-m-d h:m:s',$res['add_time']); |
| | | if($res['order_status']==0){ |
| | | $res['order_status']="未确认"; |
| | | }else if($res['order_status']==1){ |
| | | $res['order_status']="已确认"; |
| | | }else if($res['order_status']==2){ |
| | | $res['order_status']="已取消"; |
| | | }else if($res['order_status']==3){ |
| | | $res['order_status']="无效"; |
| | | }else if($res['order_status']==4){ |
| | | $res['order_status']="退货"; |
| | | }else if($res['order_status']==5){ |
| | | $res['order_status']="已分单"; |
| | | } |
| | | |
| | | if($res['shipping_status']==0){ |
| | | $res['shipping_status']="未发货"; |
| | | }else if($res['shipping_status']==1){ |
| | | $res['shipping_status']="已发货"; |
| | | }else if($res['shipping_status']==2){ |
| | | $res['shipping_status']="已收货"; |
| | | }else if($res['shipping_status']==3){ |
| | | $res['shipping_status']="备货中"; |
| | | } |
| | | |
| | | if($res['pay_status']==0){ |
| | | $res['pay_status']="未付款"; |
| | | }else if($res['pay_status']==1){ |
| | | $res['pay_status']="付款中"; |
| | | }else if($res['pay_status']==2){ |
| | | $res['pay_status']="已付款"; |
| | | |
| | | } |
| | | $result1['orderInfo']=$res; |
| | | $order_id=$res['order_id']; |
| | | $sql="SELECT goods_name, goods_price,goods_number,goods_attr |
| | | FROM ".$ecs->table('order_goods')." WHERE order_id='$order_id' "; |
| | | //print_r($sql); |
| | | $res = $db -> getAll($sql); |
| | | $result1['orderGoods']=$res; |
| | | $result['info']=$result1; |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 购物车更新商品价格 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('../includes/init.php'); |
| | | //require('../includes/lib_goods.php'); |
| | | |
| | | $goods_id_arr = isset($_REQUEST['goods_id_arr']) ? trim($_REQUEST['goods_id_arr']) : 0; |
| | | $user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; |
| | | |
| | | $sql="SELECT g.goods_id,g.shop_price,g.is_promote,g.promote_price,g.promote_start_date,g.promote_end_date FROM ".$GLOBALS['ecs']->table('goods')." AS g WHERE is_delete = '0' AND is_on_sale = '1' and g.goods_number >0 AND g.goods_id IN ($goods_id_arr)"; |
| | | |
| | | $row = $GLOBALS['db'] -> getAll($sql); |
| | | |
| | | $user_rank_name=get_rank_info($user_id); |
| | | $time=time(); |
| | | foreach ($row as $k=>$value) { |
| | | $user_rank_prices=get_user_rank_prices($value['goods_id'],$value['shop_price'],$user_id); |
| | | foreach ($user_rank_prices as $rank_prices_value) { |
| | | if($user_rank_name['rank_name']==$rank_prices_value['rank_name']){ |
| | | if($value['is_promote']==1){ |
| | | |
| | | //if($value['promote_price']<$rank_prices_value['price']&&$value['promote_start_date']<=$time&&$value['promote_end_date']>$time){ |
| | | //$row[$k]['shop_price']=str_replace('¥','',$value['promote_price']); |
| | | //}else{ |
| | | $row[$k]['shop_price']=str_replace('¥','',$rank_prices_value['price']); |
| | | //} |
| | | |
| | | }else{ |
| | | $row[$k]['shop_price']=str_replace('¥','',$rank_prices_value['price']); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | print_r(json_encode($row)); |
| | | |
| | | /*=====================================的一些函数方法======================================*/ |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获得指定商品的各会员等级对应的价格 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_user_rank_prices($goods_id, $shop_price,$user_id) |
| | | { |
| | | |
| | | $user_rank = $GLOBALS['db']->getOne("SELECT user_rank FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '$user_id'"); |
| | | $sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $shop_price / 100) AS price, r.rank_name, r.discount " . |
| | | 'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ". |
| | | "ON mp.goods_id = '$goods_id' AND mp.user_rank = r.rank_id " . |
| | | "WHERE r.show_price = 1 OR r.rank_id = '$user_rank'"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $arr = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | |
| | | $arr[] = array( |
| | | 'rank_name' => htmlspecialchars($row['rank_name']), |
| | | 'price' => price_format($row['price'])); |
| | | } |
| | | |
| | | return $arr; |
| | | } |
| | | |
| | | /** |
| | | * 获得会员等级 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_rank_info($user_id) |
| | | { |
| | | $user_rank = $GLOBALS['db']->getOne("SELECT user_rank FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '$user_id'"); |
| | | |
| | | $sql = "SELECT rank_name FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '$user_rank'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $rank_name=$row['rank_name']; |
| | | |
| | | return array('rank_name'=>$rank_name); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | ?> |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 商品分类 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $result=array(); |
| | | $result2=array(); |
| | | $res = $db -> getAll("SELECT cat_id,cat_name FROM ".$ecs->table('category')." WHERE parent_id='0' and is_show='1' order by sort_order asc"); |
| | | foreach ($res as $key=>$val) |
| | | { |
| | | $parent_id=$val['cat_id']; |
| | | $result2['cat_id']=$val['cat_id']; |
| | | $result2['cat_name']=$val['cat_name']; |
| | | $rows = $db -> getAll("SELECT cat_id,cat_name FROM ".$ecs->table('category')." WHERE parent_id='$parent_id' and is_show='1' order by sort_order asc"); |
| | | for($i=0;$i<count($rows);$i++){ |
| | | $children_id=$rows[$i]['cat_id']; |
| | | $rows2 = $db -> getAll("SELECT cat_id,cat_name FROM ".$ecs->table('category')." WHERE parent_id='$children_id' and is_show='1' order by sort_order asc"); |
| | | $rows[$i]['children']=$rows2; |
| | | } |
| | | $result2['list']=$rows; |
| | | $result[]=$result2; |
| | | } |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 城市列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $parent_id = isset($_REQUEST['parent_id']) ? intval($_REQUEST['parent_id']) : 0; |
| | | $region_type=$_GET['region_type']; |
| | | $res = $db -> getAll("SELECT region_id,region_name FROM ".$ecs->table('region')." WHERE region_type='$region_type' and parent_id='$parent_id' order by region_id asc"); |
| | | |
| | | print_r(json_encode($res)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 确认收货 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $result=array(); |
| | | $result1=array(); |
| | | $order_sn = isset($_REQUEST['order_sn']) ? $_REQUEST['order_sn'] : 0; |
| | | $user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; |
| | | |
| | | |
| | | $row = $db -> query("update ".$ecs->table('order_info')." set shipping_status = '2' where order_sn = '$order_sn' AND `user_id`='$user_id'"); |
| | | |
| | | if($row){ |
| | | $result['code']=1; |
| | | $result['info']='订单取消成功!'; |
| | | }else{ |
| | | $result['code']=0; |
| | | $result['info']='订单取消失败!'; |
| | | } |
| | | |
| | | $sql="SELECT * FROM ".$ecs->table('order_info')." WHERE order_sn='$order_sn' "; |
| | | |
| | | $res = $db -> getRow($sql); |
| | | |
| | | date_default_timezone_set('PRC'); |
| | | $res['add_time']=date('Y-m-d h:m:s',$res['add_time']); |
| | | if($res['order_status']==0){ |
| | | $res['order_status']="未确认"; |
| | | }else if($res['order_status']==1){ |
| | | $res['order_status']="已确认"; |
| | | }else if($res['order_status']==2){ |
| | | $res['order_status']="已取消"; |
| | | }else if($res['order_status']==3){ |
| | | $res['order_status']="无效"; |
| | | }else if($res['order_status']==4){ |
| | | $res['order_status']="退货"; |
| | | }else if($res['order_status']==5){ |
| | | $res['order_status']="已分单"; |
| | | } |
| | | |
| | | if($res['shipping_status']==0){ |
| | | $res['shipping_status']="未发货"; |
| | | }else if($res['shipping_status']==1){ |
| | | $res['shipping_status']="已发货"; |
| | | }else if($res['shipping_status']==2){ |
| | | $res['shipping_status']="已收货"; |
| | | }else if($res['shipping_status']==3){ |
| | | $res['shipping_status']="备货中"; |
| | | } |
| | | |
| | | if($res['pay_status']==0){ |
| | | $res['pay_status']="未付款"; |
| | | }else if($res['pay_status']==1){ |
| | | $res['pay_status']="付款中"; |
| | | }else if($res['pay_status']==2){ |
| | | $res['pay_status']="已付款"; |
| | | |
| | | } |
| | | $result1['orderInfo']=$res; |
| | | $order_id=$res['order_id']; |
| | | $sql="SELECT goods_name, goods_price,goods_number,goods_attr |
| | | FROM ".$ecs->table('order_goods')." WHERE order_id='$order_id' "; |
| | | //print_r($sql); |
| | | $res = $db -> getAll($sql); |
| | | $result1['orderGoods']=$res; |
| | | $result['info']=$result1; |
| | | print_r(json_encode($result)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 删除收藏商品列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $uid = isset($_REQUEST['uid']) ? intval($_REQUEST['uid']) : 0; |
| | | $goods_id = isset($_REQUEST['goods_id']) ? intval($_REQUEST['goods_id']) : 0; |
| | | $sql="DELETE FROM ".$ecs->table('collect_goods')." WHERE user_id='$uid' AND goods_id='$goods_id' "; |
| | | $res=$db -> query($sql); |
| | | $result=array(); |
| | | if($res){ |
| | | $result['code']="1"; |
| | | $result['info']="删除成功!"; |
| | | }else{ |
| | | $result['code']="0"; |
| | | $result['info']="删除失败!"; |
| | | } |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 筛选内容 |
| | | */ |
| | | define('IN_ECS', true); |
| | | //require('includes/init.php'); |
| | | require('../includes/init.php'); |
| | | $result=array(); |
| | | $result2=array(); |
| | | $cat_id = isset($_REQUEST['cat_id']) ? intval($_REQUEST['cat_id']) : 0; |
| | | $children = get_children($cat_id); |
| | | /* 品牌筛选 */ |
| | | |
| | | $sql = "SELECT b.brand_id, b.brand_name, COUNT(*) AS goods_num ". |
| | | "FROM " . $GLOBALS['ecs']->table('brand') . "AS b, ". |
| | | $GLOBALS['ecs']->table('goods') . " AS g LEFT JOIN ". $GLOBALS['ecs']->table('goods_cat') . " AS gc ON g.goods_id = gc.goods_id " . |
| | | "WHERE g.brand_id = b.brand_id AND ($children OR " . 'gc.cat_id ' . db_create_in(array_unique(array_merge(array($cat_id), array_keys(cat_list($cat_id, 0, false))))) . ") AND b.is_show = 1 " . |
| | | " AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 ". |
| | | "GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY b.sort_order, b.brand_id ASC"; |
| | | |
| | | $brands = $GLOBALS['db']->getAll($sql); |
| | | |
| | | |
| | | |
| | | //获取该分类的商品品牌 |
| | | /* |
| | | $sql="SELECT b.brand_id, b.brand_name, COUNT(*) AS goods_num FROM ".$GLOBALS['ecs']->table('brand')." AS b, ".$GLOBALS['ecs']->table('goods')." AS g LEFT JOIN ".$GLOBALS['ecs']->table('goods_cat')." AS gc ON g.goods_id = gc.goods_id WHERE g.brand_id = b.brand_id AND (g.cat_id IN ('$cat_id') OR gc.cat_id IN ('$cat_id') ) AND b.is_show = 1 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 GROUP BY b.brand_id HAVING goods_num > 0 ORDER BY b.sort_order, b.brand_id ASC"; |
| | | $brands = $GLOBALS['db']->getAll($sql); |
| | | */ |
| | | $result['brands']=$brands; |
| | | |
| | | |
| | | $filter_attr = $GLOBALS['db'] -> getRow("SELECT filter_attr FROM ".$GLOBALS['ecs']->table('category')." WHERE cat_id='$cat_id'"); |
| | | |
| | | //获取该分类的筛选信息 |
| | | if(!empty($filter_attr['filter_attr'])){ |
| | | $cat_filter_attr = explode(',', $filter_attr['filter_attr']); //提取出此分类的筛选属性 |
| | | $all_attr_list = array(); |
| | | foreach ($cat_filter_attr AS $key => $value) |
| | | { |
| | | /* |
| | | $sql="SELECT a.attr_name FROM ".$GLOBALS['ecs']->table('attribute')." AS a, ".$GLOBALS['ecs']->table('goods_attr')." AS ga, ".$GLOBALS['ecs']->table('goods')." AS g WHERE (g.cat_id IN ('$cat_id') OR g.goods_id IN ('') ) AND a.attr_id = ga.attr_id AND g.goods_id = ga.goods_id AND g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND a.attr_id='$value'"; |
| | | */ |
| | | $sql = "SELECT a.attr_name FROM " . $GLOBALS['ecs']->table('attribute') . " AS a, " . $GLOBALS['ecs']->table('goods_attr') . " AS ga, " . $GLOBALS['ecs']->table('goods') . " AS g WHERE ($children OR " . get_extension_goods($children) . ") AND a.attr_id = ga.attr_id AND g.goods_id = ga.goods_id AND g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND a.attr_id='$value'"; |
| | | |
| | | if($temp_name = $GLOBALS['db']->getOne($sql)) |
| | | { |
| | | $all_attr_list[$key]['filter_attr_name'] = $temp_name; |
| | | /* |
| | | $sql="SELECT a.attr_id, MIN(a.goods_attr_id ) AS goods_attr_id, a.attr_value AS attr_value FROM ".$GLOBALS['ecs']->table('goods_attr')." AS a, ".$GLOBALS['ecs']->table('goods')." AS g WHERE (g.cat_id IN ('$cat_id') OR g.goods_id IN ('') ) AND g.goods_id = a.goods_id AND g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND a.attr_id='$value' GROUP BY a.attr_value"; |
| | | */ |
| | | $sql = "SELECT a.attr_id, MIN(a.goods_attr_id ) AS goods_id, a.attr_value AS attr_value FROM " . $ecs->table('goods_attr') . " AS a, " . $ecs->table('goods') . |
| | | " AS g" . |
| | | " WHERE ($children OR " . get_extension_goods($children) . ') AND g.goods_id = a.goods_id AND g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 '. |
| | | " AND a.attr_id='$value' ". |
| | | " GROUP BY a.attr_value"; |
| | | $attr_list = $GLOBALS['db']->getAll($sql); |
| | | $all_attr_list[$key]['attr_list'] = $attr_list; |
| | | } |
| | | } |
| | | $result['filter_attr']=$all_attr_list; |
| | | }else{ |
| | | $result['filter_attr']=$result2; |
| | | } |
| | | |
| | | |
| | | print_r(json_encode($result)); |
| | | |
| | | |
| | | ?> |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | define('IN_ECS', true); |
| | | |
| | | require('../includes/init.php'); |
| | | require('./includes/lib_order.php'); |
| | | include('../includes/cls_json.php'); |
| | | $json = new JSON; |
| | | /* 载入语言文件 */ |
| | | require_once('../languages/zh_cn/shopping_flow.php'); |
| | | require_once('../languages/zh_cn/user.php'); |
| | | |
| | | $_LANG['your_discount'] = '根据优惠活动<a href="javascript:void(0)" onclick="activity()"><font style="color:#F93">%s</font></a>,您可以享受折扣 %s'; |
| | | |
| | | $userid = intval($_REQUEST['userid']); |
| | | if($userid > 0){ |
| | | //需要获取用户登陆的相关信息 |
| | | $_SESSION['user_id'] = $userid; |
| | | } |
| | | $smarty->assign('lang', $_LANG); |
| | | |
| | | $smarty->template_dir = ROOT_PATH . 'json/tpl';//app部分模板所在位置 |
| | | |
| | | |
| | | /* |
| | | * 获取购物车中的商品 |
| | | */ |
| | | if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'selcart') |
| | | { |
| | | |
| | | $res = array('error' => 0, 'result' => '', 'message' => ''); |
| | | |
| | | |
| | | /* 取得商品列表,计算合计 */ |
| | | $cart_goods = get_cart_goods(); |
| | | if(count($cart_goods['goods_list'])<=0){ |
| | | $res['error'] = 1; |
| | | $res['message'] = '请先添加商品!'; |
| | | die($json->encode($res)); |
| | | } |
| | | |
| | | |
| | | /* 取得优惠活动 */ |
| | | $favourable_list = favourable_list($_SESSION['user_rank']); |
| | | |
| | | if($favourable_list){ |
| | | $new_fav = array(); |
| | | foreach($favourable_list as $key => $val){ |
| | | if(isset($cart_goods['goods_list'][$val['supplier_id']])){ |
| | | $cart_goods['goods_list'][$val['supplier_id']]['favourable'][] = $val; |
| | | } |
| | | } |
| | | } |
| | | //echo "<pre>"; |
| | | //print_r($cart_goods['goods_list']); |
| | | |
| | | foreach($cart_goods['goods_list'] as $k=>$v){ |
| | | $discount = compute_discount($k); |
| | | if(is_array($discount)){ |
| | | $cart_goods['goods_list'][$k]['discount']['discount'] = $discount['discount']; |
| | | $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); |
| | | $cart_goods['goods_list'][$k]['discount']['your_discount'] = sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount'])); |
| | | } |
| | | } |
| | | |
| | | //选择优惠活动中的赠品时所要执行的部分_start |
| | | if(isset($_REQUEST['is_ajax']) && intval($_REQUEST['is_ajax']) > 0){ |
| | | $res = array('error' => 0, 'result' => ''); |
| | | if (isset($_REQUEST['suppid'])) |
| | | { |
| | | $smarty->assign('favourable_list', $cart_goods['goods_list'][intval($_REQUEST['suppid'])]['favourable']); |
| | | $res['result'] = $smarty->fetch("favourable_app.lbi"); |
| | | } |
| | | else |
| | | { |
| | | $res['result'] = '您一个商品都没选,这怎么行捏!!真的不行哦!'; |
| | | } |
| | | die($json->encode($res)); |
| | | } |
| | | //选择优惠活动中的赠品时所要执行的部分_end |
| | | |
| | | $res['result'] = $cart_goods; |
| | | die($json->encode($res)); |
| | | } |
| | | |
| | | /* |
| | | * 修改购物车中商品的数量 |
| | | */ |
| | | if($_REQUEST['step']=='update_group_cart') |
| | | { |
| | | $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => ''); |
| | | $rec_id = intval($_REQUEST['rec_id']); |
| | | $number = intval($_REQUEST['number']); |
| | | $goods_id = intval($_REQUEST['goods_id']); |
| | | $result['suppid'] = intval($_REQUEST['suppid']); |
| | | $result['rec_id'] = $rec_id; |
| | | $result['number']=$number; |
| | | |
| | | |
| | | |
| | | $goods_number = $GLOBALS['db']->getOne("select goods_number from ".$GLOBALS['ecs']->table('goods')." where goods_id='$goods_id'"); |
| | | if($number>$goods_number) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['content'] ='对不起,您选择的数量超出库存您最多可购买'.$goods_number."件"; |
| | | $result['number']=$GLOBALS['db']->getOne("select goods_number from ".$GLOBALS['ecs']->table('cart')." where rec_id = '$rec_id'"); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $min_price = get_min_price($goods_id,$number,$rec_id);//取得当前用户该商品的最小单价 |
| | | //file_put_contents('./567.txt',$min_price); |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '$number',goods_price = '$min_price' WHERE rec_id = $rec_id"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 取得商品列表,计算合计 */ |
| | | $cart_goods = get_cart_goods(); |
| | | $result['min_price'] = $min_price; |
| | | //折扣活动 |
| | | $result['your_discount'] = ''; |
| | | $discount = compute_discount($result['suppid']); |
| | | if(is_array($discount)){ |
| | | $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); |
| | | $result['your_discount'] = sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount'])); |
| | | } |
| | | |
| | | $subtotal = $GLOBALS['db']->getONE("select goods_price * goods_number AS subtotal from ".$GLOBALS['ecs']->table('cart')." where rec_id = $rec_id"); |
| | | $result['subtotal'] = price_format($subtotal, false); |
| | | //$result['cart_amount_desc'] = sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']); |
| | | $result['cart_amount_desc'] = $cart_goods['total']['goods_price']; |
| | | $shopping_money = sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']); |
| | | $result['market_amount_desc'] = $shopping_money; |
| | | if ($_CFG['show_marketprice']) |
| | | { |
| | | $market_price_desc= sprintf($_LANG['than_market_price'],$cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate']); |
| | | $result['market_amount_desc'].= ",".$market_price_desc ; |
| | | } |
| | | |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- 添加商品到购物车 |
| | | /*------------------------------------------------------ */ |
| | | elseif ($_REQUEST['step'] == 'add_to_cart') |
| | | { |
| | | |
| | | $_REQUEST['goods']=strip_tags(urldecode($_REQUEST['goods'])); |
| | | $_REQUEST['goods'] = json_str_iconv($_REQUEST['goods']); |
| | | |
| | | $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => ''); |
| | | if (!empty($_REQUEST['goods_id']) && empty($_REQUEST['goods'])) |
| | | { |
| | | if (!is_numeric($_REQUEST['goods_id']) || intval($_REQUEST['goods_id']) <= 0) |
| | | { |
| | | $result['error'] = ERR_NOT_EXISTS; |
| | | $result['message'] = '非法操作!'; |
| | | die($json->encode($result)); |
| | | } |
| | | $goods_id = intval($_REQUEST['goods_id']); |
| | | exit; |
| | | } |
| | | |
| | | if (empty($_REQUEST['goods'])) |
| | | { |
| | | $result['error'] = 1; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $goods = $json->decode($_REQUEST['goods']); |
| | | |
| | | /* 检查:如果商品有规格,而post的数据没有规格,把商品的规格属性通过JSON传到前台 */ |
| | | if (empty($goods->spec) AND empty($goods->quick)) |
| | | { |
| | | $sql = "SELECT a.attr_id, a.attr_name, a.attr_type, ". |
| | | "g.goods_attr_id, g.attr_value, g.attr_price " . |
| | | 'FROM ' . $GLOBALS['ecs']->table('goods_attr') . ' AS g ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('attribute') . ' AS a ON a.attr_id = g.attr_id ' . |
| | | "WHERE a.attr_type != 0 AND g.goods_id = '" . $goods->goods_id . "' " . |
| | | 'ORDER BY a.sort_order, g.attr_price, g.goods_attr_id'; |
| | | |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if (!empty($res)) |
| | | { |
| | | $spe_arr = array(); |
| | | foreach ($res AS $row) |
| | | { |
| | | $spe_arr[$row['attr_id']]['attr_type'] = $row['attr_type']; |
| | | $spe_arr[$row['attr_id']]['name'] = $row['attr_name']; |
| | | $spe_arr[$row['attr_id']]['attr_id'] = $row['attr_id']; |
| | | $spe_arr[$row['attr_id']]['values'][] = array( |
| | | 'label' => $row['attr_value'], |
| | | 'price' => $row['attr_price'], |
| | | 'format_price' => price_format($row['attr_price'], false), |
| | | 'id' => $row['goods_attr_id']); |
| | | } |
| | | $i = 0; |
| | | $spe_array = array(); |
| | | foreach ($spe_arr AS $row) |
| | | { |
| | | $spe_array[]=$row; |
| | | } |
| | | $result['error'] = ERR_NEED_SELECT_ATTR; |
| | | $result['goods_id'] = $goods->goods_id; |
| | | $result['parent'] = $goods->parent; |
| | | $result['message'] = $spe_array; |
| | | |
| | | die($json->encode($result)); |
| | | } |
| | | } |
| | | |
| | | /* 更新:如果是一步购物,先清空购物车 */ |
| | | //if ($_CFG['one_step_buy'] == '1') |
| | | if(isset($_REQUEST['shop_cat']) && $_REQUEST['shop_cat'] == 'now') |
| | | { |
| | | if($userid <= 0){ |
| | | $result['error'] = 0; |
| | | $result['message'] = '请选登陆!'; |
| | | die($json->encode($result)); |
| | | }else{ |
| | | clear_cart(); |
| | | } |
| | | } |
| | | |
| | | /* 检查:商品数量是否合法 */ |
| | | if (!is_numeric($goods->number) || intval($goods->number) <= 0) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['invalid_number']; |
| | | } |
| | | /* 更新:购物车 */ |
| | | else |
| | | { |
| | | if(!empty($goods->spec)) |
| | | { |
| | | foreach ($goods->spec as $key=>$val ) |
| | | { |
| | | $goods->spec[$key]=intval($val); |
| | | } |
| | | } |
| | | // 更新:添加到购物车 |
| | | if (addto_cart($goods->goods_id, $goods->number, $goods->spec, $goods->parent)) |
| | | { |
| | | if ($_CFG['cart_confirm'] > 2) |
| | | { |
| | | $result['message'] = ''; |
| | | } |
| | | else |
| | | { |
| | | $result['message'] = $_CFG['cart_confirm'] == 1 ? $_LANG['addto_cart_success_1'] : $_LANG['addto_cart_success_2']; |
| | | } |
| | | |
| | | $result['content'] = insert_cart_info(); |
| | | $result['one_step_buy'] = $_CFG['one_step_buy']; |
| | | } |
| | | else |
| | | { |
| | | $result['message'] = $err->last_message(); |
| | | $result['error'] = $err->error_no; |
| | | $result['goods_id'] = stripslashes($goods->goods_id); |
| | | if (is_array($goods->spec)) |
| | | { |
| | | $result['product_spec'] = implode(',', $goods->spec); |
| | | } |
| | | else |
| | | { |
| | | $result['product_spec'] = $goods->spec; |
| | | } |
| | | } |
| | | } |
| | | $rows = $GLOBALS['db']->getRow("select goods_brief,shop_price,goods_name,promote_end_date,promote_start_date,promote_price,goods_thumb from ".$GLOBALS['ecs']->table('goods')." where goods_id=".$goods->goods_id); |
| | | $time1 = gmtime(); |
| | | if ($time1 >= $rows['promote_start_date'] && $time1 <= $rows['promote_end_date'] && $rows['promote_price'] > 0) |
| | | { |
| | | $result['shop_price'] = price_format($rows['promote_price']); |
| | | }else{ |
| | | $result['shop_price'] = price_format($rows['shop_price']); |
| | | } |
| | | $result['goods_name'] = $rows['goods_name']; |
| | | $result['goods_thumb'] = $rows['goods_thumb']; |
| | | $result['goods_brief'] = $rows['goods_brief']; |
| | | $result['goods_id'] = $goods->goods_id; |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 |
| | | $sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE ".$sql_where." AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $rowss = $GLOBALS['db']->GetRow($sql); |
| | | $result['goods_price'] = price_format($rowss['amount']); |
| | | $result['goods_number'] = $rowss['number']; |
| | | $result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2; |
| | | die($json->encode($result)); |
| | | } |
| | | elseif ($_REQUEST['step'] == 'add_favourable') |
| | | { |
| | | $result = array('error' => 0, 'message' => '', 'content' => ''); |
| | | /* 取得优惠活动信息 */ |
| | | $act_id = intval($_POST['act_id']); |
| | | $favourable = favourable_info($act_id); |
| | | if (empty($favourable)) |
| | | { |
| | | //show_message($_LANG['favourable_not_exist']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['favourable_not_exist']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 判断用户能否享受该优惠 */ |
| | | if (!favourable_available($favourable)) |
| | | { |
| | | //show_message($_LANG['favourable_not_available']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['favourable_not_available']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查购物车中是否已有该优惠 */ |
| | | $cart_favourable = cart_favourable(); |
| | | if (favourable_used($favourable, $cart_favourable)) |
| | | { |
| | | //show_message($_LANG['favourable_used']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['favourable_used']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $_POST['gift'] = array_filter(explode(',',$_POST['gift'])); |
| | | |
| | | /* 赠品(特惠品)优惠 */ |
| | | if ($favourable['act_type'] == FAT_GOODS) |
| | | { |
| | | /* 检查是否选择了赠品 */ |
| | | if (empty($_POST['gift'])) |
| | | { |
| | | //show_message($_LANG['pls_select_gift']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['pls_select_gift']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 |
| | | /* 检查是否已在购物车 */ |
| | | $sql = "SELECT goods_name" . |
| | | " FROM " . $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | " AND rec_type = '" . CART_GENERAL_GOODS . "'" . |
| | | " AND is_gift = '$act_id'" . |
| | | " AND goods_id " . db_create_in($_POST['gift']); |
| | | $gift_name = $db->getCol($sql); |
| | | if (!empty($gift_name)) |
| | | { |
| | | //show_message(sprintf($_LANG['gift_in_cart'], join(',', $gift_name))); |
| | | $result['error'] = 1; |
| | | $result['message'] = sprintf($_LANG['gift_in_cart'], join(',', $gift_name)); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查数量是否超过上限 */ |
| | | $count = isset($cart_favourable[$act_id]) ? $cart_favourable[$act_id] : 0; |
| | | if ($favourable['act_type_ext'] > 0 && $count + count($_POST['gift']) > $favourable['act_type_ext']) |
| | | { |
| | | //show_message($_LANG['gift_count_exceed']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['gift_count_exceed']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 添加赠品到购物车 */ |
| | | foreach ($favourable['gift'] as $gift) |
| | | { |
| | | if (in_array($gift['id'], $_POST['gift'])) |
| | | { |
| | | add_gift_to_cart($act_id, $gift['id'], $gift['price']); |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_DISCOUNT) |
| | | { |
| | | add_favourable_to_cart($act_id, $favourable['act_name'], cart_favourable_amount($favourable) * (100 - $favourable['act_type_ext']) / 100); |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_PRICE) |
| | | { |
| | | add_favourable_to_cart($act_id, $favourable['act_name'], $favourable['act_type_ext']); |
| | | } |
| | | |
| | | die($json->encode($result)); |
| | | /* 刷新购物车 */ |
| | | ecs_header("Location: flow.php\n"); |
| | | exit; |
| | | } |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- 删除购物车中的商品 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | elseif ($_REQUEST['step'] == 'drop_goods') |
| | | { |
| | | $result = array('error' => 0, 'message' => '', 'content' => ''); |
| | | $rec_id = intval($_GET['id']); |
| | | flow_drop_cart_goods($rec_id); |
| | | |
| | | die($json->encode($result)); |
| | | ecs_header("Location: flow.php\n"); |
| | | exit; |
| | | } |
| | | |
| | | /* |
| | | * 结算页面 |
| | | */ |
| | | elseif ($_REQUEST['step'] == 'checkout') |
| | | { |
| | | $result = array('error' => 0, 'result' => ''); |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- 订单确认 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | /* |
| | | * 检查用户是否已经登录 |
| | | * 如果没有登录则跳转到登录和注册页面 |
| | | */ |
| | | if ($_SESSION['user_id'] == 0) |
| | | { |
| | | $result['error'] = 2; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | exit; |
| | | } |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | /* 积分兑换商品 */ |
| | | elseif ($flow_type == CART_EXCHANGE_GOODS) |
| | | { |
| | | $smarty->assign('is_exchange_goods', 1); |
| | | } |
| | | else |
| | | { |
| | | //正常购物流程 清空其他购物流程情况 |
| | | $_SESSION['flow_order']['extension_code'] = ''; |
| | | } |
| | | |
| | | if($flow_type != CART_EXCHANGE_GOODS){ |
| | | //非积分兑换形式的商品 |
| | | /* 代码增加_start By */ |
| | | $sel_cartgoods_count = count($_REQUEST['sel_cartgoods']); |
| | | $_SESSION['sel_cartgoods'] = $sel_cartgoods_count>0 ? (implode(",", $_REQUEST['sel_cartgoods'])) : $_SESSION['sel_cartgoods']; |
| | | /* 代码增加_end By */ |
| | | |
| | | //验证购物车中提交过来的商品中参加的活动是否都正常start |
| | | $_REQUEST['sel_goods'] = $_SESSION['sel_cartgoods']; |
| | | $favourable_list = favourable_list($_SESSION['user_rank'],false); |
| | | if($favourable_list){ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | foreach($favourable_list as $fk=>$fv){ |
| | | if(!$fv['available']){ |
| | | $sql = "select count(rec_id) as num from ". $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND is_gift = ".$fv['act_id']; |
| | | if($db->getOne($sql) > 0){ |
| | | $result['error'] = 1; |
| | | $result['result'] = '购物车中参加['.$fv['act_name'].']活动的商品未满足条件,请重新设置或者将其赠品删除'; |
| | | die($json->encode($result)); |
| | | //show_message('购物车中参加['.$fv['act_name'].']活动的商品未满足条件,请重新设置或者将其赠品删除', '', '', 'warning'); |
| | | } |
| | | } |
| | | } |
| | | unset($sql_where); |
| | | } |
| | | |
| | | //验证购物车中提交过来的商品中参加的活动是否都正常end |
| | | } |
| | | |
| | | /* 检查购物车中是否有商品 */ |
| | | /* 代码增加_end By */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | |
| | | $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND parent_id = 0 AND is_gift = 0 AND rec_type = '$flow_type'"; |
| | | |
| | | /* 代码增加_end By */ |
| | | if ($db->getOne($sql) == 0) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | //show_message($_LANG['no_goods_in_cart'], '', '', 'warning'); |
| | | } |
| | | |
| | | /* |
| | | * 检查用户是否已经登录 |
| | | * 如果用户已经登录了则检查是否有默认的收货地址 |
| | | * 如果没有登录则跳转到登录和注册页面 |
| | | */ |
| | | if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0) |
| | | { |
| | | /* 用户没有登录且没有选定匿名购物,转向到登录页面 */ |
| | | $result['error'] = 2; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | |
| | | // ecs_header("Location: flow.php?step=login\n"); |
| | | //exit; |
| | | } |
| | | |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | //$smarty->assign('consignee', $consignee); |
| | | if(!empty($consignee) && $_SESSION['user_id'] > 0){ |
| | | $consignee['address_short_name'] .= get_region_info($consignee['province'])."-"; |
| | | $consignee['address_short_name'] .= get_region_info($consignee['city'])."-"; |
| | | $consignee['address_short_name'] .= get_region_info($consignee['district'])." "; |
| | | $consignee['address_short_name'] .= sub_str($consignee['address'],16); |
| | | $consignee['address_short_name'] .= $consignee['zipcode'] ? (",".$consignee['zipcode']) : ""; |
| | | } |
| | | |
| | | /* 代码增加_start By */ |
| | | $smarty->assign('consignee_list', $consignee); |
| | | $smarty->assign('shop_province_list', get_regions(1, $_CFG['shop_country'])); |
| | | /* 代码增加_end By */ |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | /* |
| | | * 分供货商显示商品 |
| | | */ |
| | | $cart_ids = $cart_goods_new = array(); |
| | | if(count($cart_goods)>0){ |
| | | foreach($cart_goods as $key => $val){ |
| | | $cart_goods_new[$val['supplier_id']]['goodlist'][] = $val; |
| | | $cart_ids[] = $val['rec_id']; |
| | | } |
| | | } |
| | | $_SESSION['sel_cartgoods'] = (isset($_SESSION['sel_cartgoods']) && !empty($_SESSION['sel_cartgoods'])) ? $_SESSION['sel_cartgoods'] : implode(',',$cart_ids);//针对app添加 |
| | | |
| | | if ($flow_type != CART_EXCHANGE_GOODS && $flow_type != CART_GROUP_BUY_GOODS) |
| | | { |
| | | foreach($cart_goods_new as $k => $v){ |
| | | $discount = compute_discount($k); |
| | | if(is_array($discount)){ |
| | | $cart_goods_new[$k]['zhekou']['discount'] = $discount['discount']; |
| | | $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); |
| | | $cart_goods_new[$k]['zhekou']['your_discount'] = sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount'])); |
| | | } |
| | | } |
| | | } |
| | | /* 对是否允许修改购物车赋值 */ |
| | | if ($flow_type != CART_GENERAL_GOODS || $_CFG['one_step_buy'] == '1') |
| | | { |
| | | $smarty->assign('allow_edit_cart', 0); |
| | | } |
| | | else |
| | | { |
| | | $smarty->assign('allow_edit_cart', 1); |
| | | } |
| | | |
| | | /* |
| | | * 取得购物流程设置 |
| | | */ |
| | | $smarty->assign('config', $_CFG); |
| | | /* |
| | | * 取得订单信息 |
| | | */ |
| | | $order = flow_order_info(); |
| | | //file_put_contents('./order.txt',var_export($order,true)); |
| | | $smarty->assign('order', $order); |
| | | |
| | | /* |
| | | * 计算订单的费用 |
| | | */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | |
| | | |
| | | $smarty->assign('total', $total); |
| | | $smarty->assign('shopping_money', sprintf($_LANG['shopping_money'], $total['formated_goods_price'])); |
| | | $smarty->assign('market_price_desc', sprintf($_LANG['than_market_price'], $total['formated_market_price'], $total['formated_saving'], $total['save_rate'])); |
| | | |
| | | |
| | | /* 取得配送列表 */ |
| | | $region = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']); |
| | | $shipping_list = available_shipping_list($region); |
| | | $cart_weight_price = cart_weight_price($flow_type); |
| | | $insure_disabled = true; |
| | | $cod_disabled = true; |
| | | |
| | | // 查看购物车中是否全为免运费商品,若是则把运费赋为零 |
| | | //$sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE `session_id` = '" . SESS_ID. "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0"; |
| | | $sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE $sql_where AND `extension_code` != 'package_buy' AND `is_shipping` = 0"; |
| | | $shipping_count = $db->getOne($sql); |
| | | |
| | | foreach ($shipping_list AS $key => $val) |
| | | { |
| | | $shipping_cfg = unserialize_config($val['configure']); |
| | | $shipping_fee = ($shipping_count == 0 AND $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']), |
| | | $cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']); |
| | | |
| | | $shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false); |
| | | $shipping_list[$key]['shipping_fee'] = $shipping_fee; |
| | | $shipping_list[$key]['free_money'] = price_format($shipping_cfg['free_money'], false); |
| | | $shipping_list[$key]['insure_formated'] = strpos($val['insure'], '%') === false ? |
| | | price_format($val['insure'], false) : $val['insure']; |
| | | |
| | | /* 当前的配送方式是否支持保价 */ |
| | | if ($val['shipping_id'] == $order['shipping_id']) |
| | | { |
| | | $insure_disabled = ($val['insure'] == 0); |
| | | $cod_disabled = ($val['support_cod'] == 0); |
| | | } |
| | | } |
| | | |
| | | $smarty->assign('shipping_list', $shipping_list); |
| | | $smarty->assign('insure_disabled', $insure_disabled); |
| | | $smarty->assign('cod_disabled', $cod_disabled); |
| | | |
| | | /* 取得支付列表 */ |
| | | if ($order['shipping_id'] == 0) |
| | | { |
| | | $cod = true; |
| | | $cod_fee = 0; |
| | | } |
| | | else |
| | | { |
| | | $shipping = shipping_info($order['shipping_id']); |
| | | $cod = $shipping['support_cod']; |
| | | |
| | | if ($cod) |
| | | { |
| | | /* 如果是团购,且保证金大于0,不能使用货到付款 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $group_buy_id = $_SESSION['extension_id']; |
| | | if ($group_buy_id <= 0) |
| | | { |
| | | //show_message('error group_buy_id'); |
| | | $result['error'] = 1; |
| | | $result['result'] = 'error group_buy_id'; |
| | | die($json->encode($result)); |
| | | } |
| | | $group_buy = group_buy_info($group_buy_id); |
| | | if (empty($group_buy)) |
| | | { |
| | | //show_message('group buy not exists: ' . $group_buy_id); |
| | | $result['error'] = 1; |
| | | $result['result'] = 'group buy not exists: ' . $group_buy_id; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | if ($group_buy['deposit'] > 0) |
| | | { |
| | | $cod = false; |
| | | $cod_fee = 0; |
| | | |
| | | /* 赋值保证金 */ |
| | | $smarty->assign('gb_deposit', $group_buy['deposit']); |
| | | } |
| | | } |
| | | |
| | | if ($cod) |
| | | { |
| | | $shipping_area_info = shipping_area_info($order['shipping_id'], $region); |
| | | $cod_fee = $shipping_area_info['pay_fee']; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $cod_fee = 0; |
| | | } |
| | | } |
| | | |
| | | // 给货到付款的手续费加<span id>,以便改变配送的时候动态显示 |
| | | $payment_list = available_payment_list(1, $cod_fee); |
| | | if(isset($payment_list)) |
| | | { |
| | | foreach ($payment_list as $key => $payment) |
| | | { |
| | | if ($payment['is_cod'] == '1') |
| | | { |
| | | $payment_list[$key]['format_pay_fee'] = '<span id="ECS_CODFEE">' . $payment['format_pay_fee'] . '</span>'; |
| | | } |
| | | /* 如果有易宝神州行支付 如果订单金额大于300 则不显示 */ |
| | | if ($payment['pay_code'] == 'yeepayszx' && $total['amount'] > 300) |
| | | { |
| | | unset($payment_list[$key]); |
| | | } |
| | | /* 如果有余额支付 */ |
| | | if ($payment['pay_code'] == 'balance') |
| | | { |
| | | /* 如果未登录,不显示 */ |
| | | if ($_SESSION['user_id'] == 0) |
| | | { |
| | | unset($payment_list[$key]); |
| | | } |
| | | else |
| | | { |
| | | if ($_SESSION['flow_order']['pay_id'] == $payment['pay_id']) |
| | | { |
| | | $smarty->assign('disable_surplus', 1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | $smarty->assign('payment_list', $payment_list); |
| | | |
| | | |
| | | $user_info = user_info($_SESSION['user_id']); |
| | | |
| | | |
| | | /* 如果使用余额,取得用户余额 */ |
| | | if ((!isset($_CFG['use_surplus']) || $_CFG['use_surplus'] == '1') |
| | | && $_SESSION['user_id'] > 0 |
| | | && $user_info['user_money'] > 0) |
| | | { |
| | | // 能使用余额 |
| | | $smarty->assign('allow_use_surplus', 1); |
| | | $smarty->assign('your_surplus', $user_info['user_money']); |
| | | } |
| | | |
| | | /* 如果使用积分,取得用户可用积分及本订单最多可以使用的积分 */ |
| | | if ((!isset($_CFG['use_integral']) || $_CFG['use_integral'] == '1') |
| | | && $_SESSION['user_id'] > 0 |
| | | && $user_info['pay_points'] > 0 |
| | | && ($flow_type != CART_GROUP_BUY_GOODS && $flow_type != CART_EXCHANGE_GOODS)) |
| | | { |
| | | // 能使用积分 |
| | | $keyong = flow_available_points();// 可用积分 |
| | | foreach($keyong as $k=>$v){ |
| | | $cart_goods_new[$k]['jifen'] = $v; |
| | | } |
| | | |
| | | $smarty->assign('allow_use_integral', 1); |
| | | //$smarty->assign('order_max_integral', $keyong); |
| | | $smarty->assign('your_integral', $user_info['pay_points']); // 用户积分 |
| | | } |
| | | |
| | | /* 如果使用红包,取得用户可以使用的红包及用户选择的红包 */ |
| | | if ((!isset($_CFG['use_bonus']) || $_CFG['use_bonus'] == '1') |
| | | && ($flow_type != CART_GROUP_BUY_GOODS && $flow_type != CART_EXCHANGE_GOODS)) |
| | | { |
| | | // 取得用户可用红包 |
| | | $user_bonus = user_bonus($_SESSION['user_id'], $total['goods_price']); |
| | | if (!empty($user_bonus)) |
| | | { |
| | | foreach ($user_bonus AS $key => $val) |
| | | { |
| | | $user_bonus[$key]['bonus_money_formated'] = price_format($val['type_money'], false); |
| | | if(isset($cart_goods_new[$val['supplier_id']])){ |
| | | $cart_goods_new[$val['supplier_id']]['redbag'][] = $user_bonus[$key]; |
| | | } |
| | | } |
| | | //file_put_contents('./goodslist.txt',var_export($cart_goods_new,true)); |
| | | |
| | | $smarty->assign('bonus_list', $user_bonus); |
| | | } |
| | | |
| | | // 能使用红包 |
| | | $smarty->assign('allow_use_bonus', 1); |
| | | } |
| | | //jx 添加发票插件 |
| | | /* 如果能开发票,取得发票内容列表 */ |
| | | if ((!isset($_CFG['can_invoice']) || $_CFG['can_invoice'] == '1') |
| | | && isset($_CFG['invoice_content']) |
| | | && trim($_CFG['invoice_content']) != '' && $flow_type != CART_EXCHANGE_GOODS) |
| | | { |
| | | $inv_content_list = explode("\n", str_replace("\r", '', $_CFG['invoice_content'])); |
| | | $smarty->assign('inv_content_list', $inv_content_list); |
| | | |
| | | $inv_type_list = array(); |
| | | foreach ($_CFG['invoice_type']['type'] as $key => $type) |
| | | { |
| | | /*增值税发票_更改_START_*/ |
| | | if (!empty($type)&&$_CFG['invoice_type']['enable'][$key]=='1') |
| | | { |
| | | $inv_type_list[$type] = $_LANG[$type] . ' [' . floatval($_CFG['invoice_type']['rate'][$key]) . '%]'; |
| | | } |
| | | /*增值税发票_更改_START_*/ |
| | | } |
| | | $smarty->assign('inv_type_list', $inv_type_list); |
| | | $smarty->assign('province_list', get_regions(1, $_CFG['shop_country'])); |
| | | } |
| | | //jx 结束 |
| | | $smarty->assign('goods_list', $cart_goods_new); |
| | | |
| | | /* 如果使用缺货处理,取得缺货处理列表 */ |
| | | if (!isset($_CFG['use_how_oos']) || $_CFG['use_how_oos'] == '1') |
| | | { |
| | | if (is_array($GLOBALS['_LANG']['oos']) && !empty($GLOBALS['_LANG']['oos'])) |
| | | { |
| | | $smarty->assign('how_oos_list', $GLOBALS['_LANG']['oos']); |
| | | } |
| | | } |
| | | |
| | | /* 保存 session */ |
| | | $_SESSION['flow_order'] = $order; |
| | | |
| | | |
| | | $res['result'] = $smarty->fetch("checkout_app.lbi"); |
| | | $res['shipping_id'] = intval($order['shipping_id']); |
| | | die($json->encode($res)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'select_shipping') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变配送方式 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => 0,'message'=>'', 'content' => '', 'need_insure' => 0); |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $order['shipping_id'] = intval($_REQUEST['shipping']); |
| | | $regions = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']); |
| | | $shipping_info = shipping_area_info($order['shipping_id'], $regions); |
| | | |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 取得可以得到的积分和红包 */ |
| | | $smarty->assign('total_integral', cart_amount(false, $flow_type) - $total['bonus'] - $total['integral_money']); |
| | | $smarty->assign('total_bonus', price_format(get_total_bonus(), false)); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['cod_fee'] = $shipping_info['pay_fee']; |
| | | $result['support_cod'] = $shipping_info['support_cod']; |
| | | if (strpos($result['cod_fee'], '%') === false) |
| | | { |
| | | $result['cod_fee'] = price_format($result['cod_fee'], false); |
| | | } |
| | | |
| | | $result['need_insure'] = ($shipping_info['insure'] > 0) ? 1 : 0; |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | |
| | | /* 代码增加_start By */ |
| | | $result['supplier_shipping'] = $smarty->fetch('app/order_supplier_shipping_app.lbi'); |
| | | /* 代码增加_end By */ |
| | | $result['pickup_content'] = ''; |
| | | if(intval($_REQUEST['pickup']) > 0){//目前没有此功能app端 |
| | | $sql = 'select * from ' . $ecs->table('pickup_point') . |
| | | ' where city_id=' . $consignee['city']; |
| | | $pickup_point_list = $db->getAll($sql); |
| | | $smarty->assign('pickup_point_list', $pickup_point_list); |
| | | $result['pickup_content'] = $smarty->fetch('library/pickup.lbi'); |
| | | } |
| | | } |
| | | |
| | | echo $json->encode($result); |
| | | exit; |
| | | } |
| | | |
| | | |
| | | elseif ($_REQUEST['step'] == 'select_insure') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 选定/取消配送的保价 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $_GET['insure'] = !empty($_GET['insure']) ? urldecode($_GET['insure']) : ''; |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $order['need_insure'] = intval($_REQUEST['insure']); |
| | | |
| | | |
| | | } |
| | | /* 保存 session */ |
| | | |
| | | |
| | | $_SESSION['flow_order'] = $order; |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | |
| | | die($json->encode($result)); |
| | | }elseif ($_REQUEST['step'] == 'change_needinv') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变发票的设置 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => '', 'content' => ''); |
| | | $json = new JSON(); |
| | | $_GET['inv_type'] = !empty($_GET['inv_type']) ? json_str_iconv(urldecode($_GET['inv_type'])) : ''; |
| | | $_GET['invPayee'] = !empty($_GET['invPayee']) ? json_str_iconv(urldecode($_GET['invPayee'])) : ''; |
| | | $_GET['inv_content'] = !empty($_GET['inv_content']) ? json_str_iconv(urldecode($_GET['inv_content'])) : ''; |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | if (isset($_GET['need_inv']) && intval($_GET['need_inv']) == 1) |
| | | { |
| | | $order['need_inv'] = 1; |
| | | $order['inv_type'] = trim(stripslashes($_GET['inv_type'])); |
| | | $order['inv_payee'] = trim(stripslashes($_GET['inv_payee'])); |
| | | $order['inv_content'] = trim(stripslashes($_GET['inv_content'])); |
| | | } |
| | | else |
| | | { |
| | | $order['need_inv'] = 0; |
| | | $order['inv_type'] = ''; |
| | | $order['inv_payee'] = ''; |
| | | $order['inv_content'] = ''; |
| | | } |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'select_payment') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变支付方式 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => '', 'content' => '', 'need_insure' => 0, 'payment' => 1); |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $order['pay_id'] = intval($_REQUEST['payment']); |
| | | $payment_info = payment_info($order['pay_id']); |
| | | $result['pay_code'] = $payment_info['pay_code']; |
| | | |
| | | /* 保存 session */ |
| | | $_SESSION['flow_order'] = $order; |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 取得可以得到的积分和红包 */ |
| | | $smarty->assign('total_integral', cart_amount(false, $flow_type) - $total['bonus'] - $total['integral_money']); |
| | | $smarty->assign('total_bonus', price_format(get_total_bonus(), false)); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('library/order_total_app.lbi'); |
| | | } |
| | | |
| | | echo $json->encode($result); |
| | | exit; |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'change_bonus') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变红包 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $bonus = bonus_info(intval($_GET['bonus'])); |
| | | |
| | | if ((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id'] && $bonus['supplier_id'] == $suppid) || intval($_GET['bonus']) == 0) |
| | | { |
| | | $bonus_info = (isset($order['bonus_id_info'])) ? $order['bonus_id_info'] : array(); |
| | | if(intval($_GET['bonus']) == 0){ |
| | | unset($bonus_info[$suppid]); |
| | | }else{ |
| | | $bonus_info[$suppid] = $_GET['bonus']; |
| | | } |
| | | $order['bonus_id_info'] = $bonus_info = array_filter($bonus_info); |
| | | $order['bonus_id'] = implode(',',$bonus_info);//intval($_GET['bonus']); |
| | | |
| | | $bonus_sn_info = (isset($order['bonus_sn_info'])) ? $order['bonus_sn_info'] : array(); |
| | | unset($bonus_sn_info[$suppid]); |
| | | $order['bonus_sn_info'] = $bonus_sn_info = array_filter($bonus_sn_info); |
| | | $order['bonus_sn'] = implode(',',$bonus_sn_info); |
| | | } |
| | | else |
| | | { |
| | | $order['bonus_id'] = 0; |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['invalid_bonus']; |
| | | } |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 验证红包序列号 */ |
| | | elseif ($_REQUEST['step'] == 'validate_bonus') |
| | | { |
| | | |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | |
| | | $bonus_sn = intval($_REQUEST['bonus_sn']); |
| | | if (is_numeric($bonus_sn) && $bonus_sn>0) |
| | | { |
| | | $bonus = bonus_info(0, $bonus_sn, $suppid); |
| | | } |
| | | else |
| | | { |
| | | $bonus = array(); |
| | | } |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | $bonus_info = (isset($order['bonus_sn_info'])) ? $order['bonus_sn_info'] : array(); |
| | | $bonus_id_info = (isset($order['bonus_id_info'])) ? $order['bonus_id_info'] : array(); |
| | | |
| | | |
| | | if (((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id']) || ($bonus['type_money'] > 0 && empty($bonus['user_id']))) && $bonus['supplier_id'] == $suppid && $bonus['order_id'] <= 0) |
| | | { |
| | | |
| | | //$order['bonus_kill'] = $bonus['type_money']; |
| | | $now = gmtime(); |
| | | if ($now > $bonus['use_end_date']) |
| | | { |
| | | |
| | | $order['bonus_sn'] = ''; |
| | | //$order['bonus_sn'] = implode(',',$bonus_info);//$bonus_sn; |
| | | $result['error'] = 1; |
| | | $result['message']=$_LANG['bonus_use_expire']; |
| | | } |
| | | else |
| | | { |
| | | $bonus_info[$suppid] = $bonus_sn; |
| | | $order['bonus_sn_info'] = $bonus_info = array_filter($bonus_info); |
| | | $order['bonus_sn'] = implode(',',$bonus_info);//$bonus_sn; |
| | | unset($bonus_id_info[$suppid]); |
| | | $order['bonus_id_info'] = $bonus_id_info = array_filter($bonus_id_info); |
| | | $order['bonus_id'] = implode(',',$bonus_id_info); |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | |
| | | if($total['goods_price']<$bonus['min_goods_amount']) |
| | | { |
| | | $order['bonus_id'] = ''; |
| | | /* 重新计算订单 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $result['error'] = 1; |
| | | $result['message'] = sprintf($_LANG['bonus_min_amount_error'], price_format($bonus['min_goods_amount'], false)); |
| | | } |
| | | |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $order['bonus_sn'] = '';//$bonus_sn; |
| | | $result['error'] = 1; |
| | | $result['message']=$_LANG['bonus_not_exist']; |
| | | } |
| | | //echo "<pre>"; |
| | | //print_r($order); |
| | | |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'change_integral') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变积分 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $points = floatval($_GET['points']); |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | $user_info = user_info($_SESSION['user_id']); |
| | | |
| | | |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $integral_info = (isset($order['integral_info'])) ? $order['integral_info'] : array(); |
| | | $integral_info[$suppid] = $points; |
| | | |
| | | $order['integral_info'] = $integral_info; |
| | | |
| | | $flow_points = flow_available_points(); // 该订单允许使用的积分 |
| | | $user_points = $user_info['pay_points']; // 用户的积分总数 |
| | | |
| | | //所有订单的总积分 |
| | | $points_all = array_sum($integral_info); |
| | | |
| | | if ($points_all > $user_points) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['integral_not_enough']; |
| | | } |
| | | elseif ($points > $flow_points[$suppid]) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = sprintf($_LANG['integral_too_much'], $flow_points[$suppid]); |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | $order['integral'] = $points_all; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'change_surplus') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变余额 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $surplus = floatval($_GET['surplus']); |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | $user_info = user_info($_SESSION['user_id']); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | $surplus_info = (isset($order['surplus_info'])) ? $order['surplus_info'] : array(); |
| | | $surplus_info[$suppid] = $surplus; |
| | | |
| | | if ($user_info['user_money'] + $user_info['credit_line'] < array_sum($surplus_info)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['surplus_not_enough']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | $order['surplus_info'] = $surplus_info; |
| | | $order['surplus'] = array_sum($surplus_info);//$surplus; |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'done') |
| | | { |
| | | |
| | | $suppids = explode(',',$_POST['suppids']); |
| | | if(isset($_POST['bonus'])){ |
| | | $_POST['bonus'] = array_combine($suppids, explode(',',$_POST['bonus'])); |
| | | } |
| | | if(isset($_POST['bonus_sn'])){ |
| | | $_POST['bonus_sn'] = array_combine($suppids, explode(',',$_POST['bonus_sn'])); |
| | | } |
| | | if(isset($_POST['integral'])){ |
| | | $_POST['integral'] = array_combine($suppids, explode(',',$_POST['integral'])); |
| | | } |
| | | if(isset($_POST['surplus'])){ |
| | | $_POST['surplus'] = array_combine($suppids, explode(',',$_POST['surplus'])); |
| | | } |
| | | include_once('../includes/lib_clips.php'); |
| | | include_once('../includes/lib_payment.php'); |
| | | |
| | | $result = array('error'=>0,'result'=>''); |
| | | /* 代码增加_start By */ |
| | | $id_ext =""; |
| | | if ($_SESSION['sel_cartgoods']) |
| | | { |
| | | $id_ext = " AND rec_id in (". $_SESSION['sel_cartgoods'] .") "; |
| | | } |
| | | /* 代码增加_end By */ |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 代码增加_end By */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | |
| | | |
| | | /* 检查购物车中是否有商品 */ |
| | | $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND parent_id = 0 AND is_gift = 0 AND rec_type = '$flow_type'"; |
| | | /* 代码增加_end By */ |
| | | if ($db->getOne($sql) == 0) |
| | | { |
| | | //show_message($_LANG['no_goods_in_cart'], '', '', 'warning'); |
| | | $result['error'] = 11; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查商品库存 */ |
| | | /* 如果使用库存,且下订单时减库存,则减少库存 */ |
| | | if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) |
| | | { |
| | | $cart_goods_stock = get_cart_goods(); |
| | | $_cart_goods_stock = array(); |
| | | foreach ($cart_goods_stock['goods_list'] as $value) |
| | | { |
| | | $_cart_goods_stock[$value['rec_id']] = $value['goods_number']; |
| | | } |
| | | flow_cart_stock($_cart_goods_stock); |
| | | unset($cart_goods_stock, $_cart_goods_stock); |
| | | } |
| | | |
| | | /* |
| | | * 检查用户是否已经登录 |
| | | * 如果用户已经登录了则检查是否有默认的收货地址 |
| | | * 如果没有登录则跳转到登录和注册页面 |
| | | */ |
| | | if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0) |
| | | { |
| | | $result['error'] = 2; |
| | | $result['result'] = '请先登陆!'; |
| | | die($json->encode($result)); |
| | | /* 用户没有登录且没有选定匿名购物,转向到登录页面 */ |
| | | ecs_header("Location: flow.php?step=login\n"); |
| | | exit; |
| | | } |
| | | |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 检查收货人信息是否完整 */ |
| | | if (!check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | /* 如果不完整则转向到收货人信息填写界面 */ |
| | | $result['error'] = 3; |
| | | $result['result'] = '请先设置收货地址'; |
| | | die($json->encode($result)); |
| | | ecs_header("Location: flow.php?step=consignee\n"); |
| | | exit; |
| | | } |
| | | |
| | | /* 订单中的商品 */ |
| | | $cart_goods = cart_goods($flow_type); |
| | | |
| | | $cart_goods_new = array(); |
| | | if(count($cart_goods)>0){ |
| | | foreach($cart_goods as $key => $val){ |
| | | $cart_goods_new[$val['supplier_id']]['goodlist'][$val['rec_id']] = $val; |
| | | $cart_goods_new[$val['supplier_id']]['referer'] = $val['seller']; |
| | | } |
| | | } |
| | | //echo "<pre>"; |
| | | //print_r($cart_goods); |
| | | //print_r($cart_goods_new); |
| | | |
| | | if (empty($cart_goods)) |
| | | { |
| | | //show_message($_LANG['no_goods_in_cart'], $_LANG['back_home'], './', 'warning'); |
| | | $result['error'] = 21; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查商品总额是否达到最低限购金额 */ |
| | | if ($flow_type == CART_GENERAL_GOODS && cart_amount(true, CART_GENERAL_GOODS) < $_CFG['min_goods_amount']) |
| | | { |
| | | //show_message(sprintf($_LANG['goods_amount_not_enough'], price_format($_CFG['min_goods_amount'], false))); |
| | | $result['error'] = 31; |
| | | $result['result'] = sprintf($_LANG['goods_amount_not_enough'], price_format($_CFG['min_goods_amount'], false)); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | |
| | | //此订单拆分订单后的订单信息 |
| | | $order_info = array(); |
| | | //组装拆分的子订单数组信息start |
| | | foreach ($cart_goods_new as $ckey=>$cval){ |
| | | |
| | | $cart_goods = $cval['goodlist']; |
| | | |
| | | $_POST['how_oos'] = isset($_POST['how_oos']) ? intval($_POST['how_oos']) : 0; |
| | | $_POST['card_message'] = isset($_POST['card_message']) ? compile_str($_POST['card_message']) : ''; |
| | | $_POST['inv_type'] = !empty($_POST['inv_type']) ? compile_str($_POST['inv_type']) : ''; |
| | | $_POST['inv_payee'] = isset($_POST['inv_payee']) ? compile_str($_POST['inv_payee']) : ''; |
| | | $_POST['inv_content'] = isset($_POST['inv_content']) ? compile_str($_POST['inv_content']) : ''; |
| | | $_POST['postscript'] = isset($_POST['postscript']) ? compile_str($_POST['postscript']) : ''; |
| | | |
| | | $order_integral = isset($_POST['integral']) ? $_POST['integral'] : array(); |
| | | $order_bonus_id = isset($_POST['bonus']) ? $_POST['bonus'] : array(); |
| | | $order_bonus_sn = isset($_POST['bonus_sn']) ? $_POST['bonus_sn'] : array(); |
| | | $order_surplus = isset($_POST['surplus']) ? $_POST['surplus'] : array(); |
| | | |
| | | $_POST['vat_invoice'] = isset($_POST['vat_invoice']) ? compile_str($_POST['vat_invoice']) : ''; |
| | | $_POST['normal_invoice'] = isset($_POST['normal_invoice']) ? compile_str($_POST['normal_invoice']) : ''; |
| | | //$_POST['danwei'] = isset($_POST['danwei']) ? compile_str($_POST['danwei']) : ''; |
| | | |
| | | $order = array( |
| | | 'shipping_id' => intval($_POST['shipping']), |
| | | 'pay_id' => intval($_POST['payment']), |
| | | 'pack_id' => isset($_POST['pack']) ? intval($_POST['pack']) : 0, |
| | | 'card_id' => isset($_POST['card']) ? intval($_POST['card']) : 0, |
| | | 'card_message' => trim($_POST['card_message']), |
| | | 'surplus' => isset($order_surplus[$ckey]) ? floatval($order_surplus[$ckey]) : 0.00, |
| | | 'integral' => isset($order_integral[$ckey]) ? intval($order_integral[$ckey]) : 0, |
| | | 'bonus_id' => isset($order_bonus_id[$ckey]) ? intval($order_bonus_id[$ckey]) : 0, |
| | | 'need_inv' => empty($_POST['need_inv']) ? 0 : 1, |
| | | //'inv_type' => $_POST['inv_type'], |
| | | // 'inv_payee' => trim($_POST['inv_payee']), |
| | | //s 'inv_content' => $_POST['inv_content'], |
| | | 'postscript' => trim($_POST['postscript']), |
| | | 'how_oos' => isset($_LANG['oos'][$_POST['how_oos']]) ? addslashes($_LANG['oos'][$_POST['how_oos']]) : '', |
| | | 'need_insure' => isset($_POST['need_insure']) ? intval($_POST['need_insure']) : 0, |
| | | 'user_id' => $_SESSION['user_id'], |
| | | 'add_time' => gmtime(), |
| | | 'order_status' => OS_UNCONFIRMED, |
| | | 'shipping_status' => SS_UNSHIPPED, |
| | | 'pay_status' => PS_UNPAYED, |
| | | 'agency_id' => get_agency_by_regions(array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district'])), |
| | | 'supplier_id' => $ckey, |
| | | 'need_inv' => 1,//empty($_POST['need_inv']) ? 0 : 1,// jx 发票是否开启 |
| | | //'inv_type' => isset($_POST['normal_invoice']) ? intval($_POST['vat_invoice']) : , |
| | | 'inv_content' => $_POST['cont'], |
| | | 'vat_inv_company_name' => $_POST['vat_inv_company_name'], |
| | | 'vat_inv_taxpayer_id' => $_POST['vat_inv_taxpayer_id'], |
| | | 'vat_inv_registration_address' => $_POST['vat_inv_registration_address'], |
| | | 'vat_inv_registration_phone' => $_POST['vat_inv_registration_phone'], |
| | | 'vat_inv_deposit_bank' => $_POST['vat_inv_deposit_bank'], |
| | | 'vat_inv_bank_account' => $_POST['vat_inv_bank_account'], |
| | | 'inv_consignee_name' => $_POST['inv_consignee_name'], |
| | | 'inv_consignee_phone' => $_POST['inv_consignee_phone'], |
| | | 'inv_consignee_country ' => '1', |
| | | 'inv_consignee_province' => $_POST['inv_consignee_province'], |
| | | 'inv_consignee_city' => $_POST['selCities'], |
| | | 'inv_consignee_district' => $_POST['selDistricts'], |
| | | 'inv_consignee_address' => $_POST['inv_consignee_address'] |
| | | ); |
| | | if($_POST['normal_invoice']) |
| | | { |
| | | $order['inv_type'] = $_POST['normal_invoice']; |
| | | if($_POST['danwei']) |
| | | { |
| | | $order['inv_payee'] = $_POST['danwei']; |
| | | }else |
| | | { |
| | | $order['inv_payee'] = '个人'; |
| | | } |
| | | $order['inv_payee_type'] = $_POST['oadio']; |
| | | $order['inv_payee_type'] = 'individual'; |
| | | |
| | | }else |
| | | { |
| | | $order['inv_type'] = $_POST['vat_invoice']; |
| | | } |
| | | |
| | | |
| | | /* 扩展信息 */ |
| | | if (isset($_SESSION['flow_type']) && intval($_SESSION['flow_type']) != CART_GENERAL_GOODS) |
| | | { |
| | | $order['extension_code'] = $_SESSION['extension_code']; |
| | | $order['extension_id'] = $_SESSION['extension_id']; |
| | | } |
| | | else |
| | | { |
| | | $order['extension_code'] = ''; |
| | | $order['extension_id'] = 0; |
| | | } |
| | | |
| | | /* 检查积分余额是否合法 */ |
| | | $user_id = $_SESSION['user_id']; |
| | | if ($user_id > 0) |
| | | { |
| | | $user_info = user_info($user_id); |
| | | |
| | | $order['surplus'] = min($order['surplus'], $user_info['user_money'] + $user_info['credit_line']); |
| | | if ($order['surplus'] < 0) |
| | | { |
| | | $order['surplus'] = 0; |
| | | } |
| | | |
| | | // 查询用户有多少积分 |
| | | $flow_points = flow_available_points(); // 该订单允许使用的积分 |
| | | $user_points = $user_info['pay_points']; // 用户的积分总数 |
| | | |
| | | $order['integral'] = min($order['integral'], $user_points, $flow_points[$ckey]); |
| | | if ($order['integral'] < 0) |
| | | { |
| | | $order['integral'] = 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $order['surplus'] = 0; |
| | | $order['integral'] = 0; |
| | | } |
| | | |
| | | /* 检查红包是否存在 */ |
| | | if ($order['bonus_id'] > 0) |
| | | { |
| | | $bonus = bonus_info($order['bonus_id']); |
| | | |
| | | if (empty($bonus) || $bonus['user_id'] != $user_id || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount_new(array_keys($cart_goods),true, $flow_type)) |
| | | { |
| | | $order['bonus_id'] = 0; |
| | | }else{ |
| | | |
| | | } |
| | | } |
| | | elseif (isset($_POST['bonus_sn'][$ckey])) |
| | | { |
| | | $bonus_sn = intval($_POST['bonus_sn'][$ckey]); |
| | | $bonus = bonus_info(0, $bonus_sn); |
| | | $now = gmtime(); |
| | | if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount_new(array_keys($cart_goods),true, $flow_type) || $now > $bonus['use_end_date']) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | if ($user_id > 0) |
| | | { |
| | | $sql = "UPDATE " . $ecs->table('user_bonus') . " SET user_id = '$user_id' WHERE bonus_id = '$bonus[bonus_id]' LIMIT 1"; |
| | | $db->query($sql); |
| | | } |
| | | $order['bonus_id'] = '';//$bonus['bonus_id']; |
| | | $order['bonus_sn'] = $bonus_sn; |
| | | } |
| | | } |
| | | |
| | | /* 判断是不是实体商品 */ |
| | | foreach ($cart_goods AS $val) |
| | | { |
| | | /* 统计实体商品的个数 */ |
| | | if ($val['is_real']) |
| | | { |
| | | $is_real_good=1; |
| | | } |
| | | } |
| | | if(isset($is_real_good)) |
| | | { |
| | | $sql="SELECT shipping_id FROM " . $ecs->table('shipping') . " WHERE shipping_id=".$order['shipping_id'] ." AND enabled =1"; |
| | | if(!$db->getOne($sql)) |
| | | { |
| | | show_message($_LANG['flow_no_shipping']); |
| | | } |
| | | } |
| | | |
| | | /* 收货人信息 */ |
| | | foreach ($consignee as $key => $value) |
| | | { |
| | | $order[$key] = addslashes($value); |
| | | } |
| | | |
| | | /* 代码增加_start By */ |
| | | $order['best_time'] = isset($_POST['best_time']) ? trim($_POST['best_time']) : ''; |
| | | /* 代码增加_end By */ |
| | | |
| | | |
| | | /* 订单中的总额 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | |
| | | $order['bonus'] = $total['bonus']; |
| | | $order['goods_amount'] = $total['goods_price']; |
| | | $order['discount'] = $total['discount']; |
| | | $order['surplus'] = $total['surplus']; |
| | | $order['tax'] = $total['tax']; |
| | | |
| | | // 购物车中的商品能享受红包支付的总额 |
| | | $discount_amout = compute_discount_amount($ckey); |
| | | // 红包和积分最多能支付的金额为商品总额 |
| | | $temp_amout = $order['goods_amount'] - $discount_amout; |
| | | if ($temp_amout <= 0) |
| | | { |
| | | $order['bonus_id'] = 0; |
| | | } |
| | | |
| | | /* 配送方式 */ |
| | | if ($order['shipping_id'] > 0) |
| | | { |
| | | $shipping = shipping_info($order['shipping_id']); |
| | | $order['shipping_name'] = addslashes($shipping['shipping_name']); |
| | | } |
| | | $order['shipping_fee'] = $total['shipping_fee']; |
| | | $order['insure_fee'] = $total['shipping_insure']; |
| | | |
| | | /* 支付方式 */ |
| | | if ($order['pay_id'] > 0) |
| | | { |
| | | $payment = payment_info($order['pay_id']); |
| | | $order['pay_name'] = addslashes($payment['pay_name']); |
| | | } |
| | | $order['pay_fee'] = $total['pay_fee']; |
| | | $order['cod_fee'] = $total['cod_fee']; |
| | | |
| | | /* 商品包装 */ |
| | | if ($order['pack_id'] > 0) |
| | | { |
| | | $pack = pack_info($order['pack_id']); |
| | | $order['pack_name'] = addslashes($pack['pack_name']); |
| | | } |
| | | $order['pack_fee'] = $total['pack_fee']; |
| | | |
| | | /* 祝福贺卡 */ |
| | | if ($order['card_id'] > 0) |
| | | { |
| | | $card = card_info($order['card_id']); |
| | | $order['card_name'] = addslashes($card['card_name']); |
| | | } |
| | | $order['card_fee'] = $total['card_fee']; |
| | | |
| | | $order['order_amount'] = number_format($total['amount'], 2, '.', ''); |
| | | /*发票金额*/ |
| | | $order['inv_money'] = $order['order_amount'] ; |
| | | /*增值税发票_添加_END_*/ |
| | | /* 如果全部使用余额支付,检查余额是否足够 */ |
| | | if ($payment['pay_code'] == 'balance' && $order['order_amount'] > 0) |
| | | { |
| | | if($order['surplus'] >0) //余额支付里如果输入了一个金额 |
| | | { |
| | | $order['order_amount'] = $order['order_amount'] + $order['surplus']; |
| | | $order['surplus'] = 0; |
| | | } |
| | | if ($order['order_amount'] > ($user_info['user_money'] + $user_info['credit_line'])) |
| | | { |
| | | //show_message($_LANG['balance_not_enough']); |
| | | $result['error'] = 41; |
| | | $result['result'] = $_LANG['balance_not_enough']; |
| | | die($json->encode($result)); |
| | | } |
| | | else |
| | | { |
| | | $order['surplus'] = $order['order_amount']; |
| | | $order['order_amount'] = 0; |
| | | } |
| | | } |
| | | |
| | | /* 如果订单金额为0(使用余额或积分或红包支付),修改订单状态为已确认、已付款 */ |
| | | if ($order['order_amount'] <= 0) |
| | | { |
| | | $order['order_status'] = OS_CONFIRMED; |
| | | $order['confirm_time'] = gmtime(); |
| | | $order['pay_status'] = PS_PAYED; |
| | | $order['pay_time'] = gmtime(); |
| | | $order['order_amount'] = 0; |
| | | } |
| | | |
| | | $order['integral_money'] = $total['integral_money']; |
| | | $order['integral'] = $total['integral']; |
| | | |
| | | if ($order['extension_code'] == 'exchange_goods') |
| | | { |
| | | $order['integral_money'] = 0; |
| | | $order['integral'] = $total['exchange_integral']; |
| | | } |
| | | |
| | | $order['from_ad'] = !empty($_SESSION['from_ad']) ? $_SESSION['from_ad'] : '0'; |
| | | //$order['referer'] = !empty($_SESSION['referer']) ? addslashes($_SESSION['referer']) : ''; |
| | | $order['referer'] = $cval['referer']; |
| | | |
| | | /* 记录扩展信息 */ |
| | | if ($flow_type != CART_GENERAL_GOODS) |
| | | { |
| | | $order['extension_code'] = $_SESSION['extension_code']; |
| | | $order['extension_id'] = $_SESSION['extension_id']; |
| | | } |
| | | |
| | | $affiliate = unserialize($_CFG['affiliate']); |
| | | if(isset($affiliate['on']) && $affiliate['on'] == 1 && $affiliate['config']['separate_by'] == 1) |
| | | { |
| | | //推荐订单分成 |
| | | $parent_id = get_affiliate(); |
| | | if($user_id == $parent_id) |
| | | { |
| | | $parent_id = 0; |
| | | } |
| | | } |
| | | elseif(isset($affiliate['on']) && $affiliate['on'] == 1 && $affiliate['config']['separate_by'] == 0) |
| | | { |
| | | //推荐注册分成 |
| | | $parent_id = 0; |
| | | } |
| | | else |
| | | { |
| | | //分成功能关闭 |
| | | $parent_id = 0; |
| | | } |
| | | $order['parent_id'] = $parent_id; |
| | | |
| | | /* 代码增加_start By */ |
| | | /* 自提功能 |
| | | 获取订单确认页选择的自提点 |
| | | */ |
| | | $pickup_point = isset($_POST['pickup_point']) ? $_POST['pickup_point'] : 0; |
| | | if($pickup_point > 0) |
| | | $order['is_pickup'] = 1; |
| | | else |
| | | $order['is_pickup'] = 0; |
| | | $order['pickup_point'] = $pickup_point; |
| | | /* 代码增加_end By */ |
| | | //$order['order_sn'] = get_order_sn(); |
| | | |
| | | if(count($order)>0){ |
| | | $order_info[$ckey] = $order; |
| | | } |
| | | unset($order); |
| | | } |
| | | //组装拆分的子订单数组信息end |
| | | |
| | | |
| | | //判断是否拆分为多个订单,多个订单就生成父订单id号 |
| | | $del_patent_id = 0; |
| | | if(count($order_info)>1){ |
| | | $error_no = 0; |
| | | do |
| | | { |
| | | $save['order_sn'] = get_order_sn(); //获取新订单号 |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), $save, 'INSERT'); |
| | | $error_no = $GLOBALS['db']->errno(); |
| | | |
| | | if ($error_no > 0 && $error_no != 1062) |
| | | { |
| | | die($GLOBALS['db']->errorMsg()); |
| | | } |
| | | } |
| | | while ($error_no == 1062); //如果是订单号重复则重新提交数据 |
| | | $del_patent_id = $parent_order_id = $db->insert_id(); |
| | | }else{ |
| | | $parent_order_id = 0; |
| | | } |
| | | |
| | | $all_order_amount = 0;//记录订单所需支付的总金额 |
| | | //用来展示用的数组数据 |
| | | $split_order = array(); |
| | | $split_order['sub_order_count'] = count($order_info); |
| | | //生成订单 |
| | | foreach($order_info as $ok=>$order){ |
| | | |
| | | $cart_goods = $cart_goods_new[$ok]['goodlist']; |
| | | |
| | | if($cart_goods){ |
| | | $id_ext_new = " AND rec_id in (". implode(',',array_keys($cart_goods)) .") "; |
| | | } |
| | | |
| | | //获取佣金id |
| | | $order['rebate_id'] = get_order_rebate($ok); |
| | | |
| | | //下单来源 |
| | | $order['froms'] = 'app'; |
| | | |
| | | $order['parent_order_id'] = $parent_order_id; |
| | | /* 插入订单表 */ |
| | | $error_no = 0; |
| | | do |
| | | { |
| | | $order['order_sn'] = get_order_sn(); //获取新订单号 |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), $order, 'INSERT'); |
| | | |
| | | $error_no = $GLOBALS['db']->errno(); |
| | | |
| | | if ($error_no > 0 && $error_no != 1062) |
| | | { |
| | | die($GLOBALS['db']->errorMsg()); |
| | | } |
| | | } |
| | | while ($error_no == 1062); //如果是订单号重复则重新提交数据 |
| | | |
| | | $new_order_id = $db->insert_id(); |
| | | $order['order_id'] = $new_order_id; |
| | | |
| | | $parent_order_id = ($parent_order_id>0) ? $parent_order_id : $new_order_id; |
| | | |
| | | /* 插入订单商品 下面这个SQL有修改 by 注意末尾那个字段 */ |
| | | /* 代码增加_start By */ |
| | | $sql = "INSERT INTO " . $ecs->table('order_goods') . "( " . |
| | | "order_id, goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ". |
| | | "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id, package_attr_id) ". |
| | | " SELECT '$new_order_id', goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ". |
| | | "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id, package_attr_id ". |
| | | " FROM " .$ecs->table('cart') . |
| | | " WHERE $sql_where AND rec_type = '$flow_type' "; //$id_ext_new |
| | | /* 代码增加_end By */ |
| | | $db->query($sql); |
| | | /* 修改拍卖活动状态 */ |
| | | if ($order['extension_code']=='auction') |
| | | { |
| | | $sql = "UPDATE ". $ecs->table('goods_activity') ." SET is_finished='2' WHERE act_id=".$order['extension_id']; |
| | | $db->query($sql); |
| | | } |
| | | |
| | | /* 处理余额、积分、红包 */ |
| | | if ($order['user_id'] > 0 && $order['surplus'] > 0) |
| | | { |
| | | log_account_change($order['user_id'], $order['surplus'] * (-1), 0, 0, 0, sprintf($_LANG['pay_order'], $order['order_sn'])); |
| | | } |
| | | if ($order['user_id'] > 0 && $order['integral'] > 0) |
| | | { |
| | | log_account_change($order['user_id'], 0, 0, 0, $order['integral'] * (-1), sprintf($_LANG['pay_order'], $order['order_sn'])); |
| | | } |
| | | |
| | | |
| | | if ($order['bonus_id'] > 0 && $temp_amout > 0) |
| | | { |
| | | use_bonus($order['bonus_id'], $new_order_id); |
| | | } |
| | | |
| | | $split_order['suborder_list'][$ok]['order_sn'] = $order['order_sn']; |
| | | $split_order['suborder_list'][$ok]['order_amount_formated'] = price_format($order['order_amount']); |
| | | |
| | | |
| | | /* 如果使用库存,且下订单时减库存,则减少库存 */ |
| | | if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) |
| | | { |
| | | change_order_goods_storage($order['order_id'], true, SDT_PLACE); |
| | | } |
| | | |
| | | /* 给商家发邮件 */ |
| | | /* 增加是否给客服发送邮件选项 */ |
| | | if ($_CFG['send_service_email'] && $_CFG['service_email'] != '') |
| | | { |
| | | $tpl = get_mail_template('remind_of_new_order'); |
| | | $smarty->assign('order', $order); |
| | | $smarty->assign('goods_list', $cart_goods); |
| | | $smarty->assign('shop_name', $_CFG['shop_name']); |
| | | $smarty->assign('send_date', date($_CFG['time_format'])); |
| | | $content = $smarty->fetch('str:' . $tpl['template_content']); |
| | | send_mail($_CFG['shop_name'], $_CFG['service_email'], $tpl['template_subject'], $content, $tpl['is_html']); |
| | | } |
| | | |
| | | /* 如果需要,发短信 */ |
| | | if ($_CFG['sms_order_placed'] == '1' && $_CFG['sms_shop_mobile'] != '') |
| | | { |
| | | // include_once('includes/cls_sms.php'); |
| | | //$sms = new sms(); |
| | | //$msg = $order['pay_status'] == PS_UNPAYED ? |
| | | // $_LANG['order_placed_sms'] : $_LANG['order_placed_sms'] . '[' . $_LANG['sms_paid'] . ']'; |
| | | // $sms->send($_CFG['sms_shop_mobile'], sprintf($msg, $order['consignee'], $order['tel']),'', 13,1); |
| | | } |
| | | /* 如果订单金额为0 处理虚拟卡 */ |
| | | if ($order['order_amount'] <= 0) |
| | | { |
| | | /* 代码增加_start By */ |
| | | $sql = "SELECT goods_id, goods_name, goods_number AS num FROM ". |
| | | $GLOBALS['ecs']->table('cart') . |
| | | " WHERE is_real = 0 AND extension_code = 'virtual_card'". |
| | | " AND $sql_where AND rec_type = '$flow_type'"; |
| | | /* 代码增加_end By */ |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | $virtual_goods = array(); |
| | | foreach ($res AS $row) |
| | | { |
| | | $virtual_goods['virtual_card'][] = array('goods_id' => $row['goods_id'], 'goods_name' => $row['goods_name'], 'num' => $row['num']); |
| | | } |
| | | |
| | | if ($virtual_goods AND $flow_type != CART_GROUP_BUY_GOODS) |
| | | { |
| | | /* 虚拟卡发货 */ |
| | | if (virtual_goods_ship($virtual_goods,$msg, $order['order_sn'], true)) |
| | | { |
| | | /* 如果没有实体商品,修改发货状态,送积分和红包 */ |
| | | $sql = "SELECT COUNT(*)" . |
| | | " FROM " . $ecs->table('order_goods') . |
| | | " WHERE order_id = '$order[order_id]' " . |
| | | " AND is_real = 1"; |
| | | if ($db->getOne($sql) <= 0) |
| | | { |
| | | /* 修改订单状态 */ |
| | | update_order($order['order_id'], array('shipping_status' => SS_SHIPPED, 'shipping_time' => gmtime())); |
| | | |
| | | /* 如果订单用户不为空,计算积分,并发给用户;发红包 */ |
| | | if ($order['user_id'] > 0) |
| | | { |
| | | /* 取得用户信息 */ |
| | | $user = user_info($order['user_id']); |
| | | |
| | | /* 计算并发放积分 */ |
| | | $integral = integral_to_give($order); |
| | | log_account_change($order['user_id'], 0, 0, intval($integral['rank_points']), intval($integral['custom_points']), sprintf($_LANG['order_gift_integral'], $order['order_sn'])); |
| | | |
| | | /* 发放红包 */ |
| | | send_order_bonus($order['order_id']); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | $all_order_amount += $order['order_amount']; |
| | | //user_uc_call('add_feed', array($order['order_id'], BUY_GOODS)); //推送feed到uc |
| | | } |
| | | /* 清空购物车 */ |
| | | clear_cart($flow_type); |
| | | /* 清除缓存,否则买了商品,但是前台页面读取缓存,商品数量不减少 */ |
| | | clear_all_files(); |
| | | |
| | | //删除父订单记录 |
| | | if($del_patent_id > 0){ |
| | | $sql="delete from ".$GLOBALS['ecs']->table('order_info')." where order_id='$del_patent_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | /* 代码增加_start By */ |
| | | //$split_order = split_order($new_order_id); |
| | | $smarty->assign('split_order', $split_order); |
| | | /* 如果需要,发短信 */ |
| | | if(count($split_order['suborder_list']) > 0){ |
| | | foreach($split_order['suborder_list'] as $key => $val){ |
| | | $supplier_ids[$key] = $val['order_sn']; |
| | | } |
| | | } |
| | | |
| | | |
| | | //$supplier_ids = array_keys(); |
| | | include_once('../send.php'); |
| | | |
| | | send_sms($supplier_ids,'您有一条新订单,订单号为:ordersn请注意查看。【shopname】',1); |
| | | |
| | | /* 取得支付信息,生成支付代码 */ |
| | | if ($split_order['sub_order_count'] >1) |
| | | { |
| | | $order['order_sn'] = $parent_order_id; |
| | | /* 插入支付日志 */ |
| | | $order['log_id'] = insert_pay_log($order['order_sn'], $order['order_amount'], PAY_ORDER); |
| | | }else{ |
| | | /* 插入支付日志 */ |
| | | $order['log_id'] = insert_pay_log($order['order_id'], $order['order_amount'], PAY_ORDER); |
| | | } |
| | | $order['order_amount'] = $all_order_amount; //替换为总金额去支付 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if ($order['order_amount'] > 0) |
| | | { |
| | | $result['result']['order_sn'] = $order['order_sn']; |
| | | $result['result']['allmoney'] = $order['order_amount']; |
| | | |
| | | $payment = payment_info($order['pay_id']); |
| | | |
| | | include_once('../includes/modules/payment/' . $payment['pay_code'] . '.php'); |
| | | |
| | | $pay_obj = new $payment['pay_code']; |
| | | |
| | | $pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config'])); |
| | | |
| | | $order['pay_desc'] = $payment['pay_desc']; |
| | | $result['result']['pay_code'] = $payment['pay_code']; |
| | | $result['result']['pay_online'] = $pay_online; |
| | | |
| | | //$smarty->assign('pay_online', $pay_online); |
| | | } |
| | | if(!empty($order['shipping_name'])) |
| | | { |
| | | $order['shipping_name']=trim(stripcslashes($order['shipping_name'])); |
| | | } |
| | | |
| | | /* 订单信息 */ |
| | | $smarty->assign('order', $order); |
| | | $smarty->assign('total', $total); |
| | | |
| | | unset($_SESSION['flow_consignee']); // 清除session中保存的收货人信息 |
| | | unset($_SESSION['flow_order']); |
| | | unset($_SESSION['direct_shopping']); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /** |
| | | * 取得某用户等级当前时间可以享受的优惠活动 |
| | | * @param int $user_rank 用户等级id,0表示非会员 |
| | | * @param int $is_have 是否判断已经选择赠品 |
| | | * @return array |
| | | */ |
| | | function favourable_list($user_rank,$is_have=true) |
| | | { |
| | | /* 购物车中已有的优惠活动及数量 */ |
| | | $used_list = cart_favourable(); |
| | | |
| | | /* 当前用户可享受的优惠活动 */ |
| | | $favourable_list = array(); |
| | | $user_rank = ',' . $user_rank . ','; |
| | | $now = gmtime(); |
| | | if(isset($_REQUEST['suppid'])){ |
| | | $tj = " AND supplier_id=".$_REQUEST['suppid']; |
| | | }else{ |
| | | $tj = ''; |
| | | } |
| | | $sql = "SELECT * " . |
| | | "FROM " . $GLOBALS['ecs']->table('favourable_activity') . |
| | | " WHERE CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'" . |
| | | " AND start_time <= '$now' AND end_time >= '$now'" .$tj. |
| | | " AND act_type = '" . FAT_GOODS . "'" . |
| | | " ORDER BY sort_order"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($favourable = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $favourable['start_time'] = local_date($GLOBALS['_CFG']['time_format'], $favourable['start_time']); |
| | | $favourable['end_time'] = local_date($GLOBALS['_CFG']['time_format'], $favourable['end_time']); |
| | | $favourable['formated_min_amount'] = price_format($favourable['min_amount'], false); |
| | | $favourable['formated_max_amount'] = price_format($favourable['max_amount'], false); |
| | | $favourable['gift'] = unserialize($favourable['gift']); |
| | | $_REQUEST['suppid'] = $favourable['supplier_id'] = $favourable['supplier_id']; |
| | | |
| | | foreach ($favourable['gift'] as $key => $value) |
| | | { |
| | | $favourable['gift'][$key]['formated_price'] = price_format($value['price'], false); |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods') . " WHERE is_on_sale = 1 AND goods_id = ".$value['id']; |
| | | $is_sale = $GLOBALS['db']->getOne($sql); |
| | | if(!$is_sale) |
| | | { |
| | | unset($favourable['gift'][$key]); |
| | | } |
| | | $goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$value['id']}'"); |
| | | $favourable['gift'][$key]['goods_thumb'] = get_image_path($value['id'], $goods_thumb, true); |
| | | } |
| | | |
| | | $favourable['act_range_desc'] = act_range_desc($favourable); |
| | | $favourable['act_type_desc'] = sprintf($GLOBALS['_LANG']['fat_ext'][$favourable['act_type']], $favourable['act_type_ext']); |
| | | |
| | | /* 是否能享受 */ |
| | | $favourable['available'] = favourable_available($favourable); |
| | | if ($favourable['available'] && $is_have) |
| | | { |
| | | /* 是否尚未享受 */ |
| | | $favourable['available'] = !favourable_used($favourable, $used_list); |
| | | } |
| | | $favourable_list[] = $favourable; |
| | | } |
| | | |
| | | |
| | | |
| | | return $favourable_list; |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车中已有的优惠活动及数量 |
| | | * @return array |
| | | */ |
| | | function cart_favourable() |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 |
| | | $list = array(); |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | $sql = "SELECT is_gift, COUNT(*) AS num " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | " AND rec_type = '" . CART_GENERAL_GOODS . "'" . |
| | | " AND is_gift > 0" . |
| | | " GROUP BY is_gift"; |
| | | /* 代码修改_end By */ |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $list[$row['is_gift']] = $row['num']; |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 根据购物车判断是否可以享受某优惠活动 |
| | | * @param array $favourable 优惠活动信息 |
| | | * @return bool |
| | | */ |
| | | function favourable_available($favourable) |
| | | { |
| | | /* 会员等级是否符合 */ |
| | | $user_rank = $_SESSION['user_rank']; |
| | | if (strpos(',' . $favourable['user_rank'] . ',', ',' . $user_rank . ',') === false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /* 优惠范围内的商品总额 */ |
| | | $amount = cart_favourable_amount($favourable); |
| | | |
| | | /* 金额上限为0表示没有上限 */ |
| | | return $amount >= $favourable['min_amount'] && |
| | | ($amount <= $favourable['max_amount'] || $favourable['max_amount'] == 0); |
| | | } |
| | | |
| | | /** |
| | | * 购物车中是否已经有某优惠 |
| | | * @param array $favourable 优惠活动 |
| | | * @param array $cart_favourable购物车中已有的优惠活动及数量 |
| | | */ |
| | | function favourable_used($favourable, $cart_favourable) |
| | | { |
| | | if ($favourable['act_type'] == FAT_GOODS) |
| | | { |
| | | return isset($cart_favourable[$favourable['act_id']]) && |
| | | $cart_favourable[$favourable['act_id']] >= $favourable['act_type_ext'] && |
| | | $favourable['act_type_ext'] > 0; |
| | | } |
| | | else |
| | | { |
| | | return isset($cart_favourable[$favourable['act_id']]); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得优惠范围描述 |
| | | * @param array $favourable 优惠活动 |
| | | * @return string |
| | | */ |
| | | function act_range_desc($favourable) |
| | | { |
| | | if ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | $sql = "SELECT brand_name FROM " . $GLOBALS['ecs']->table('brand') . |
| | | " WHERE brand_id " . db_create_in($favourable['act_range_ext']); |
| | | return join(',', $GLOBALS['db']->getCol($sql)); |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | $sql = "SELECT cat_name FROM " . $GLOBALS['ecs']->table('category') . |
| | | " WHERE cat_id " . db_create_in($favourable['act_range_ext']); |
| | | return join(',', $GLOBALS['db']->getCol($sql)); |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_GOODS) |
| | | { |
| | | $sql = "SELECT goods_name FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id " . db_create_in($favourable['act_range_ext']); |
| | | return join(',', $GLOBALS['db']->getCol($sql)); |
| | | } |
| | | else |
| | | { |
| | | return ''; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车中某优惠活动范围内的总金额 |
| | | * @param array $favourable 优惠活动 |
| | | * @return float |
| | | */ |
| | | function cart_favourable_amount($favourable) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 ";//添加 |
| | | /* 查询优惠范围内商品总额的sql */ |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | $sql = "SELECT SUM(c.goods_price * c.goods_number) " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND $sql_where " . |
| | | "AND c.rec_type = '" . CART_GENERAL_GOODS . "' " . |
| | | "AND g.supplier_id=".$favourable['supplier_id']." ". |
| | | "AND c.is_gift = 0 " . |
| | | "AND c.goods_id > 0 "; |
| | | /* 代码修改_end By */ |
| | | |
| | | /* 根据优惠范围修正sql */ |
| | | if ($favourable['act_range'] == FAR_ALL) |
| | | { |
| | | // sql do not change |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | /* 取得优惠范围分类的所有下级分类 */ |
| | | $id_list = array(); |
| | | $cat_list = explode(',', $favourable['act_range_ext']); |
| | | foreach ($cat_list as $id) |
| | | { |
| | | $id_list = array_merge($id_list, array_keys(cat_list(intval($id), 0, false))); |
| | | } |
| | | |
| | | $sql .= "AND g.cat_id " . db_create_in($id_list); |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | $id_list = explode(',', $favourable['act_range_ext']); |
| | | |
| | | $sql .= "AND g.brand_id " . db_create_in($id_list); |
| | | } |
| | | else |
| | | { |
| | | $id_list = explode(',', $favourable['act_range_ext']); |
| | | |
| | | $sql .= "AND g.goods_id " . db_create_in($id_list); |
| | | } |
| | | |
| | | $sql .= (isset($_REQUEST['sel_goods']) && !empty($_REQUEST['sel_goods'])) ? " AND c.rec_id in (". $_REQUEST['sel_goods'] .") " : ""; |
| | | |
| | | //计算某个店铺的商品总额 |
| | | if(isset($_REQUEST['suppid'])){ |
| | | $sql .= " AND g.supplier_id=".intval($_REQUEST['suppid']); |
| | | } |
| | | //echo $sql; |
| | | |
| | | /* 优惠范围内的商品总额 */ |
| | | return $GLOBALS['db']->getOne($sql); |
| | | } |
| | | |
| | | /** |
| | | * 添加优惠活动(赠品)到购物车 |
| | | * @param int $act_id 优惠活动id |
| | | * @param int $id 赠品id |
| | | * @param float $price 赠品价格 |
| | | */ |
| | | function add_gift_to_cart($act_id, $id, $price) |
| | | { |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('cart') . " (" . |
| | | "user_id, session_id, goods_id, goods_sn, goods_name, market_price, goods_price, ". |
| | | "goods_number, is_real, extension_code, parent_id, is_gift, rec_type ) ". |
| | | "SELECT '$_SESSION[user_id]', '" . SESS_ID . "', goods_id, goods_sn, goods_name, market_price, ". |
| | | "'$price', 1, is_real, extension_code, 0, '$act_id', '" . CART_GENERAL_GOODS . "' " . |
| | | "FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id = '$id'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 删除购物车中的商品 |
| | | * |
| | | * @access public |
| | | * @param integer $id |
| | | * @return void |
| | | */ |
| | | function flow_drop_cart_goods($id) |
| | | { |
| | | /* 取得商品id */ |
| | | $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('cart'). " WHERE rec_id = '$id'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | if ($row) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 |
| | | //如果是超值礼包 |
| | | if ($row['extension_code'] == 'package_buy') |
| | | { |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_id = '$id' LIMIT 1"; |
| | | /* 代码修改_end By */ |
| | | } |
| | | |
| | | //如果是普通商品,同时删除所有赠品及其配件 |
| | | elseif ($row['parent_id'] == 0 && $row['is_gift'] == 0) |
| | | { |
| | | /* 检查购物车中该普通商品的不可单独销售的配件并删除 */ |
| | | $sql = "SELECT c.rec_id |
| | | FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('group_goods') . " AS gg, " . $GLOBALS['ecs']->table('goods'). " AS g |
| | | WHERE gg.parent_id = '" . $row['goods_id'] . "' |
| | | AND c.goods_id = gg.goods_id |
| | | AND c.parent_id = '" . $row['goods_id'] . "' |
| | | AND c.extension_code <> 'package_buy' |
| | | AND gg.goods_id = g.goods_id |
| | | AND g.is_alone_sale = 0"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $_del_str = $id . ','; |
| | | while ($id_alone_sale_goods = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $_del_str .= $id_alone_sale_goods['rec_id'] . ','; |
| | | } |
| | | $_del_str = trim($_del_str, ','); |
| | | |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | if($_del_str){ |
| | | $sql_plus = " rec_id IN ($_del_str) OR "; |
| | | } |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND ('$sql_plus' parent_id = '$row[goods_id]' OR is_gift <> 0)"; |
| | | /* 代码修改_end By */ |
| | | } |
| | | |
| | | //如果不是普通商品,只删除该商品即可 |
| | | else |
| | | { |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_id = '$id' LIMIT 1"; |
| | | /* 代码修改_end By */ |
| | | } |
| | | |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | flow_clear_cart_alone(); |
| | | } |
| | | |
| | | /** |
| | | * 删除购物车中不能单独销售的商品 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function flow_clear_cart_alone() |
| | | { |
| | | /* 查询:购物车中所有不可以单独销售的配件 */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 ";//添加 |
| | | |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | $sql = "SELECT c.rec_id, gg.parent_id |
| | | FROM " . $GLOBALS['ecs']->table('cart') . " AS c |
| | | LEFT JOIN " . $GLOBALS['ecs']->table('group_goods') . " AS gg ON c.goods_id = gg.goods_id |
| | | LEFT JOIN" . $GLOBALS['ecs']->table('goods') . " AS g ON c.goods_id = g.goods_id |
| | | WHERE $sql_where |
| | | AND c.extension_code <> 'package_buy' |
| | | AND gg.parent_id > 0 |
| | | AND g.is_alone_sale = 0"; |
| | | /* 代码修改_end By */ |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $rec_id = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $rec_id[$row['rec_id']][] = $row['parent_id']; |
| | | } |
| | | |
| | | if (empty($rec_id)) |
| | | { |
| | | return; |
| | | } |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 |
| | | |
| | | |
| | | /* 查询:购物车中所有商品 */ |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | $sql = "SELECT DISTINCT goods_id |
| | | FROM " . $GLOBALS['ecs']->table('cart') . " |
| | | WHERE $sql_where |
| | | AND extension_code <> 'package_buy'"; |
| | | /* 代码修改_end By */ |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $cart_good = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $cart_good[] = $row['goods_id']; |
| | | } |
| | | |
| | | if (empty($cart_good)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | /* 如果购物车中不可以单独销售配件的基本件不存在则删除该配件 */ |
| | | $del_rec_id = ''; |
| | | foreach ($rec_id as $key => $value) |
| | | { |
| | | foreach ($value as $v) |
| | | { |
| | | if (in_array($v, $cart_good)) |
| | | { |
| | | continue 2; |
| | | } |
| | | } |
| | | |
| | | $del_rec_id = $key . ','; |
| | | } |
| | | $del_rec_id = trim($del_rec_id, ','); |
| | | |
| | | if ($del_rec_id == '') |
| | | { |
| | | return; |
| | | } |
| | | |
| | | /* 删除 */ |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | if($del_rec_id){ |
| | | $sql_plus = " AND rec_id IN ($del_rec_id) "; |
| | | } |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') ." |
| | | WHERE $sql_where |
| | | ".$sql_plus; |
| | | /* 代码修改_end By */ |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 获得用户的可用积分 |
| | | * |
| | | * @access private |
| | | * @return integral |
| | | */ |
| | | function flow_available_points() |
| | | { |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT SUM(g.integral * c.goods_number) as integral,g.supplier_id ". |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE $sql_where AND c.goods_id = g.goods_id AND c.is_gift = 0 AND g.integral > 0 " . |
| | | "AND c.rec_type = '" . CART_GENERAL_GOODS . "' GROUP BY g.supplier_id"; |
| | | /* 代码修改_end By */ |
| | | $info = $GLOBALS['db']->getAll($sql); |
| | | $ret = array(); |
| | | foreach($info as $key => $val){ |
| | | $ret[$val['supplier_id']] = integral_of_value(intval($val['integral'])); |
| | | } |
| | | return $ret; |
| | | } |
| | | |
| | | /** |
| | | * 检查订单中商品库存 |
| | | * |
| | | * @access public |
| | | * @param array $arr |
| | | * |
| | | * @return void |
| | | */ |
| | | function flow_cart_stock($arr) |
| | | { |
| | | foreach ($arr AS $key => $val) |
| | | { |
| | | $val = intval(make_semiangle($val)); |
| | | if ($val <= 0 || !is_numeric($key)) |
| | | { |
| | | continue; |
| | | } |
| | | /* 代码修改_start By 将这块替换掉*/ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | $sql = "SELECT `goods_id`, `goods_attr_id`, `extension_code` FROM" .$GLOBALS['ecs']->table('cart'). |
| | | " WHERE rec_id='$key' AND $sql_where"; |
| | | $goods = $GLOBALS['db']->getRow($sql); |
| | | /* 代码修改_end By */ |
| | | |
| | | $sql = "SELECT g.goods_name, g.goods_number, c.product_id ". |
| | | "FROM " .$GLOBALS['ecs']->table('goods'). " AS g, ". |
| | | $GLOBALS['ecs']->table('cart'). " AS c ". |
| | | "WHERE g.goods_id = c.goods_id AND c.rec_id = '$key'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | //系统启用了库存,检查输入的商品数量是否有效 |
| | | if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') |
| | | { |
| | | if ($row['goods_number'] < $val) |
| | | { |
| | | show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], |
| | | $row['goods_number'], $row['goods_number'])); |
| | | exit; |
| | | } |
| | | |
| | | /* 是货品 */ |
| | | $row['product_id'] = trim($row['product_id']); |
| | | if (!empty($row['product_id'])) |
| | | { |
| | | $sql = "SELECT product_number FROM " .$GLOBALS['ecs']->table('products'). " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $row['product_id'] . "'"; |
| | | $product_number = $GLOBALS['db']->getOne($sql); |
| | | if ($product_number < $val) |
| | | { |
| | | show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], |
| | | $row['goods_number'], $row['goods_number'])); |
| | | exit; |
| | | } |
| | | } |
| | | } |
| | | elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') |
| | | { |
| | | if (judge_package_stock($goods['goods_id'], $val)) |
| | | { |
| | | show_message($GLOBALS['_LANG']['package_stock_insufficiency']); |
| | | exit; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | /* |
| | | *判断商品最后的价格 |
| | | * goods_id 商品id |
| | | *number 商品数量 |
| | | *rec_id 购物车ID |
| | | * jx 2015-04-02 |
| | | **/ |
| | | function get_min_price($goods_id,$number,$rec_id) |
| | | { |
| | | $sql = "SELECT * FROM ".$GLOBALS['ecs']->table('cart')." WHERE goods_id = '$goods_id' AND rec_id = '$rec_id'"; |
| | | $res = $GLOBALS['db']->getRow($sql); |
| | | $attr_id = $res['goods_attr_id']; |
| | | //取得属性价格 开始 |
| | | if(empty($attr_id)) |
| | | { |
| | | $atr_price=0; |
| | | }else |
| | | { |
| | | $goods_att=explode(',',$attr_id); |
| | | foreach ($goods_att as $value) |
| | | { |
| | | if(!empty($value)) |
| | | { |
| | | $sql="SELECT `attr_price` FROM " .$GLOBALS['ecs']->table('goods_attr')." WHERE goods_id='$goods_id' AND `goods_attr_id`='$value'"; |
| | | $atr_price+=$GLOBALS['db']->getOne($sql); |
| | | } |
| | | |
| | | } |
| | | } |
| | | $sql = "SELECT volume_price FROM ".$GLOBALS['ecs']->table('volume_price')."WHERE goods_id = '$goods_id' AND volume_number <= '$number'"; |
| | | $volume = $GLOBALS['db']->getOne($sql);//优惠价格 |
| | | //属性价格 结束 |
| | | $user_id = $res['user_id']; |
| | | if($user_id == 0)//用户不存在 |
| | | { |
| | | if(!empty($atr_price))//存在属性价格 |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price = ($res['promote_price'] + $atr_price); |
| | | return $min_price; |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | //return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | } |
| | | return $min_price; |
| | | } |
| | | }else |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price = $res['promote_price']; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else//用户存在 |
| | | { |
| | | $row = $GLOBALS['db'] -> getOne("SELECT rank_points FROM ".$GLOBALS['ecs']->table('users')." WHERE `user_id`='$user_id'"); |
| | | $sql = "SELECT rank_id FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE max_points > '$row' ORDER BY max_points ASC LIMIT 1"; |
| | | $rank_id = $GLOBALS['db']->getOne($sql);//取得会员等级 |
| | | |
| | | if(empty($rank_id)) |
| | | { |
| | | if(!empty($atr_price) && $atr_price != 0)//存在属性价格 |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price= ($res['promote_price'] + $atr_price); |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | } |
| | | }else |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price = $res['promote_price']; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | } |
| | | } |
| | | }else |
| | | { |
| | | if(!empty($atr_price) && $atr_price != 0)//存在属性价格 |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | |
| | | $rank_price = rank_price($rank_id,$res['shop_price']); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | if($res['promote_price'] > $rank_price) |
| | | { |
| | | $min_price= ($rank_price + $atr_price); |
| | | }else |
| | | { |
| | | $min_price= ($res['promote_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | }else |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price= ($rank_price + $atr_price); |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | } |
| | | |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price'],$rank_price);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price = ($rank_price + $atr_price); |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | } |
| | | }else |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | $rank_price = rank_price($rank_id,$res['shop_price']); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | if($res['promote_price'] > $rank_price) |
| | | { |
| | | $min_price = $rank_price; |
| | | }else |
| | | { |
| | | $min_price= $res['promote_price']; |
| | | } |
| | | return $min_price; |
| | | }else |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price = $rank_price; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | } |
| | | |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price'],$rank_price);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if($volume == '' && empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price = $rank_price; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$rank_price);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | /* |
| | | * |
| | | *获取对应会员等级的优惠价格 |
| | | * |
| | | **/ |
| | | function rank_price($rank,$price) |
| | | { |
| | | $sql = "SELECT IFNULL(mp.user_price, r.discount * $price / 100) AS price " . |
| | | 'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ". |
| | | "ON mp.goods_id = '$goods_id' AND mp.user_rank = r.rank_id WHERE r.rank_id = '$rank'"; |
| | | $rank_price = $GLOBALS['db']->getOne($sql);//取得会员等级价格 |
| | | return $rank_price; |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | define('IN_ECS', true); |
| | | |
| | | require('../includes/init.php'); |
| | | require('./includes/lib_order.php'); |
| | | include('../includes/cls_json.php'); |
| | | $json = new JSON; |
| | | /* 载入语言文件 */ |
| | | require_once('../languages/zh_cn/shopping_flow.php'); |
| | | require_once('../languages/zh_cn/user.php'); |
| | | |
| | | $_LANG['your_discount'] = '根据优惠活动<a href="javascript:void(0)" onclick="activity()"><font style="color:#F93">%s</font></a>,您可以享受折扣 %s'; |
| | | |
| | | $userid = intval($_REQUEST['userid']); |
| | | if($userid > 0){ |
| | | //需要获取用户登陆的相关信息 |
| | | $_SESSION['user_id'] = $userid; |
| | | } |
| | | $smarty->assign('lang', $_LANG); |
| | | |
| | | $smarty->template_dir = ROOT_PATH . 'json/tpl';//app部分模板所在位置 |
| | | |
| | | |
| | | /* |
| | | * 获取购物车中的商品 |
| | | */ |
| | | if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'selcart') |
| | | { |
| | | |
| | | $res = array('error' => 0, 'result' => '', 'message' => ''); |
| | | |
| | | |
| | | /* 取得商品列表,计算合计 */ |
| | | $cart_goods = get_cart_goods(); |
| | | if(count($cart_goods['goods_list'])<=0){ |
| | | $res['error'] = 1; |
| | | $res['message'] = '请先添加商品!'; |
| | | die($json->encode($res)); |
| | | } |
| | | |
| | | |
| | | /* 取得优惠活动 */ |
| | | $favourable_list = favourable_list($_SESSION['user_rank']); |
| | | |
| | | if($favourable_list){ |
| | | $new_fav = array(); |
| | | foreach($favourable_list as $key => $val){ |
| | | if(isset($cart_goods['goods_list'][$val['supplier_id']])){ |
| | | $cart_goods['goods_list'][$val['supplier_id']]['favourable'][] = $val; |
| | | } |
| | | } |
| | | } |
| | | //echo "<pre>"; |
| | | //print_r($cart_goods['goods_list']); |
| | | |
| | | foreach($cart_goods['goods_list'] as $k=>$v){ |
| | | $discount = compute_discount($k); |
| | | if(is_array($discount)){ |
| | | $cart_goods['goods_list'][$k]['discount']['discount'] = $discount['discount']; |
| | | $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); |
| | | $cart_goods['goods_list'][$k]['discount']['your_discount'] = sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount'])); |
| | | } |
| | | } |
| | | |
| | | //选择优惠活动中的赠品时所要执行的部分_start |
| | | if(isset($_REQUEST['is_ajax']) && intval($_REQUEST['is_ajax']) > 0){ |
| | | $res = array('error' => 0, 'result' => ''); |
| | | if (isset($_REQUEST['suppid'])) |
| | | { |
| | | $smarty->assign('favourable_list', $cart_goods['goods_list'][intval($_REQUEST['suppid'])]['favourable']); |
| | | $res['result'] = $smarty->fetch("favourable_app.lbi"); |
| | | } |
| | | else |
| | | { |
| | | $res['result'] = '您一个商品都没选,这怎么行捏!!真的不行哦!'; |
| | | } |
| | | die($json->encode($res)); |
| | | } |
| | | //选择优惠活动中的赠品时所要执行的部分_end |
| | | |
| | | $res['result'] = $cart_goods; |
| | | die($json->encode($res)); |
| | | } |
| | | |
| | | /* |
| | | * 修改购物车中商品的数量 |
| | | */ |
| | | if($_REQUEST['step']=='update_group_cart') |
| | | { |
| | | $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => ''); |
| | | $rec_id = intval($_REQUEST['rec_id']); |
| | | $number = intval($_REQUEST['number']); |
| | | $goods_id = intval($_REQUEST['goods_id']); |
| | | $result['suppid'] = intval($_REQUEST['suppid']); |
| | | $result['rec_id'] = $rec_id; |
| | | $result['number']=$number; |
| | | |
| | | |
| | | |
| | | $goods_number = $GLOBALS['db']->getOne("select goods_number from ".$GLOBALS['ecs']->table('goods')." where goods_id='$goods_id'"); |
| | | if($number>$goods_number) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['content'] ='对不起,您选择的数量超出库存您最多可购买'.$goods_number."件"; |
| | | $result['number']=$GLOBALS['db']->getOne("select goods_number from ".$GLOBALS['ecs']->table('cart')." where rec_id = '$rec_id'"); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $min_price = get_min_price($goods_id,$number,$rec_id);//取得当前用户该商品的最小单价 |
| | | //file_put_contents('./567.txt',$min_price); |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '$number',goods_price = '$min_price' WHERE rec_id = $rec_id"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 取得商品列表,计算合计 */ |
| | | $cart_goods = get_cart_goods(); |
| | | $result['min_price'] = $min_price; |
| | | //折扣活动 |
| | | $result['your_discount'] = ''; |
| | | $discount = compute_discount($result['suppid']); |
| | | if(is_array($discount)){ |
| | | $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); |
| | | $result['your_discount'] = sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount'])); |
| | | } |
| | | |
| | | $subtotal = $GLOBALS['db']->getONE("select goods_price * goods_number AS subtotal from ".$GLOBALS['ecs']->table('cart')." where rec_id = $rec_id"); |
| | | $result['subtotal'] = price_format($subtotal, false); |
| | | //$result['cart_amount_desc'] = sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']); |
| | | $result['cart_amount_desc'] = $cart_goods['total']['goods_price']; |
| | | $shopping_money = sprintf($_LANG['shopping_money'], $cart_goods['total']['goods_price']); |
| | | $result['market_amount_desc'] = $shopping_money; |
| | | if ($_CFG['show_marketprice']) |
| | | { |
| | | $market_price_desc= sprintf($_LANG['than_market_price'],$cart_goods['total']['market_price'], $cart_goods['total']['saving'], $cart_goods['total']['save_rate']); |
| | | $result['market_amount_desc'].= ",".$market_price_desc ; |
| | | } |
| | | |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- 添加商品到购物车 |
| | | /*------------------------------------------------------ */ |
| | | elseif ($_REQUEST['step'] == 'add_to_cart') |
| | | { |
| | | |
| | | $_REQUEST['goods']=strip_tags(urldecode($_REQUEST['goods'])); |
| | | $_REQUEST['goods'] = json_str_iconv($_REQUEST['goods']); |
| | | |
| | | $result = array('error' => 0, 'message' => '', 'content' => '', 'goods_id' => ''); |
| | | if (!empty($_REQUEST['goods_id']) && empty($_REQUEST['goods'])) |
| | | { |
| | | if (!is_numeric($_REQUEST['goods_id']) || intval($_REQUEST['goods_id']) <= 0) |
| | | { |
| | | $result['error'] = ERR_NOT_EXISTS; |
| | | $result['message'] = '非法操作!'; |
| | | die($json->encode($result)); |
| | | } |
| | | $goods_id = intval($_REQUEST['goods_id']); |
| | | exit; |
| | | } |
| | | |
| | | if (empty($_REQUEST['goods'])) |
| | | { |
| | | $result['error'] = 1; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $goods = $json->decode($_REQUEST['goods']); |
| | | |
| | | /* 检查:如果商品有规格,而post的数据没有规格,把商品的规格属性通过JSON传到前台 */ |
| | | if (empty($goods->spec) AND empty($goods->quick)) |
| | | { |
| | | $sql = "SELECT a.attr_id, a.attr_name, a.attr_type, ". |
| | | "g.goods_attr_id, g.attr_value, g.attr_price " . |
| | | 'FROM ' . $GLOBALS['ecs']->table('goods_attr') . ' AS g ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('attribute') . ' AS a ON a.attr_id = g.attr_id ' . |
| | | "WHERE a.attr_type != 0 AND g.goods_id = '" . $goods->goods_id . "' " . |
| | | 'ORDER BY a.sort_order, g.attr_price, g.goods_attr_id'; |
| | | |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if (!empty($res)) |
| | | { |
| | | $spe_arr = array(); |
| | | foreach ($res AS $row) |
| | | { |
| | | $spe_arr[$row['attr_id']]['attr_type'] = $row['attr_type']; |
| | | $spe_arr[$row['attr_id']]['name'] = $row['attr_name']; |
| | | $spe_arr[$row['attr_id']]['attr_id'] = $row['attr_id']; |
| | | $spe_arr[$row['attr_id']]['values'][] = array( |
| | | 'label' => $row['attr_value'], |
| | | 'price' => $row['attr_price'], |
| | | 'format_price' => price_format($row['attr_price'], false), |
| | | 'id' => $row['goods_attr_id']); |
| | | } |
| | | $i = 0; |
| | | $spe_array = array(); |
| | | foreach ($spe_arr AS $row) |
| | | { |
| | | $spe_array[]=$row; |
| | | } |
| | | $result['error'] = ERR_NEED_SELECT_ATTR; |
| | | $result['goods_id'] = $goods->goods_id; |
| | | $result['parent'] = $goods->parent; |
| | | $result['message'] = $spe_array; |
| | | |
| | | die($json->encode($result)); |
| | | } |
| | | } |
| | | |
| | | /* 更新:如果是一步购物,先清空购物车 */ |
| | | //if ($_CFG['one_step_buy'] == '1') |
| | | if(isset($_REQUEST['isbuy']) && $_REQUEST['isbuy'] == 'now') |
| | | { |
| | | if($userid <= 0){ |
| | | $result['error'] = 0; |
| | | $result['message'] = '请选登陆!'; |
| | | die($json->encode($result)); |
| | | }else{ |
| | | clear_cart(); |
| | | } |
| | | } |
| | | |
| | | /* 检查:商品数量是否合法 */ |
| | | if (!is_numeric($goods->number) || intval($goods->number) <= 0) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['invalid_number']; |
| | | } |
| | | /* 更新:购物车 */ |
| | | else |
| | | { |
| | | if(!empty($goods->spec)) |
| | | { |
| | | foreach ($goods->spec as $key=>$val ) |
| | | { |
| | | $goods->spec[$key]=intval($val); |
| | | } |
| | | } |
| | | // 更新:添加到购物车 |
| | | if (addto_cart($goods->goods_id, $goods->number, $goods->spec, $goods->parent)) |
| | | { |
| | | if ($_CFG['cart_confirm'] > 2) |
| | | { |
| | | $result['message'] = ''; |
| | | } |
| | | else |
| | | { |
| | | $result['message'] = $_CFG['cart_confirm'] == 1 ? $_LANG['addto_cart_success_1'] : $_LANG['addto_cart_success_2']; |
| | | } |
| | | |
| | | $result['content'] = insert_cart_info(); |
| | | $result['one_step_buy'] = $_CFG['one_step_buy']; |
| | | } |
| | | else |
| | | { |
| | | $result['message'] = $err->last_message(); |
| | | $result['error'] = $err->error_no; |
| | | $result['goods_id'] = stripslashes($goods->goods_id); |
| | | if (is_array($goods->spec)) |
| | | { |
| | | $result['product_spec'] = implode(',', $goods->spec); |
| | | } |
| | | else |
| | | { |
| | | $result['product_spec'] = $goods->spec; |
| | | } |
| | | } |
| | | } |
| | | $rows = $GLOBALS['db']->getRow("select goods_brief,shop_price,goods_name,promote_end_date,promote_start_date,promote_price,goods_thumb from ".$GLOBALS['ecs']->table('goods')." where goods_id=".$goods->goods_id); |
| | | $time1 = gmtime(); |
| | | if ($time1 >= $rows['promote_start_date'] && $time1 <= $rows['promote_end_date'] && $rows['promote_price'] > 0) |
| | | { |
| | | $result['shop_price'] = price_format($rows['promote_price']); |
| | | }else{ |
| | | $result['shop_price'] = price_format($rows['shop_price']); |
| | | } |
| | | $result['goods_name'] = $rows['goods_name']; |
| | | $result['goods_thumb'] = $rows['goods_thumb']; |
| | | $result['goods_brief'] = $rows['goods_brief']; |
| | | $result['goods_id'] = $goods->goods_id; |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 www.68ecshop.com |
| | | $sql = 'SELECT SUM(goods_number) AS number, SUM(goods_price * goods_number) AS amount' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE ".$sql_where." AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $rowss = $GLOBALS['db']->GetRow($sql); |
| | | $result['goods_price'] = price_format($rowss['amount']); |
| | | $result['goods_number'] = $rowss['number']; |
| | | $result['confirm_type'] = !empty($_CFG['cart_confirm']) ? $_CFG['cart_confirm'] : 2; |
| | | die($json->encode($result)); |
| | | } |
| | | elseif ($_REQUEST['step'] == 'add_favourable') |
| | | { |
| | | $result = array('error' => 0, 'message' => '', 'content' => ''); |
| | | /* 取得优惠活动信息 */ |
| | | $act_id = intval($_POST['act_id']); |
| | | $favourable = favourable_info($act_id); |
| | | if (empty($favourable)) |
| | | { |
| | | //show_message($_LANG['favourable_not_exist']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['favourable_not_exist']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 判断用户能否享受该优惠 */ |
| | | if (!favourable_available($favourable)) |
| | | { |
| | | //show_message($_LANG['favourable_not_available']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['favourable_not_available']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查购物车中是否已有该优惠 */ |
| | | $cart_favourable = cart_favourable(); |
| | | if (favourable_used($favourable, $cart_favourable)) |
| | | { |
| | | //show_message($_LANG['favourable_used']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['favourable_used']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $_POST['gift'] = array_filter(explode(',',$_POST['gift'])); |
| | | |
| | | /* 赠品(特惠品)优惠 */ |
| | | if ($favourable['act_type'] == FAT_GOODS) |
| | | { |
| | | /* 检查是否选择了赠品 */ |
| | | if (empty($_POST['gift'])) |
| | | { |
| | | //show_message($_LANG['pls_select_gift']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['pls_select_gift']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 www.68ecshop.com |
| | | /* 检查是否已在购物车 */ |
| | | $sql = "SELECT goods_name" . |
| | | " FROM " . $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | " AND rec_type = '" . CART_GENERAL_GOODS . "'" . |
| | | " AND is_gift = '$act_id'" . |
| | | " AND goods_id " . db_create_in($_POST['gift']); |
| | | $gift_name = $db->getCol($sql); |
| | | if (!empty($gift_name)) |
| | | { |
| | | //show_message(sprintf($_LANG['gift_in_cart'], join(',', $gift_name))); |
| | | $result['error'] = 1; |
| | | $result['message'] = sprintf($_LANG['gift_in_cart'], join(',', $gift_name)); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查数量是否超过上限 */ |
| | | $count = isset($cart_favourable[$act_id]) ? $cart_favourable[$act_id] : 0; |
| | | if ($favourable['act_type_ext'] > 0 && $count + count($_POST['gift']) > $favourable['act_type_ext']) |
| | | { |
| | | //show_message($_LANG['gift_count_exceed']); |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['gift_count_exceed']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 添加赠品到购物车 */ |
| | | foreach ($favourable['gift'] as $gift) |
| | | { |
| | | if (in_array($gift['id'], $_POST['gift'])) |
| | | { |
| | | add_gift_to_cart($act_id, $gift['id'], $gift['price']); |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_DISCOUNT) |
| | | { |
| | | add_favourable_to_cart($act_id, $favourable['act_name'], cart_favourable_amount($favourable) * (100 - $favourable['act_type_ext']) / 100); |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_PRICE) |
| | | { |
| | | add_favourable_to_cart($act_id, $favourable['act_name'], $favourable['act_type_ext']); |
| | | } |
| | | |
| | | die($json->encode($result)); |
| | | /* 刷新购物车 */ |
| | | ecs_header("Location: flow.php\n"); |
| | | exit; |
| | | } |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- 删除购物车中的商品 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | elseif ($_REQUEST['step'] == 'drop_goods') |
| | | { |
| | | $result = array('error' => 0, 'message' => '', 'content' => ''); |
| | | $rec_id = intval($_GET['id']); |
| | | flow_drop_cart_goods($rec_id); |
| | | |
| | | die($json->encode($result)); |
| | | ecs_header("Location: flow.php\n"); |
| | | exit; |
| | | } |
| | | |
| | | /* |
| | | * 结算页面 |
| | | */ |
| | | elseif ($_REQUEST['step'] == 'checkout') |
| | | { |
| | | $result = array('error' => 0, 'result' => ''); |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- 订单确认 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | /* |
| | | * 检查用户是否已经登录 |
| | | * 如果没有登录则跳转到登录和注册页面 |
| | | */ |
| | | if ($_SESSION['user_id'] == 0) |
| | | { |
| | | $result['error'] = 2; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | exit; |
| | | } |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | /* 积分兑换商品 */ |
| | | elseif ($flow_type == CART_EXCHANGE_GOODS) |
| | | { |
| | | $smarty->assign('is_exchange_goods', 1); |
| | | } |
| | | else |
| | | { |
| | | //正常购物流程 清空其他购物流程情况 |
| | | $_SESSION['flow_order']['extension_code'] = ''; |
| | | } |
| | | |
| | | if($flow_type != CART_EXCHANGE_GOODS){ |
| | | //非积分兑换形式的商品 |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | $sel_cartgoods_count = count($_REQUEST['sel_cartgoods']); |
| | | $_SESSION['sel_cartgoods'] = $sel_cartgoods_count>0 ? (implode(",", $_REQUEST['sel_cartgoods'])) : $_SESSION['sel_cartgoods']; |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | |
| | | //验证购物车中提交过来的商品中参加的活动是否都正常start |
| | | $_REQUEST['sel_goods'] = $_SESSION['sel_cartgoods']; |
| | | $favourable_list = favourable_list($_SESSION['user_rank'],false); |
| | | if($favourable_list){ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | foreach($favourable_list as $fk=>$fv){ |
| | | if(!$fv['available']){ |
| | | $sql = "select count(rec_id) as num from ". $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND is_gift = ".$fv['act_id']; |
| | | if($db->getOne($sql) > 0){ |
| | | $result['error'] = 1; |
| | | $result['result'] = '购物车中参加['.$fv['act_name'].']活动的商品未满足条件,请重新设置或者将其赠品删除'; |
| | | die($json->encode($result)); |
| | | //show_message('购物车中参加['.$fv['act_name'].']活动的商品未满足条件,请重新设置或者将其赠品删除', '', '', 'warning'); |
| | | } |
| | | } |
| | | } |
| | | unset($sql_where); |
| | | } |
| | | |
| | | //验证购物车中提交过来的商品中参加的活动是否都正常end |
| | | } |
| | | |
| | | /* 检查购物车中是否有商品 */ |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | |
| | | $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND parent_id = 0 AND is_gift = 0 AND rec_type = '$flow_type'"; |
| | | |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | if ($db->getOne($sql) == 0) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | //show_message($_LANG['no_goods_in_cart'], '', '', 'warning'); |
| | | } |
| | | |
| | | /* |
| | | * 检查用户是否已经登录 |
| | | * 如果用户已经登录了则检查是否有默认的收货地址 |
| | | * 如果没有登录则跳转到登录和注册页面 |
| | | */ |
| | | if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0) |
| | | { |
| | | /* 用户没有登录且没有选定匿名购物,转向到登录页面 */ |
| | | $result['error'] = 2; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | |
| | | // ecs_header("Location: flow.php?step=login\n"); |
| | | //exit; |
| | | } |
| | | |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | //$smarty->assign('consignee', $consignee); |
| | | if(!empty($consignee) && $_SESSION['user_id'] > 0){ |
| | | $consignee['address_short_name'] .= get_region_info($consignee['province'])."-"; |
| | | $consignee['address_short_name'] .= get_region_info($consignee['city'])."-"; |
| | | $consignee['address_short_name'] .= get_region_info($consignee['district'])." "; |
| | | $consignee['address_short_name'] .= sub_str($consignee['address'],16); |
| | | $consignee['address_short_name'] .= $consignee['zipcode'] ? (",".$consignee['zipcode']) : ""; |
| | | } |
| | | |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | $smarty->assign('consignee_list', $consignee); |
| | | $smarty->assign('shop_province_list', get_regions(1, $_CFG['shop_country'])); |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | /* |
| | | * 分供货商显示商品 |
| | | */ |
| | | $cart_ids = $cart_goods_new = array(); |
| | | if(count($cart_goods)>0){ |
| | | foreach($cart_goods as $key => $val){ |
| | | $cart_goods_new[$val['supplier_id']]['goodlist'][] = $val; |
| | | $cart_ids[] = $val['rec_id']; |
| | | } |
| | | } |
| | | $_SESSION['sel_cartgoods'] = (isset($_SESSION['sel_cartgoods']) && !empty($_SESSION['sel_cartgoods'])) ? $_SESSION['sel_cartgoods'] : implode(',',$cart_ids);//针对app添加 |
| | | |
| | | if ($flow_type != CART_EXCHANGE_GOODS && $flow_type != CART_GROUP_BUY_GOODS) |
| | | { |
| | | foreach($cart_goods_new as $k => $v){ |
| | | $discount = compute_discount($k); |
| | | if(is_array($discount)){ |
| | | $cart_goods_new[$k]['zhekou']['discount'] = $discount['discount']; |
| | | $favour_name = empty($discount['name']) ? '' : join(',', $discount['name']); |
| | | $cart_goods_new[$k]['zhekou']['your_discount'] = sprintf($_LANG['your_discount'], $favour_name, price_format($discount['discount'])); |
| | | } |
| | | } |
| | | } |
| | | /* 对是否允许修改购物车赋值 */ |
| | | if ($flow_type != CART_GENERAL_GOODS || $_CFG['one_step_buy'] == '1') |
| | | { |
| | | $smarty->assign('allow_edit_cart', 0); |
| | | } |
| | | else |
| | | { |
| | | $smarty->assign('allow_edit_cart', 1); |
| | | } |
| | | |
| | | /* |
| | | * 取得购物流程设置 |
| | | */ |
| | | $smarty->assign('config', $_CFG); |
| | | /* |
| | | * 取得订单信息 |
| | | */ |
| | | $order = flow_order_info(); |
| | | //file_put_contents('./order.txt',var_export($order,true)); |
| | | $smarty->assign('order', $order); |
| | | |
| | | /* |
| | | * 计算订单的费用 |
| | | */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | |
| | | |
| | | $smarty->assign('total', $total); |
| | | $smarty->assign('shopping_money', sprintf($_LANG['shopping_money'], $total['formated_goods_price'])); |
| | | $smarty->assign('market_price_desc', sprintf($_LANG['than_market_price'], $total['formated_market_price'], $total['formated_saving'], $total['save_rate'])); |
| | | |
| | | |
| | | /* 取得配送列表 */ |
| | | $region = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']); |
| | | $shipping_list = available_shipping_list($region); |
| | | $cart_weight_price = cart_weight_price($flow_type); |
| | | $insure_disabled = true; |
| | | $cod_disabled = true; |
| | | |
| | | // 查看购物车中是否全为免运费商品,若是则把运费赋为零 |
| | | //$sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE `session_id` = '" . SESS_ID. "' AND `extension_code` != 'package_buy' AND `is_shipping` = 0"; |
| | | $sql = 'SELECT count(*) FROM ' . $ecs->table('cart') . " WHERE $sql_where AND `extension_code` != 'package_buy' AND `is_shipping` = 0"; |
| | | $shipping_count = $db->getOne($sql); |
| | | |
| | | foreach ($shipping_list AS $key => $val) |
| | | { |
| | | $shipping_cfg = unserialize_config($val['configure']); |
| | | $shipping_fee = ($shipping_count == 0 AND $cart_weight_price['free_shipping'] == 1) ? 0 : shipping_fee($val['shipping_code'], unserialize($val['configure']), |
| | | $cart_weight_price['weight'], $cart_weight_price['amount'], $cart_weight_price['number']); |
| | | |
| | | $shipping_list[$key]['format_shipping_fee'] = price_format($shipping_fee, false); |
| | | $shipping_list[$key]['shipping_fee'] = $shipping_fee; |
| | | $shipping_list[$key]['free_money'] = price_format($shipping_cfg['free_money'], false); |
| | | $shipping_list[$key]['insure_formated'] = strpos($val['insure'], '%') === false ? |
| | | price_format($val['insure'], false) : $val['insure']; |
| | | |
| | | /* 当前的配送方式是否支持保价 */ |
| | | if ($val['shipping_id'] == $order['shipping_id']) |
| | | { |
| | | $insure_disabled = ($val['insure'] == 0); |
| | | $cod_disabled = ($val['support_cod'] == 0); |
| | | } |
| | | } |
| | | |
| | | $smarty->assign('shipping_list', $shipping_list); |
| | | $smarty->assign('insure_disabled', $insure_disabled); |
| | | $smarty->assign('cod_disabled', $cod_disabled); |
| | | |
| | | /* 取得支付列表 */ |
| | | if ($order['shipping_id'] == 0) |
| | | { |
| | | $cod = true; |
| | | $cod_fee = 0; |
| | | } |
| | | else |
| | | { |
| | | $shipping = shipping_info($order['shipping_id']); |
| | | $cod = $shipping['support_cod']; |
| | | |
| | | if ($cod) |
| | | { |
| | | /* 如果是团购,且保证金大于0,不能使用货到付款 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $group_buy_id = $_SESSION['extension_id']; |
| | | if ($group_buy_id <= 0) |
| | | { |
| | | //show_message('error group_buy_id'); |
| | | $result['error'] = 1; |
| | | $result['result'] = 'error group_buy_id'; |
| | | die($json->encode($result)); |
| | | } |
| | | $group_buy = group_buy_info($group_buy_id); |
| | | if (empty($group_buy)) |
| | | { |
| | | //show_message('group buy not exists: ' . $group_buy_id); |
| | | $result['error'] = 1; |
| | | $result['result'] = 'group buy not exists: ' . $group_buy_id; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | if ($group_buy['deposit'] > 0) |
| | | { |
| | | $cod = false; |
| | | $cod_fee = 0; |
| | | |
| | | /* 赋值保证金 */ |
| | | $smarty->assign('gb_deposit', $group_buy['deposit']); |
| | | } |
| | | } |
| | | |
| | | if ($cod) |
| | | { |
| | | $shipping_area_info = shipping_area_info($order['shipping_id'], $region); |
| | | $cod_fee = $shipping_area_info['pay_fee']; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $cod_fee = 0; |
| | | } |
| | | } |
| | | |
| | | // 给货到付款的手续费加<span id>,以便改变配送的时候动态显示 |
| | | $payment_list = available_payment_list(1, $cod_fee); |
| | | if(isset($payment_list)) |
| | | { |
| | | foreach ($payment_list as $key => $payment) |
| | | { |
| | | if ($payment['is_cod'] == '1') |
| | | { |
| | | $payment_list[$key]['format_pay_fee'] = '<span id="ECS_CODFEE">' . $payment['format_pay_fee'] . '</span>'; |
| | | } |
| | | /* 如果有易宝神州行支付 如果订单金额大于300 则不显示 */ |
| | | if ($payment['pay_code'] == 'yeepayszx' && $total['amount'] > 300) |
| | | { |
| | | unset($payment_list[$key]); |
| | | } |
| | | /* 如果有余额支付 */ |
| | | if ($payment['pay_code'] == 'balance') |
| | | { |
| | | /* 如果未登录,不显示 */ |
| | | if ($_SESSION['user_id'] == 0) |
| | | { |
| | | unset($payment_list[$key]); |
| | | } |
| | | else |
| | | { |
| | | if ($_SESSION['flow_order']['pay_id'] == $payment['pay_id']) |
| | | { |
| | | $smarty->assign('disable_surplus', 1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | $smarty->assign('payment_list', $payment_list); |
| | | |
| | | |
| | | $user_info = user_info($_SESSION['user_id']); |
| | | |
| | | |
| | | /* 如果使用余额,取得用户余额 */ |
| | | if ((!isset($_CFG['use_surplus']) || $_CFG['use_surplus'] == '1') |
| | | && $_SESSION['user_id'] > 0 |
| | | && $user_info['user_money'] > 0) |
| | | { |
| | | // 能使用余额 |
| | | $smarty->assign('allow_use_surplus', 1); |
| | | $smarty->assign('your_surplus', $user_info['user_money']); |
| | | } |
| | | |
| | | /* 如果使用积分,取得用户可用积分及本订单最多可以使用的积分 */ |
| | | if ((!isset($_CFG['use_integral']) || $_CFG['use_integral'] == '1') |
| | | && $_SESSION['user_id'] > 0 |
| | | && $user_info['pay_points'] > 0 |
| | | && ($flow_type != CART_GROUP_BUY_GOODS && $flow_type != CART_EXCHANGE_GOODS)) |
| | | { |
| | | // 能使用积分 |
| | | $keyong = flow_available_points();// 可用积分 |
| | | foreach($keyong as $k=>$v){ |
| | | $cart_goods_new[$k]['jifen'] = $v; |
| | | } |
| | | |
| | | $smarty->assign('allow_use_integral', 1); |
| | | //$smarty->assign('order_max_integral', $keyong); |
| | | $smarty->assign('your_integral', $user_info['pay_points']); // 用户积分 |
| | | } |
| | | |
| | | /* 如果使用红包,取得用户可以使用的红包及用户选择的红包 */ |
| | | if ((!isset($_CFG['use_bonus']) || $_CFG['use_bonus'] == '1') |
| | | && ($flow_type != CART_GROUP_BUY_GOODS && $flow_type != CART_EXCHANGE_GOODS)) |
| | | { |
| | | // 取得用户可用红包 |
| | | $user_bonus = user_bonus($_SESSION['user_id'], $total['goods_price']); |
| | | if (!empty($user_bonus)) |
| | | { |
| | | foreach ($user_bonus AS $key => $val) |
| | | { |
| | | $user_bonus[$key]['bonus_money_formated'] = price_format($val['type_money'], false); |
| | | if(isset($cart_goods_new[$val['supplier_id']])){ |
| | | $cart_goods_new[$val['supplier_id']]['redbag'][] = $user_bonus[$key]; |
| | | } |
| | | } |
| | | //file_put_contents('./goodslist.txt',var_export($cart_goods_new,true)); |
| | | |
| | | $smarty->assign('bonus_list', $user_bonus); |
| | | } |
| | | |
| | | // 能使用红包 |
| | | $smarty->assign('allow_use_bonus', 1); |
| | | } |
| | | //jx 添加发票插件 |
| | | /* 如果能开发票,取得发票内容列表 */ |
| | | if ((!isset($_CFG['can_invoice']) || $_CFG['can_invoice'] == '1') |
| | | && isset($_CFG['invoice_content']) |
| | | && trim($_CFG['invoice_content']) != '' && $flow_type != CART_EXCHANGE_GOODS) |
| | | { |
| | | $inv_content_list = explode("\n", str_replace("\r", '', $_CFG['invoice_content'])); |
| | | $smarty->assign('inv_content_list', $inv_content_list); |
| | | |
| | | $inv_type_list = array(); |
| | | foreach ($_CFG['invoice_type']['type'] as $key => $type) |
| | | { |
| | | /*增值税发票_更改_START_www.68ecshop.com*/ |
| | | if (!empty($type)&&$_CFG['invoice_type']['enable'][$key]=='1') |
| | | { |
| | | $inv_type_list[$type] = $_LANG[$type] . ' [' . floatval($_CFG['invoice_type']['rate'][$key]) . '%]'; |
| | | } |
| | | /*增值税发票_更改_START_www.68ecshop.com*/ |
| | | } |
| | | $smarty->assign('inv_type_list', $inv_type_list); |
| | | $smarty->assign('province_list', get_regions(1, $_CFG['shop_country'])); |
| | | } |
| | | //jx 结束 |
| | | $smarty->assign('goods_list', $cart_goods_new); |
| | | |
| | | /* 如果使用缺货处理,取得缺货处理列表 */ |
| | | if (!isset($_CFG['use_how_oos']) || $_CFG['use_how_oos'] == '1') |
| | | { |
| | | if (is_array($GLOBALS['_LANG']['oos']) && !empty($GLOBALS['_LANG']['oos'])) |
| | | { |
| | | $smarty->assign('how_oos_list', $GLOBALS['_LANG']['oos']); |
| | | } |
| | | } |
| | | |
| | | /* 保存 session */ |
| | | $_SESSION['flow_order'] = $order; |
| | | |
| | | |
| | | $res['result'] = $smarty->fetch("checkout_app.lbi"); |
| | | $res['shipping_id'] = intval($order['shipping_id']); |
| | | die($json->encode($res)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'select_shipping') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变配送方式 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => 0,'message'=>'', 'content' => '', 'need_insure' => 0); |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $order['shipping_id'] = intval($_REQUEST['shipping']); |
| | | $regions = array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district']); |
| | | $shipping_info = shipping_area_info($order['shipping_id'], $regions); |
| | | |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 取得可以得到的积分和红包 */ |
| | | $smarty->assign('total_integral', cart_amount(false, $flow_type) - $total['bonus'] - $total['integral_money']); |
| | | $smarty->assign('total_bonus', price_format(get_total_bonus(), false)); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['cod_fee'] = $shipping_info['pay_fee']; |
| | | $result['support_cod'] = $shipping_info['support_cod']; |
| | | if (strpos($result['cod_fee'], '%') === false) |
| | | { |
| | | $result['cod_fee'] = price_format($result['cod_fee'], false); |
| | | } |
| | | |
| | | $result['need_insure'] = ($shipping_info['insure'] > 0) ? 1 : 0; |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | $result['supplier_shipping'] = $smarty->fetch('app/order_supplier_shipping_app.lbi'); |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | $result['pickup_content'] = ''; |
| | | if(intval($_REQUEST['pickup']) > 0){//目前没有此功能app端 |
| | | $sql = 'select * from ' . $ecs->table('pickup_point') . |
| | | ' where city_id=' . $consignee['city']; |
| | | $pickup_point_list = $db->getAll($sql); |
| | | $smarty->assign('pickup_point_list', $pickup_point_list); |
| | | $result['pickup_content'] = $smarty->fetch('library/pickup.lbi'); |
| | | } |
| | | } |
| | | |
| | | echo $json->encode($result); |
| | | exit; |
| | | } |
| | | |
| | | |
| | | elseif ($_REQUEST['step'] == 'select_insure') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 选定/取消配送的保价 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $_GET['insure'] = !empty($_GET['insure']) ? urldecode($_GET['insure']) : ''; |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $order['need_insure'] = intval($_REQUEST['insure']); |
| | | |
| | | |
| | | } |
| | | /* 保存 session */ |
| | | |
| | | |
| | | $_SESSION['flow_order'] = $order; |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | |
| | | die($json->encode($result)); |
| | | }elseif ($_REQUEST['step'] == 'change_needinv') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变发票的设置 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => '', 'content' => ''); |
| | | $json = new JSON(); |
| | | $_GET['inv_type'] = !empty($_GET['inv_type']) ? json_str_iconv(urldecode($_GET['inv_type'])) : ''; |
| | | $_GET['invPayee'] = !empty($_GET['invPayee']) ? json_str_iconv(urldecode($_GET['invPayee'])) : ''; |
| | | $_GET['inv_content'] = !empty($_GET['inv_content']) ? json_str_iconv(urldecode($_GET['inv_content'])) : ''; |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | if (isset($_GET['need_inv']) && intval($_GET['need_inv']) == 1) |
| | | { |
| | | $order['need_inv'] = 1; |
| | | $order['inv_type'] = trim(stripslashes($_GET['inv_type'])); |
| | | $order['inv_payee'] = trim(stripslashes($_GET['inv_payee'])); |
| | | $order['inv_content'] = trim(stripslashes($_GET['inv_content'])); |
| | | } |
| | | else |
| | | { |
| | | $order['need_inv'] = 0; |
| | | $order['inv_type'] = ''; |
| | | $order['inv_payee'] = ''; |
| | | $order['inv_content'] = ''; |
| | | } |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'select_payment') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变支付方式 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => '', 'content' => '', 'need_insure' => 0, 'payment' => 1); |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $order['pay_id'] = intval($_REQUEST['payment']); |
| | | $payment_info = payment_info($order['pay_id']); |
| | | $result['pay_code'] = $payment_info['pay_code']; |
| | | |
| | | /* 保存 session */ |
| | | $_SESSION['flow_order'] = $order; |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 取得可以得到的积分和红包 */ |
| | | $smarty->assign('total_integral', cart_amount(false, $flow_type) - $total['bonus'] - $total['integral_money']); |
| | | $smarty->assign('total_bonus', price_format(get_total_bonus(), false)); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('library/order_total_app.lbi'); |
| | | } |
| | | |
| | | echo $json->encode($result); |
| | | exit; |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'change_bonus') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变红包 |
| | | /*------------------------------------------------------ */ |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $bonus = bonus_info(intval($_GET['bonus'])); |
| | | |
| | | if ((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id'] && $bonus['supplier_id'] == $suppid) || intval($_GET['bonus']) == 0) |
| | | { |
| | | $bonus_info = (isset($order['bonus_id_info'])) ? $order['bonus_id_info'] : array(); |
| | | if(intval($_GET['bonus']) == 0){ |
| | | unset($bonus_info[$suppid]); |
| | | }else{ |
| | | $bonus_info[$suppid] = $_GET['bonus']; |
| | | } |
| | | $order['bonus_id_info'] = $bonus_info = array_filter($bonus_info); |
| | | $order['bonus_id'] = implode(',',$bonus_info);//intval($_GET['bonus']); |
| | | |
| | | $bonus_sn_info = (isset($order['bonus_sn_info'])) ? $order['bonus_sn_info'] : array(); |
| | | unset($bonus_sn_info[$suppid]); |
| | | $order['bonus_sn_info'] = $bonus_sn_info = array_filter($bonus_sn_info); |
| | | $order['bonus_sn'] = implode(',',$bonus_sn_info); |
| | | } |
| | | else |
| | | { |
| | | $order['bonus_id'] = 0; |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['invalid_bonus']; |
| | | } |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 验证红包序列号 */ |
| | | elseif ($_REQUEST['step'] == 'validate_bonus') |
| | | { |
| | | |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | |
| | | $bonus_sn = intval($_REQUEST['bonus_sn']); |
| | | if (is_numeric($bonus_sn) && $bonus_sn>0) |
| | | { |
| | | $bonus = bonus_info(0, $bonus_sn, $suppid); |
| | | } |
| | | else |
| | | { |
| | | $bonus = array(); |
| | | } |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | $bonus_info = (isset($order['bonus_sn_info'])) ? $order['bonus_sn_info'] : array(); |
| | | $bonus_id_info = (isset($order['bonus_id_info'])) ? $order['bonus_id_info'] : array(); |
| | | |
| | | |
| | | if (((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id']) || ($bonus['type_money'] > 0 && empty($bonus['user_id']))) && $bonus['supplier_id'] == $suppid && $bonus['order_id'] <= 0) |
| | | { |
| | | |
| | | //$order['bonus_kill'] = $bonus['type_money']; |
| | | $now = gmtime(); |
| | | if ($now > $bonus['use_end_date']) |
| | | { |
| | | |
| | | $order['bonus_sn'] = ''; |
| | | //$order['bonus_sn'] = implode(',',$bonus_info);//$bonus_sn; |
| | | $result['error'] = 1; |
| | | $result['message']=$_LANG['bonus_use_expire']; |
| | | } |
| | | else |
| | | { |
| | | $bonus_info[$suppid] = $bonus_sn; |
| | | $order['bonus_sn_info'] = $bonus_info = array_filter($bonus_info); |
| | | $order['bonus_sn'] = implode(',',$bonus_info);//$bonus_sn; |
| | | unset($bonus_id_info[$suppid]); |
| | | $order['bonus_id_info'] = $bonus_id_info = array_filter($bonus_id_info); |
| | | $order['bonus_id'] = implode(',',$bonus_id_info); |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | |
| | | if($total['goods_price']<$bonus['min_goods_amount']) |
| | | { |
| | | $order['bonus_id'] = ''; |
| | | /* 重新计算订单 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $result['error'] = 1; |
| | | $result['message'] = sprintf($_LANG['bonus_min_amount_error'], price_format($bonus['min_goods_amount'], false)); |
| | | } |
| | | |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $order['bonus_sn'] = '';//$bonus_sn; |
| | | $result['error'] = 1; |
| | | $result['message']=$_LANG['bonus_not_exist']; |
| | | } |
| | | //echo "<pre>"; |
| | | //print_r($order); |
| | | |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'change_integral') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变积分 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $points = floatval($_GET['points']); |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | $user_info = user_info($_SESSION['user_id']); |
| | | |
| | | |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | |
| | | $integral_info = (isset($order['integral_info'])) ? $order['integral_info'] : array(); |
| | | $integral_info[$suppid] = $points; |
| | | |
| | | $order['integral_info'] = $integral_info; |
| | | |
| | | $flow_points = flow_available_points(); // 该订单允许使用的积分 |
| | | $user_points = $user_info['pay_points']; // 用户的积分总数 |
| | | |
| | | //所有订单的总积分 |
| | | $points_all = array_sum($integral_info); |
| | | |
| | | if ($points_all > $user_points) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['integral_not_enough']; |
| | | } |
| | | elseif ($points > $flow_points[$suppid]) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = sprintf($_LANG['integral_too_much'], $flow_points[$suppid]); |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | $order['integral'] = $points_all; |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'change_surplus') |
| | | { |
| | | /*------------------------------------------------------ */ |
| | | //-- 改变余额 |
| | | /*------------------------------------------------------ */ |
| | | |
| | | $result = array('error' => 0,'message'=>'', 'content' => ''); |
| | | |
| | | $surplus = floatval($_GET['surplus']); |
| | | $result['suppid'] = $suppid = intval($_GET['suppid']); |
| | | $user_info = user_info($_SESSION['user_id']); |
| | | |
| | | /* 取得订单信息 */ |
| | | $order = flow_order_info(); |
| | | $surplus_info = (isset($order['surplus_info'])) ? $order['surplus_info'] : array(); |
| | | $surplus_info[$suppid] = $surplus; |
| | | |
| | | if ($user_info['user_money'] + $user_info['credit_line'] < array_sum($surplus_info)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['surplus_not_enough']; |
| | | } |
| | | else |
| | | { |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 取得购物流程设置 */ |
| | | $smarty->assign('config', $_CFG); |
| | | |
| | | /* 获得收货人信息 */ |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 对商品信息赋值 */ |
| | | $cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计 |
| | | |
| | | if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | $result['error'] = 1; |
| | | $result['message'] = $_LANG['no_goods_in_cart']; |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | $order['surplus_info'] = $surplus_info; |
| | | $order['surplus'] = array_sum($surplus_info);//$surplus; |
| | | |
| | | /* 计算订单的费用 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | $smarty->assign('total', $total); |
| | | |
| | | /* 团购标志 */ |
| | | if ($flow_type == CART_GROUP_BUY_GOODS) |
| | | { |
| | | $smarty->assign('is_group_buy', 1); |
| | | } |
| | | |
| | | $result['content'] = $smarty->fetch('app/order_total_app.lbi'); |
| | | } |
| | | } |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | elseif ($_REQUEST['step'] == 'done') |
| | | { |
| | | |
| | | $suppids = explode(',',$_POST['suppids']); |
| | | if(isset($_POST['bonus'])){ |
| | | $_POST['bonus'] = array_combine($suppids, explode(',',$_POST['bonus'])); |
| | | } |
| | | if(isset($_POST['bonus_sn'])){ |
| | | $_POST['bonus_sn'] = array_combine($suppids, explode(',',$_POST['bonus_sn'])); |
| | | } |
| | | if(isset($_POST['integral'])){ |
| | | $_POST['integral'] = array_combine($suppids, explode(',',$_POST['integral'])); |
| | | } |
| | | if(isset($_POST['surplus'])){ |
| | | $_POST['surplus'] = array_combine($suppids, explode(',',$_POST['surplus'])); |
| | | } |
| | | include_once('../includes/lib_clips.php'); |
| | | include_once('../includes/lib_payment.php'); |
| | | |
| | | $result = array('error'=>0,'result'=>''); |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | $id_ext =""; |
| | | if ($_SESSION['sel_cartgoods']) |
| | | { |
| | | $id_ext = " AND rec_id in (". $_SESSION['sel_cartgoods'] .") "; |
| | | } |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | |
| | | /* 取得购物类型 */ |
| | | $flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS; |
| | | |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | |
| | | |
| | | /* 检查购物车中是否有商品 */ |
| | | $sql = "SELECT COUNT(*) FROM " . $ecs->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND parent_id = 0 AND is_gift = 0 AND rec_type = '$flow_type'"; |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | if ($db->getOne($sql) == 0) |
| | | { |
| | | //show_message($_LANG['no_goods_in_cart'], '', '', 'warning'); |
| | | $result['error'] = 11; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查商品库存 */ |
| | | /* 如果使用库存,且下订单时减库存,则减少库存 */ |
| | | if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) |
| | | { |
| | | $cart_goods_stock = get_cart_goods(); |
| | | $_cart_goods_stock = array(); |
| | | foreach ($cart_goods_stock['goods_list'] as $value) |
| | | { |
| | | $_cart_goods_stock[$value['rec_id']] = $value['goods_number']; |
| | | } |
| | | flow_cart_stock($_cart_goods_stock); |
| | | unset($cart_goods_stock, $_cart_goods_stock); |
| | | } |
| | | |
| | | /* |
| | | * 检查用户是否已经登录 |
| | | * 如果用户已经登录了则检查是否有默认的收货地址 |
| | | * 如果没有登录则跳转到登录和注册页面 |
| | | */ |
| | | if (empty($_SESSION['direct_shopping']) && $_SESSION['user_id'] == 0) |
| | | { |
| | | $result['error'] = 2; |
| | | $result['result'] = '请先登陆!'; |
| | | die($json->encode($result)); |
| | | /* 用户没有登录且没有选定匿名购物,转向到登录页面 */ |
| | | ecs_header("Location: flow.php?step=login\n"); |
| | | exit; |
| | | } |
| | | |
| | | $consignee = get_consignee($_SESSION['user_id']); |
| | | |
| | | /* 检查收货人信息是否完整 */ |
| | | if (!check_consignee_info($consignee, $flow_type)) |
| | | { |
| | | /* 如果不完整则转向到收货人信息填写界面 */ |
| | | $result['error'] = 3; |
| | | $result['result'] = '请先设置收货地址'; |
| | | die($json->encode($result)); |
| | | ecs_header("Location: flow.php?step=consignee\n"); |
| | | exit; |
| | | } |
| | | |
| | | /* 订单中的商品 */ |
| | | $cart_goods = cart_goods($flow_type); |
| | | |
| | | $cart_goods_new = array(); |
| | | if(count($cart_goods)>0){ |
| | | foreach($cart_goods as $key => $val){ |
| | | $cart_goods_new[$val['supplier_id']]['goodlist'][$val['rec_id']] = $val; |
| | | $cart_goods_new[$val['supplier_id']]['referer'] = $val['seller']; |
| | | } |
| | | } |
| | | //echo "<pre>"; |
| | | //print_r($cart_goods); |
| | | //print_r($cart_goods_new); |
| | | |
| | | if (empty($cart_goods)) |
| | | { |
| | | //show_message($_LANG['no_goods_in_cart'], $_LANG['back_home'], './', 'warning'); |
| | | $result['error'] = 21; |
| | | $result['result'] = $_LANG['no_goods_in_cart']; |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /* 检查商品总额是否达到最低限购金额 */ |
| | | if ($flow_type == CART_GENERAL_GOODS && cart_amount(true, CART_GENERAL_GOODS) < $_CFG['min_goods_amount']) |
| | | { |
| | | //show_message(sprintf($_LANG['goods_amount_not_enough'], price_format($_CFG['min_goods_amount'], false))); |
| | | $result['error'] = 31; |
| | | $result['result'] = sprintf($_LANG['goods_amount_not_enough'], price_format($_CFG['min_goods_amount'], false)); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | |
| | | //此订单拆分订单后的订单信息 |
| | | $order_info = array(); |
| | | //组装拆分的子订单数组信息start |
| | | foreach ($cart_goods_new as $ckey=>$cval){ |
| | | |
| | | $cart_goods = $cval['goodlist']; |
| | | |
| | | $_POST['how_oos'] = isset($_POST['how_oos']) ? intval($_POST['how_oos']) : 0; |
| | | $_POST['card_message'] = isset($_POST['card_message']) ? compile_str($_POST['card_message']) : ''; |
| | | $_POST['inv_type'] = !empty($_POST['inv_type']) ? compile_str($_POST['inv_type']) : ''; |
| | | $_POST['inv_payee'] = isset($_POST['inv_payee']) ? compile_str($_POST['inv_payee']) : ''; |
| | | $_POST['inv_content'] = isset($_POST['inv_content']) ? compile_str($_POST['inv_content']) : ''; |
| | | $_POST['postscript'] = isset($_POST['postscript']) ? compile_str($_POST['postscript']) : ''; |
| | | |
| | | $order_integral = isset($_POST['integral']) ? $_POST['integral'] : array(); |
| | | $order_bonus_id = isset($_POST['bonus']) ? $_POST['bonus'] : array(); |
| | | $order_bonus_sn = isset($_POST['bonus_sn']) ? $_POST['bonus_sn'] : array(); |
| | | $order_surplus = isset($_POST['surplus']) ? $_POST['surplus'] : array(); |
| | | |
| | | $_POST['vat_invoice'] = isset($_POST['vat_invoice']) ? compile_str($_POST['vat_invoice']) : ''; |
| | | $_POST['normal_invoice'] = isset($_POST['normal_invoice']) ? compile_str($_POST['normal_invoice']) : ''; |
| | | //$_POST['danwei'] = isset($_POST['danwei']) ? compile_str($_POST['danwei']) : ''; |
| | | |
| | | $order = array( |
| | | 'shipping_id' => intval($_POST['shipping']), |
| | | 'pay_id' => intval($_POST['payment']), |
| | | 'pack_id' => isset($_POST['pack']) ? intval($_POST['pack']) : 0, |
| | | 'card_id' => isset($_POST['card']) ? intval($_POST['card']) : 0, |
| | | 'card_message' => trim($_POST['card_message']), |
| | | 'surplus' => isset($order_surplus[$ckey]) ? floatval($order_surplus[$ckey]) : 0.00, |
| | | 'integral' => isset($order_integral[$ckey]) ? intval($order_integral[$ckey]) : 0, |
| | | 'bonus_id' => isset($order_bonus_id[$ckey]) ? intval($order_bonus_id[$ckey]) : 0, |
| | | 'need_inv' => empty($_POST['need_inv']) ? 0 : 1, |
| | | //'inv_type' => $_POST['inv_type'], |
| | | // 'inv_payee' => trim($_POST['inv_payee']), |
| | | //s 'inv_content' => $_POST['inv_content'], |
| | | 'postscript' => trim($_POST['postscript']), |
| | | 'how_oos' => isset($_LANG['oos'][$_POST['how_oos']]) ? addslashes($_LANG['oos'][$_POST['how_oos']]) : '', |
| | | 'need_insure' => isset($_POST['need_insure']) ? intval($_POST['need_insure']) : 0, |
| | | 'user_id' => $_SESSION['user_id'], |
| | | 'add_time' => gmtime(), |
| | | 'order_status' => OS_UNCONFIRMED, |
| | | 'shipping_status' => SS_UNSHIPPED, |
| | | 'pay_status' => PS_UNPAYED, |
| | | 'agency_id' => get_agency_by_regions(array($consignee['country'], $consignee['province'], $consignee['city'], $consignee['district'])), |
| | | 'supplier_id' => $ckey, |
| | | 'need_inv' => 1,//empty($_POST['need_inv']) ? 0 : 1,// jx 发票是否开启 |
| | | //'inv_type' => isset($_POST['normal_invoice']) ? intval($_POST['vat_invoice']) : , |
| | | 'inv_content' => $_POST['cont'], |
| | | 'vat_inv_company_name' => $_POST['vat_inv_company_name'], |
| | | 'vat_inv_taxpayer_id' => $_POST['vat_inv_taxpayer_id'], |
| | | 'vat_inv_registration_address' => $_POST['vat_inv_registration_address'], |
| | | 'vat_inv_registration_phone' => $_POST['vat_inv_registration_phone'], |
| | | 'vat_inv_deposit_bank' => $_POST['vat_inv_deposit_bank'], |
| | | 'vat_inv_bank_account' => $_POST['vat_inv_bank_account'], |
| | | 'inv_consignee_name' => $_POST['inv_consignee_name'], |
| | | 'inv_consignee_phone' => $_POST['inv_consignee_phone'], |
| | | 'inv_consignee_country ' => '1', |
| | | 'inv_consignee_province' => $_POST['inv_consignee_province'], |
| | | 'inv_consignee_city' => $_POST['selCities'], |
| | | 'inv_consignee_district' => $_POST['selDistricts'], |
| | | 'inv_consignee_address' => $_POST['inv_consignee_address'] |
| | | ); |
| | | if($_POST['normal_invoice']) |
| | | { |
| | | $order['inv_type'] = $_POST['normal_invoice']; |
| | | if($_POST['danwei']) |
| | | { |
| | | $order['inv_payee'] = $_POST['danwei']; |
| | | }else |
| | | { |
| | | $order['inv_payee'] = '个人'; |
| | | } |
| | | $order['inv_payee_type'] = $_POST['oadio']; |
| | | $order['inv_payee_type'] = 'individual'; |
| | | |
| | | }else |
| | | { |
| | | $order['inv_type'] = $_POST['vat_invoice']; |
| | | } |
| | | |
| | | |
| | | /* 扩展信息 */ |
| | | if (isset($_SESSION['flow_type']) && intval($_SESSION['flow_type']) != CART_GENERAL_GOODS) |
| | | { |
| | | $order['extension_code'] = $_SESSION['extension_code']; |
| | | $order['extension_id'] = $_SESSION['extension_id']; |
| | | } |
| | | else |
| | | { |
| | | $order['extension_code'] = ''; |
| | | $order['extension_id'] = 0; |
| | | } |
| | | |
| | | /* 检查积分余额是否合法 */ |
| | | $user_id = $_SESSION['user_id']; |
| | | if ($user_id > 0) |
| | | { |
| | | $user_info = user_info($user_id); |
| | | |
| | | $order['surplus'] = min($order['surplus'], $user_info['user_money'] + $user_info['credit_line']); |
| | | if ($order['surplus'] < 0) |
| | | { |
| | | $order['surplus'] = 0; |
| | | } |
| | | |
| | | // 查询用户有多少积分 |
| | | $flow_points = flow_available_points(); // 该订单允许使用的积分 |
| | | $user_points = $user_info['pay_points']; // 用户的积分总数 |
| | | |
| | | $order['integral'] = min($order['integral'], $user_points, $flow_points[$ckey]); |
| | | if ($order['integral'] < 0) |
| | | { |
| | | $order['integral'] = 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $order['surplus'] = 0; |
| | | $order['integral'] = 0; |
| | | } |
| | | |
| | | /* 检查红包是否存在 */ |
| | | if ($order['bonus_id'] > 0) |
| | | { |
| | | $bonus = bonus_info($order['bonus_id']); |
| | | |
| | | if (empty($bonus) || $bonus['user_id'] != $user_id || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount_new(array_keys($cart_goods),true, $flow_type)) |
| | | { |
| | | $order['bonus_id'] = 0; |
| | | }else{ |
| | | |
| | | } |
| | | } |
| | | elseif (isset($_POST['bonus_sn'][$ckey])) |
| | | { |
| | | $bonus_sn = intval($_POST['bonus_sn'][$ckey]); |
| | | $bonus = bonus_info(0, $bonus_sn); |
| | | $now = gmtime(); |
| | | if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0 || $bonus['min_goods_amount'] > cart_amount_new(array_keys($cart_goods),true, $flow_type) || $now > $bonus['use_end_date']) |
| | | { |
| | | } |
| | | else |
| | | { |
| | | if ($user_id > 0) |
| | | { |
| | | $sql = "UPDATE " . $ecs->table('user_bonus') . " SET user_id = '$user_id' WHERE bonus_id = '$bonus[bonus_id]' LIMIT 1"; |
| | | $db->query($sql); |
| | | } |
| | | $order['bonus_id'] = '';//$bonus['bonus_id']; |
| | | $order['bonus_sn'] = $bonus_sn; |
| | | } |
| | | } |
| | | |
| | | /* 判断是不是实体商品 */ |
| | | foreach ($cart_goods AS $val) |
| | | { |
| | | /* 统计实体商品的个数 */ |
| | | if ($val['is_real']) |
| | | { |
| | | $is_real_good=1; |
| | | } |
| | | } |
| | | if(isset($is_real_good)) |
| | | { |
| | | $sql="SELECT shipping_id FROM " . $ecs->table('shipping') . " WHERE shipping_id=".$order['shipping_id'] ." AND enabled =1"; |
| | | if(!$db->getOne($sql)) |
| | | { |
| | | show_message($_LANG['flow_no_shipping']); |
| | | } |
| | | } |
| | | |
| | | /* 收货人信息 */ |
| | | foreach ($consignee as $key => $value) |
| | | { |
| | | $order[$key] = addslashes($value); |
| | | } |
| | | |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | $order['best_time'] = isset($_POST['best_time']) ? trim($_POST['best_time']) : ''; |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | |
| | | |
| | | /* 订单中的总额 */ |
| | | $total = order_fee($order, $cart_goods, $consignee); |
| | | |
| | | $order['bonus'] = $total['bonus']; |
| | | $order['goods_amount'] = $total['goods_price']; |
| | | $order['discount'] = $total['discount']; |
| | | $order['surplus'] = $total['surplus']; |
| | | $order['tax'] = $total['tax']; |
| | | |
| | | // 购物车中的商品能享受红包支付的总额 |
| | | $discount_amout = compute_discount_amount($ckey); |
| | | // 红包和积分最多能支付的金额为商品总额 |
| | | $temp_amout = $order['goods_amount'] - $discount_amout; |
| | | if ($temp_amout <= 0) |
| | | { |
| | | $order['bonus_id'] = 0; |
| | | } |
| | | |
| | | /* 配送方式 */ |
| | | if ($order['shipping_id'] > 0) |
| | | { |
| | | $shipping = shipping_info($order['shipping_id']); |
| | | $order['shipping_name'] = addslashes($shipping['shipping_name']); |
| | | } |
| | | $order['shipping_fee'] = $total['shipping_fee']; |
| | | $order['insure_fee'] = $total['shipping_insure']; |
| | | |
| | | /* 支付方式 */ |
| | | if ($order['pay_id'] > 0) |
| | | { |
| | | $payment = payment_info($order['pay_id']); |
| | | $order['pay_name'] = addslashes($payment['pay_name']); |
| | | } |
| | | $order['pay_fee'] = $total['pay_fee']; |
| | | $order['cod_fee'] = $total['cod_fee']; |
| | | |
| | | /* 商品包装 */ |
| | | if ($order['pack_id'] > 0) |
| | | { |
| | | $pack = pack_info($order['pack_id']); |
| | | $order['pack_name'] = addslashes($pack['pack_name']); |
| | | } |
| | | $order['pack_fee'] = $total['pack_fee']; |
| | | |
| | | /* 祝福贺卡 */ |
| | | if ($order['card_id'] > 0) |
| | | { |
| | | $card = card_info($order['card_id']); |
| | | $order['card_name'] = addslashes($card['card_name']); |
| | | } |
| | | $order['card_fee'] = $total['card_fee']; |
| | | |
| | | $order['order_amount'] = number_format($total['amount'], 2, '.', ''); |
| | | /*发票金额*/ |
| | | $order['inv_money'] = $order['order_amount'] ; |
| | | /*增值税发票_添加_END_www.68ecshop.com*/ |
| | | /* 如果全部使用余额支付,检查余额是否足够 */ |
| | | if ($payment['pay_code'] == 'balance' && $order['order_amount'] > 0) |
| | | { |
| | | if($order['surplus'] >0) //余额支付里如果输入了一个金额 |
| | | { |
| | | $order['order_amount'] = $order['order_amount'] + $order['surplus']; |
| | | $order['surplus'] = 0; |
| | | } |
| | | if ($order['order_amount'] > ($user_info['user_money'] + $user_info['credit_line'])) |
| | | { |
| | | //show_message($_LANG['balance_not_enough']); |
| | | $result['error'] = 41; |
| | | $result['result'] = $_LANG['balance_not_enough']; |
| | | die($json->encode($result)); |
| | | } |
| | | else |
| | | { |
| | | $order['surplus'] = $order['order_amount']; |
| | | $order['order_amount'] = 0; |
| | | } |
| | | } |
| | | |
| | | /* 如果订单金额为0(使用余额或积分或红包支付),修改订单状态为已确认、已付款 */ |
| | | if ($order['order_amount'] <= 0) |
| | | { |
| | | $order['order_status'] = OS_CONFIRMED; |
| | | $order['confirm_time'] = gmtime(); |
| | | $order['pay_status'] = PS_PAYED; |
| | | $order['pay_time'] = gmtime(); |
| | | $order['order_amount'] = 0; |
| | | } |
| | | |
| | | $order['integral_money'] = $total['integral_money']; |
| | | $order['integral'] = $total['integral']; |
| | | |
| | | if ($order['extension_code'] == 'exchange_goods') |
| | | { |
| | | $order['integral_money'] = 0; |
| | | $order['integral'] = $total['exchange_integral']; |
| | | } |
| | | |
| | | $order['from_ad'] = !empty($_SESSION['from_ad']) ? $_SESSION['from_ad'] : '0'; |
| | | //$order['referer'] = !empty($_SESSION['referer']) ? addslashes($_SESSION['referer']) : ''; |
| | | $order['referer'] = $cval['referer']; |
| | | |
| | | /* 记录扩展信息 */ |
| | | if ($flow_type != CART_GENERAL_GOODS) |
| | | { |
| | | $order['extension_code'] = $_SESSION['extension_code']; |
| | | $order['extension_id'] = $_SESSION['extension_id']; |
| | | } |
| | | |
| | | $affiliate = unserialize($_CFG['affiliate']); |
| | | if(isset($affiliate['on']) && $affiliate['on'] == 1 && $affiliate['config']['separate_by'] == 1) |
| | | { |
| | | //推荐订单分成 |
| | | $parent_id = get_affiliate(); |
| | | if($user_id == $parent_id) |
| | | { |
| | | $parent_id = 0; |
| | | } |
| | | } |
| | | elseif(isset($affiliate['on']) && $affiliate['on'] == 1 && $affiliate['config']['separate_by'] == 0) |
| | | { |
| | | //推荐注册分成 |
| | | $parent_id = 0; |
| | | } |
| | | else |
| | | { |
| | | //分成功能关闭 |
| | | $parent_id = 0; |
| | | } |
| | | $order['parent_id'] = $parent_id; |
| | | |
| | | /* 代码增加_start By www.ecshop68.com */ |
| | | /* 自提功能 |
| | | 获取订单确认页选择的自提点 |
| | | */ |
| | | $pickup_point = isset($_POST['pickup_point']) ? $_POST['pickup_point'] : 0; |
| | | if($pickup_point > 0) |
| | | $order['is_pickup'] = 1; |
| | | else |
| | | $order['is_pickup'] = 0; |
| | | $order['pickup_point'] = $pickup_point; |
| | | /* 代码增加_end By www.ecshop68.com */ |
| | | //$order['order_sn'] = get_order_sn(); |
| | | |
| | | if(count($order)>0){ |
| | | $order_info[$ckey] = $order; |
| | | } |
| | | unset($order); |
| | | } |
| | | //组装拆分的子订单数组信息end |
| | | |
| | | |
| | | //判断是否拆分为多个订单,多个订单就生成父订单id号 |
| | | $del_patent_id = 0; |
| | | if(count($order_info)>1){ |
| | | $error_no = 0; |
| | | do |
| | | { |
| | | $save['order_sn'] = get_order_sn(); //获取新订单号 |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), $save, 'INSERT'); |
| | | $error_no = $GLOBALS['db']->errno(); |
| | | |
| | | if ($error_no > 0 && $error_no != 1062) |
| | | { |
| | | die($GLOBALS['db']->errorMsg()); |
| | | } |
| | | } |
| | | while ($error_no == 1062); //如果是订单号重复则重新提交数据 |
| | | $del_patent_id = $parent_order_id = $db->insert_id(); |
| | | }else{ |
| | | $parent_order_id = 0; |
| | | } |
| | | |
| | | $all_order_amount = 0;//记录订单所需支付的总金额 |
| | | //用来展示用的数组数据 |
| | | $split_order = array(); |
| | | $split_order['sub_order_count'] = count($order_info); |
| | | //生成订单 |
| | | foreach($order_info as $ok=>$order){ |
| | | |
| | | $cart_goods = $cart_goods_new[$ok]['goodlist']; |
| | | |
| | | $id_ext_new = " AND rec_id in (". implode(',',array_keys($cart_goods)) .") "; |
| | | |
| | | //获取佣金id |
| | | $order['rebate_id'] = get_order_rebate($ok); |
| | | |
| | | //下单来源 |
| | | $order['froms'] = 'app'; |
| | | |
| | | $order['parent_order_id'] = $parent_order_id; |
| | | /* 插入订单表 */ |
| | | $error_no = 0; |
| | | do |
| | | { |
| | | $order['order_sn'] = get_order_sn(); //获取新订单号 |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), $order, 'INSERT'); |
| | | |
| | | $error_no = $GLOBALS['db']->errno(); |
| | | |
| | | if ($error_no > 0 && $error_no != 1062) |
| | | { |
| | | die($GLOBALS['db']->errorMsg()); |
| | | } |
| | | } |
| | | while ($error_no == 1062); //如果是订单号重复则重新提交数据 |
| | | |
| | | $new_order_id = $db->insert_id(); |
| | | $order['order_id'] = $new_order_id; |
| | | |
| | | $parent_order_id = ($parent_order_id>0) ? $parent_order_id : $new_order_id; |
| | | |
| | | /* 插入订单商品 下面这个SQL有修改 by www.ecshop68.com 注意末尾那个字段 */ |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | $sql = "INSERT INTO " . $ecs->table('order_goods') . "( " . |
| | | "order_id, goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ". |
| | | "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id, package_attr_id) ". |
| | | " SELECT '$new_order_id', goods_id, goods_name, goods_sn, product_id, goods_number, market_price, ". |
| | | "goods_price, goods_attr, is_real, extension_code, parent_id, is_gift, goods_attr_id, package_attr_id ". |
| | | " FROM " .$ecs->table('cart') . |
| | | " WHERE $sql_where AND rec_type = '$flow_type' "; //$id_ext_new |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | $db->query($sql); |
| | | /* 修改拍卖活动状态 */ |
| | | if ($order['extension_code']=='auction') |
| | | { |
| | | $sql = "UPDATE ". $ecs->table('goods_activity') ." SET is_finished='2' WHERE act_id=".$order['extension_id']; |
| | | $db->query($sql); |
| | | } |
| | | |
| | | /* 处理余额、积分、红包 */ |
| | | if ($order['user_id'] > 0 && $order['surplus'] > 0) |
| | | { |
| | | log_account_change($order['user_id'], $order['surplus'] * (-1), 0, 0, 0, sprintf($_LANG['pay_order'], $order['order_sn'])); |
| | | } |
| | | if ($order['user_id'] > 0 && $order['integral'] > 0) |
| | | { |
| | | log_account_change($order['user_id'], 0, 0, 0, $order['integral'] * (-1), sprintf($_LANG['pay_order'], $order['order_sn'])); |
| | | } |
| | | |
| | | |
| | | if ($order['bonus_id'] > 0 && $temp_amout > 0) |
| | | { |
| | | use_bonus($order['bonus_id'], $new_order_id); |
| | | } |
| | | |
| | | $split_order['suborder_list'][$ok]['order_sn'] = $order['order_sn']; |
| | | $split_order['suborder_list'][$ok]['order_amount_formated'] = price_format($order['order_amount']); |
| | | |
| | | |
| | | /* 如果使用库存,且下订单时减库存,则减少库存 */ |
| | | if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE) |
| | | { |
| | | change_order_goods_storage($order['order_id'], true, SDT_PLACE); |
| | | } |
| | | |
| | | /* 给商家发邮件 */ |
| | | /* 增加是否给客服发送邮件选项 */ |
| | | if ($_CFG['send_service_email'] && $_CFG['service_email'] != '') |
| | | { |
| | | $tpl = get_mail_template('remind_of_new_order'); |
| | | $smarty->assign('order', $order); |
| | | $smarty->assign('goods_list', $cart_goods); |
| | | $smarty->assign('shop_name', $_CFG['shop_name']); |
| | | $smarty->assign('send_date', date($_CFG['time_format'])); |
| | | $content = $smarty->fetch('str:' . $tpl['template_content']); |
| | | send_mail($_CFG['shop_name'], $_CFG['service_email'], $tpl['template_subject'], $content, $tpl['is_html']); |
| | | } |
| | | |
| | | /* 如果需要,发短信 */ |
| | | if ($_CFG['sms_order_placed'] == '1' && $_CFG['sms_shop_mobile'] != '') |
| | | { |
| | | // include_once('includes/cls_sms.php'); |
| | | //$sms = new sms(); |
| | | //$msg = $order['pay_status'] == PS_UNPAYED ? |
| | | // $_LANG['order_placed_sms'] : $_LANG['order_placed_sms'] . '[' . $_LANG['sms_paid'] . ']'; |
| | | // $sms->send($_CFG['sms_shop_mobile'], sprintf($msg, $order['consignee'], $order['tel']),'', 13,1); |
| | | } |
| | | /* 如果订单金额为0 处理虚拟卡 */ |
| | | if ($order['order_amount'] <= 0) |
| | | { |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | $sql = "SELECT goods_id, goods_name, goods_number AS num FROM ". |
| | | $GLOBALS['ecs']->table('cart') . |
| | | " WHERE is_real = 0 AND extension_code = 'virtual_card'". |
| | | " AND $sql_where AND rec_type = '$flow_type'"; |
| | | /* 代码增加_end By www.68ecshop.com */ |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | $virtual_goods = array(); |
| | | foreach ($res AS $row) |
| | | { |
| | | $virtual_goods['virtual_card'][] = array('goods_id' => $row['goods_id'], 'goods_name' => $row['goods_name'], 'num' => $row['num']); |
| | | } |
| | | |
| | | if ($virtual_goods AND $flow_type != CART_GROUP_BUY_GOODS) |
| | | { |
| | | /* 虚拟卡发货 */ |
| | | if (virtual_goods_ship($virtual_goods,$msg, $order['order_sn'], true)) |
| | | { |
| | | /* 如果没有实体商品,修改发货状态,送积分和红包 */ |
| | | $sql = "SELECT COUNT(*)" . |
| | | " FROM " . $ecs->table('order_goods') . |
| | | " WHERE order_id = '$order[order_id]' " . |
| | | " AND is_real = 1"; |
| | | if ($db->getOne($sql) <= 0) |
| | | { |
| | | /* 修改订单状态 */ |
| | | update_order($order['order_id'], array('shipping_status' => SS_SHIPPED, 'shipping_time' => gmtime())); |
| | | |
| | | /* 如果订单用户不为空,计算积分,并发给用户;发红包 */ |
| | | if ($order['user_id'] > 0) |
| | | { |
| | | /* 取得用户信息 */ |
| | | $user = user_info($order['user_id']); |
| | | |
| | | /* 计算并发放积分 */ |
| | | $integral = integral_to_give($order); |
| | | log_account_change($order['user_id'], 0, 0, intval($integral['rank_points']), intval($integral['custom_points']), sprintf($_LANG['order_gift_integral'], $order['order_sn'])); |
| | | |
| | | /* 发放红包 */ |
| | | send_order_bonus($order['order_id']); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | $all_order_amount += $order['order_amount']; |
| | | //user_uc_call('add_feed', array($order['order_id'], BUY_GOODS)); //推送feed到uc |
| | | } |
| | | /* 清空购物车 */ |
| | | clear_cart($flow_type); |
| | | /* 清除缓存,否则买了商品,但是前台页面读取缓存,商品数量不减少 */ |
| | | clear_all_files(); |
| | | |
| | | //删除父订单记录 |
| | | if($del_patent_id > 0){ |
| | | $sql="delete from ".$GLOBALS['ecs']->table('order_info')." where order_id='$del_patent_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | /* 代码增加_start By www.68ecshop.com */ |
| | | //$split_order = split_order($new_order_id); |
| | | $smarty->assign('split_order', $split_order); |
| | | /* 如果需要,发短信 */ |
| | | if(count($split_order['suborder_list']) > 0){ |
| | | foreach($split_order['suborder_list'] as $key => $val){ |
| | | $supplier_ids[$key] = $val['order_sn']; |
| | | } |
| | | } |
| | | |
| | | |
| | | //$supplier_ids = array_keys(); |
| | | include_once('../send.php'); |
| | | |
| | | send_sms($supplier_ids,'您有一条新订单,订单号为:ordersn请注意查看。【shopname】',1); |
| | | |
| | | /* 取得支付信息,生成支付代码 */ |
| | | if ($split_order['sub_order_count'] >1) |
| | | { |
| | | $order['order_sn'] = $parent_order_id; |
| | | /* 插入支付日志 */ |
| | | $order['log_id'] = insert_pay_log($order['order_sn'], $order['order_amount'], PAY_ORDER); |
| | | }else{ |
| | | /* 插入支付日志 */ |
| | | $order['log_id'] = insert_pay_log($order['order_id'], $order['order_amount'], PAY_ORDER); |
| | | } |
| | | $order['order_amount'] = $all_order_amount; //替换为总金额去支付 |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | if ($order['order_amount'] > 0) |
| | | { |
| | | $result['result']['order_sn'] = $order['order_sn']; |
| | | $result['result']['allmoney'] = $order['order_amount']; |
| | | |
| | | $payment = payment_info($order['pay_id']); |
| | | |
| | | include_once('../includes/modules/payment/' . $payment['pay_code'] . '.php'); |
| | | |
| | | $pay_obj = new $payment['pay_code']; |
| | | |
| | | $pay_online = $pay_obj->get_code($order, unserialize_config($payment['pay_config'])); |
| | | |
| | | $order['pay_desc'] = $payment['pay_desc']; |
| | | $result['result']['pay_code'] = $payment['pay_code']; |
| | | $result['result']['pay_online'] = $pay_online; |
| | | |
| | | //$smarty->assign('pay_online', $pay_online); |
| | | } |
| | | if(!empty($order['shipping_name'])) |
| | | { |
| | | $order['shipping_name']=trim(stripcslashes($order['shipping_name'])); |
| | | } |
| | | |
| | | /* 订单信息 */ |
| | | $smarty->assign('order', $order); |
| | | $smarty->assign('total', $total); |
| | | |
| | | unset($_SESSION['flow_consignee']); // 清除session中保存的收货人信息 |
| | | unset($_SESSION['flow_order']); |
| | | unset($_SESSION['direct_shopping']); |
| | | die($json->encode($result)); |
| | | } |
| | | |
| | | /** |
| | | * 取得某用户等级当前时间可以享受的优惠活动 |
| | | * @param int $user_rank 用户等级id,0表示非会员 |
| | | * @param int $is_have 是否判断已经选择赠品 |
| | | * @return array |
| | | */ |
| | | function favourable_list($user_rank,$is_have=true) |
| | | { |
| | | /* 购物车中已有的优惠活动及数量 */ |
| | | $used_list = cart_favourable(); |
| | | |
| | | /* 当前用户可享受的优惠活动 */ |
| | | $favourable_list = array(); |
| | | $user_rank = ',' . $user_rank . ','; |
| | | $now = gmtime(); |
| | | if(isset($_REQUEST['suppid'])){ |
| | | $tj = " AND supplier_id=".$_REQUEST['suppid']; |
| | | }else{ |
| | | $tj = ''; |
| | | } |
| | | $sql = "SELECT * " . |
| | | "FROM " . $GLOBALS['ecs']->table('favourable_activity') . |
| | | " WHERE CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'" . |
| | | " AND start_time <= '$now' AND end_time >= '$now'" .$tj. |
| | | " AND act_type = '" . FAT_GOODS . "'" . |
| | | " ORDER BY sort_order"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($favourable = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $favourable['start_time'] = local_date($GLOBALS['_CFG']['time_format'], $favourable['start_time']); |
| | | $favourable['end_time'] = local_date($GLOBALS['_CFG']['time_format'], $favourable['end_time']); |
| | | $favourable['formated_min_amount'] = price_format($favourable['min_amount'], false); |
| | | $favourable['formated_max_amount'] = price_format($favourable['max_amount'], false); |
| | | $favourable['gift'] = unserialize($favourable['gift']); |
| | | $_REQUEST['suppid'] = $favourable['supplier_id'] = $favourable['supplier_id']; |
| | | |
| | | foreach ($favourable['gift'] as $key => $value) |
| | | { |
| | | $favourable['gift'][$key]['formated_price'] = price_format($value['price'], false); |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods') . " WHERE is_on_sale = 1 AND goods_id = ".$value['id']; |
| | | $is_sale = $GLOBALS['db']->getOne($sql); |
| | | if(!$is_sale) |
| | | { |
| | | unset($favourable['gift'][$key]); |
| | | } |
| | | $goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$value['id']}'"); |
| | | $favourable['gift'][$key]['goods_thumb'] = get_image_path($value['id'], $goods_thumb, true); |
| | | } |
| | | |
| | | $favourable['act_range_desc'] = act_range_desc($favourable); |
| | | $favourable['act_type_desc'] = sprintf($GLOBALS['_LANG']['fat_ext'][$favourable['act_type']], $favourable['act_type_ext']); |
| | | |
| | | /* 是否能享受 */ |
| | | $favourable['available'] = favourable_available($favourable); |
| | | if ($favourable['available'] && $is_have) |
| | | { |
| | | /* 是否尚未享受 */ |
| | | $favourable['available'] = !favourable_used($favourable, $used_list); |
| | | } |
| | | $favourable_list[] = $favourable; |
| | | } |
| | | |
| | | |
| | | |
| | | return $favourable_list; |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车中已有的优惠活动及数量 |
| | | * @return array |
| | | */ |
| | | function cart_favourable() |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 www.68ecshop.com |
| | | $list = array(); |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql = "SELECT is_gift, COUNT(*) AS num " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | " AND rec_type = '" . CART_GENERAL_GOODS . "'" . |
| | | " AND is_gift > 0" . |
| | | " GROUP BY is_gift"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $list[$row['is_gift']] = $row['num']; |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 根据购物车判断是否可以享受某优惠活动 |
| | | * @param array $favourable 优惠活动信息 |
| | | * @return bool |
| | | */ |
| | | function favourable_available($favourable) |
| | | { |
| | | /* 会员等级是否符合 */ |
| | | $user_rank = $_SESSION['user_rank']; |
| | | if (strpos(',' . $favourable['user_rank'] . ',', ',' . $user_rank . ',') === false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /* 优惠范围内的商品总额 */ |
| | | $amount = cart_favourable_amount($favourable); |
| | | |
| | | /* 金额上限为0表示没有上限 */ |
| | | return $amount >= $favourable['min_amount'] && |
| | | ($amount <= $favourable['max_amount'] || $favourable['max_amount'] == 0); |
| | | } |
| | | |
| | | /** |
| | | * 购物车中是否已经有某优惠 |
| | | * @param array $favourable 优惠活动 |
| | | * @param array $cart_favourable购物车中已有的优惠活动及数量 |
| | | */ |
| | | function favourable_used($favourable, $cart_favourable) |
| | | { |
| | | if ($favourable['act_type'] == FAT_GOODS) |
| | | { |
| | | return isset($cart_favourable[$favourable['act_id']]) && |
| | | $cart_favourable[$favourable['act_id']] >= $favourable['act_type_ext'] && |
| | | $favourable['act_type_ext'] > 0; |
| | | } |
| | | else |
| | | { |
| | | return isset($cart_favourable[$favourable['act_id']]); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得优惠范围描述 |
| | | * @param array $favourable 优惠活动 |
| | | * @return string |
| | | */ |
| | | function act_range_desc($favourable) |
| | | { |
| | | if ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | $sql = "SELECT brand_name FROM " . $GLOBALS['ecs']->table('brand') . |
| | | " WHERE brand_id " . db_create_in($favourable['act_range_ext']); |
| | | return join(',', $GLOBALS['db']->getCol($sql)); |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | $sql = "SELECT cat_name FROM " . $GLOBALS['ecs']->table('category') . |
| | | " WHERE cat_id " . db_create_in($favourable['act_range_ext']); |
| | | return join(',', $GLOBALS['db']->getCol($sql)); |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_GOODS) |
| | | { |
| | | $sql = "SELECT goods_name FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id " . db_create_in($favourable['act_range_ext']); |
| | | return join(',', $GLOBALS['db']->getCol($sql)); |
| | | } |
| | | else |
| | | { |
| | | return ''; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车中某优惠活动范围内的总金额 |
| | | * @param array $favourable 优惠活动 |
| | | * @return float |
| | | */ |
| | | function cart_favourable_amount($favourable) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 ";//添加 www.68ecshop.com |
| | | /* 查询优惠范围内商品总额的sql */ |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql = "SELECT SUM(c.goods_price * c.goods_number) " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND $sql_where " . |
| | | "AND c.rec_type = '" . CART_GENERAL_GOODS . "' " . |
| | | "AND g.supplier_id=".$favourable['supplier_id']." ". |
| | | "AND c.is_gift = 0 " . |
| | | "AND c.goods_id > 0 "; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | |
| | | /* 根据优惠范围修正sql */ |
| | | if ($favourable['act_range'] == FAR_ALL) |
| | | { |
| | | // sql do not change |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | /* 取得优惠范围分类的所有下级分类 */ |
| | | $id_list = array(); |
| | | $cat_list = explode(',', $favourable['act_range_ext']); |
| | | foreach ($cat_list as $id) |
| | | { |
| | | $id_list = array_merge($id_list, array_keys(cat_list(intval($id), 0, false))); |
| | | } |
| | | |
| | | $sql .= "AND g.cat_id " . db_create_in($id_list); |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | $id_list = explode(',', $favourable['act_range_ext']); |
| | | |
| | | $sql .= "AND g.brand_id " . db_create_in($id_list); |
| | | } |
| | | else |
| | | { |
| | | $id_list = explode(',', $favourable['act_range_ext']); |
| | | |
| | | $sql .= "AND g.goods_id " . db_create_in($id_list); |
| | | } |
| | | |
| | | $sql .= (isset($_REQUEST['sel_goods']) && !empty($_REQUEST['sel_goods'])) ? " AND c.rec_id in (". $_REQUEST['sel_goods'] .") " : ""; |
| | | |
| | | //计算某个店铺的商品总额 |
| | | if(isset($_REQUEST['suppid'])){ |
| | | $sql .= " AND g.supplier_id=".intval($_REQUEST['suppid']); |
| | | } |
| | | //echo $sql; |
| | | |
| | | /* 优惠范围内的商品总额 */ |
| | | return $GLOBALS['db']->getOne($sql); |
| | | } |
| | | |
| | | /** |
| | | * 添加优惠活动(赠品)到购物车 |
| | | * @param int $act_id 优惠活动id |
| | | * @param int $id 赠品id |
| | | * @param float $price 赠品价格 |
| | | */ |
| | | function add_gift_to_cart($act_id, $id, $price) |
| | | { |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('cart') . " (" . |
| | | "user_id, session_id, goods_id, goods_sn, goods_name, market_price, goods_price, ". |
| | | "goods_number, is_real, extension_code, parent_id, is_gift, rec_type ) ". |
| | | "SELECT '$_SESSION[user_id]', '" . SESS_ID . "', goods_id, goods_sn, goods_name, market_price, ". |
| | | "'$price', 1, is_real, extension_code, 0, '$act_id', '" . CART_GENERAL_GOODS . "' " . |
| | | "FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id = '$id'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 删除购物车中的商品 |
| | | * |
| | | * @access public |
| | | * @param integer $id |
| | | * @return void |
| | | */ |
| | | function flow_drop_cart_goods($id) |
| | | { |
| | | /* 取得商品id */ |
| | | $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('cart'). " WHERE rec_id = '$id'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | if ($row) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 www.68ecshop.com |
| | | //如果是超值礼包 |
| | | if ($row['extension_code'] == 'package_buy') |
| | | { |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_id = '$id' LIMIT 1"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | } |
| | | |
| | | //如果是普通商品,同时删除所有赠品及其配件 |
| | | elseif ($row['parent_id'] == 0 && $row['is_gift'] == 0) |
| | | { |
| | | /* 检查购物车中该普通商品的不可单独销售的配件并删除 */ |
| | | $sql = "SELECT c.rec_id |
| | | FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('group_goods') . " AS gg, " . $GLOBALS['ecs']->table('goods'). " AS g |
| | | WHERE gg.parent_id = '" . $row['goods_id'] . "' |
| | | AND c.goods_id = gg.goods_id |
| | | AND c.parent_id = '" . $row['goods_id'] . "' |
| | | AND c.extension_code <> 'package_buy' |
| | | AND gg.goods_id = g.goods_id |
| | | AND g.is_alone_sale = 0"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $_del_str = $id . ','; |
| | | while ($id_alone_sale_goods = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $_del_str .= $id_alone_sale_goods['rec_id'] . ','; |
| | | } |
| | | $_del_str = trim($_del_str, ','); |
| | | |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND (rec_id IN ($_del_str) OR parent_id = '$row[goods_id]' OR is_gift <> 0)"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | } |
| | | |
| | | //如果不是普通商品,只删除该商品即可 |
| | | else |
| | | { |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_id = '$id' LIMIT 1"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | } |
| | | |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | flow_clear_cart_alone(); |
| | | } |
| | | |
| | | /** |
| | | * 删除购物车中不能单独销售的商品 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function flow_clear_cart_alone() |
| | | { |
| | | /* 查询:购物车中所有不可以单独销售的配件 */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 ";//添加 www.68ecshop.com |
| | | |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql = "SELECT c.rec_id, gg.parent_id |
| | | FROM " . $GLOBALS['ecs']->table('cart') . " AS c |
| | | LEFT JOIN " . $GLOBALS['ecs']->table('group_goods') . " AS gg ON c.goods_id = gg.goods_id |
| | | LEFT JOIN" . $GLOBALS['ecs']->table('goods') . " AS g ON c.goods_id = g.goods_id |
| | | WHERE $sql_where |
| | | AND c.extension_code <> 'package_buy' |
| | | AND gg.parent_id > 0 |
| | | AND g.is_alone_sale = 0"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $rec_id = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $rec_id[$row['rec_id']][] = $row['parent_id']; |
| | | } |
| | | |
| | | if (empty($rec_id)) |
| | | { |
| | | return; |
| | | } |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 ";//添加 www.68ecshop.com |
| | | |
| | | |
| | | /* 查询:购物车中所有商品 */ |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql = "SELECT DISTINCT goods_id |
| | | FROM " . $GLOBALS['ecs']->table('cart') . " |
| | | WHERE $sql_where |
| | | AND extension_code <> 'package_buy'"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $cart_good = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $cart_good[] = $row['goods_id']; |
| | | } |
| | | |
| | | if (empty($cart_good)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | /* 如果购物车中不可以单独销售配件的基本件不存在则删除该配件 */ |
| | | $del_rec_id = ''; |
| | | foreach ($rec_id as $key => $value) |
| | | { |
| | | foreach ($value as $v) |
| | | { |
| | | if (in_array($v, $cart_good)) |
| | | { |
| | | continue 2; |
| | | } |
| | | } |
| | | |
| | | $del_rec_id = $key . ','; |
| | | } |
| | | $del_rec_id = trim($del_rec_id, ','); |
| | | |
| | | if ($del_rec_id == '') |
| | | { |
| | | return; |
| | | } |
| | | |
| | | /* 删除 */ |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') ." |
| | | WHERE $sql_where |
| | | AND rec_id IN ($del_rec_id)"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 获得用户的可用积分 |
| | | * |
| | | * @access private |
| | | * @return integral |
| | | */ |
| | | function flow_available_points() |
| | | { |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT SUM(g.integral * c.goods_number) as integral,g.supplier_id ". |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE $sql_where AND c.goods_id = g.goods_id AND c.is_gift = 0 AND g.integral > 0 " . |
| | | "AND c.rec_type = '" . CART_GENERAL_GOODS . "' GROUP BY g.supplier_id"; |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | $info = $GLOBALS['db']->getAll($sql); |
| | | $ret = array(); |
| | | foreach($info as $key => $val){ |
| | | $ret[$val['supplier_id']] = integral_of_value(intval($val['integral'])); |
| | | } |
| | | return $ret; |
| | | } |
| | | |
| | | /** |
| | | * 检查订单中商品库存 |
| | | * |
| | | * @access public |
| | | * @param array $arr |
| | | * |
| | | * @return void |
| | | */ |
| | | function flow_cart_stock($arr) |
| | | { |
| | | foreach ($arr AS $key => $val) |
| | | { |
| | | $val = intval(make_semiangle($val)); |
| | | if ($val <= 0 || !is_numeric($key)) |
| | | { |
| | | continue; |
| | | } |
| | | /* 代码修改_start By www.68ecshop.com 将这块替换掉*/ |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | $sql = "SELECT `goods_id`, `goods_attr_id`, `extension_code` FROM" .$GLOBALS['ecs']->table('cart'). |
| | | " WHERE rec_id='$key' AND $sql_where"; |
| | | $goods = $GLOBALS['db']->getRow($sql); |
| | | /* 代码修改_end By www.68ecshop.com */ |
| | | |
| | | $sql = "SELECT g.goods_name, g.goods_number, c.product_id ". |
| | | "FROM " .$GLOBALS['ecs']->table('goods'). " AS g, ". |
| | | $GLOBALS['ecs']->table('cart'). " AS c ". |
| | | "WHERE g.goods_id = c.goods_id AND c.rec_id = '$key'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | //系统启用了库存,检查输入的商品数量是否有效 |
| | | if (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] != 'package_buy') |
| | | { |
| | | if ($row['goods_number'] < $val) |
| | | { |
| | | show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], |
| | | $row['goods_number'], $row['goods_number'])); |
| | | exit; |
| | | } |
| | | |
| | | /* 是货品 */ |
| | | $row['product_id'] = trim($row['product_id']); |
| | | if (!empty($row['product_id'])) |
| | | { |
| | | $sql = "SELECT product_number FROM " .$GLOBALS['ecs']->table('products'). " WHERE goods_id = '" . $goods['goods_id'] . "' AND product_id = '" . $row['product_id'] . "'"; |
| | | $product_number = $GLOBALS['db']->getOne($sql); |
| | | if ($product_number < $val) |
| | | { |
| | | show_message(sprintf($GLOBALS['_LANG']['stock_insufficiency'], $row['goods_name'], |
| | | $row['goods_number'], $row['goods_number'])); |
| | | exit; |
| | | } |
| | | } |
| | | } |
| | | elseif (intval($GLOBALS['_CFG']['use_storage']) > 0 && $goods['extension_code'] == 'package_buy') |
| | | { |
| | | if (judge_package_stock($goods['goods_id'], $val)) |
| | | { |
| | | show_message($GLOBALS['_LANG']['package_stock_insufficiency']); |
| | | exit; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | /* |
| | | *判断商品最后的价格 |
| | | * goods_id 商品id |
| | | *number 商品数量 |
| | | *rec_id 购物车ID |
| | | * jx 2015-04-02 |
| | | **/ |
| | | function get_min_price($goods_id,$number,$rec_id) |
| | | { |
| | | $sql = "SELECT * FROM ".$GLOBALS['ecs']->table('cart')." WHERE goods_id = '$goods_id' AND rec_id = '$rec_id'"; |
| | | $res = $GLOBALS['db']->getRow($sql); |
| | | $attr_id = $res['goods_attr_id']; |
| | | //取得属性价格 开始 |
| | | if(empty($attr_id)) |
| | | { |
| | | $atr_price=0; |
| | | }else |
| | | { |
| | | $goods_att=explode(',',$attr_id); |
| | | foreach ($goods_att as $value) |
| | | { |
| | | if(!empty($value)) |
| | | { |
| | | $sql="SELECT `attr_price` FROM " .$GLOBALS['ecs']->table('goods_attr')." WHERE goods_id='$goods_id' AND `goods_attr_id`='$value'"; |
| | | $atr_price+=$GLOBALS['db']->getOne($sql); |
| | | } |
| | | |
| | | } |
| | | } |
| | | $sql = "SELECT volume_price FROM ".$GLOBALS['ecs']->table('volume_price')."WHERE goods_id = '$goods_id' AND volume_number <= '$number'"; |
| | | $volume = $GLOBALS['db']->getOne($sql);//优惠价格 |
| | | //属性价格 结束 |
| | | $user_id = $res['user_id']; |
| | | if($user_id == 0)//用户不存在 |
| | | { |
| | | if(!empty($atr_price))//存在属性价格 |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price = ($res['promote_price'] + $atr_price); |
| | | return $min_price; |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | //return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | } |
| | | return $min_price; |
| | | } |
| | | }else |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price = $res['promote_price']; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | } |
| | | } |
| | | |
| | | }else//用户存在 |
| | | { |
| | | $row = $GLOBALS['db'] -> getOne("SELECT rank_points FROM ".$GLOBALS['ecs']->table('users')." WHERE `user_id`='$user_id'"); |
| | | $sql = "SELECT rank_id FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE max_points > '$row' ORDER BY max_points ASC LIMIT 1"; |
| | | $rank_id = $GLOBALS['db']->getOne($sql);//取得会员等级 |
| | | |
| | | if(empty($rank_id)) |
| | | { |
| | | if(!empty($atr_price) && $atr_price != 0)//存在属性价格 |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price= ($res['promote_price'] + $atr_price); |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | } |
| | | }else |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | $min_price = $res['promote_price']; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | } |
| | | } |
| | | }else |
| | | { |
| | | if(!empty($atr_price) && $atr_price != 0)//存在属性价格 |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | |
| | | $rank_price = rank_price($rank_id,$res['shop_price']); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | if($res['promote_price'] > $rank_price) |
| | | { |
| | | $min_price= ($rank_price + $atr_price); |
| | | }else |
| | | { |
| | | $min_price= ($res['promote_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | }else |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price= ($rank_price + $atr_price); |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | } |
| | | |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price'],$rank_price);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price = ($rank_price + $atr_price); |
| | | }else |
| | | { |
| | | $min_price = ($res['shop_price'] + $atr_price); |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price']);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = ($min + $atr_price); |
| | | return $min_price; |
| | | } |
| | | } |
| | | }else |
| | | { |
| | | $sql = " SELECT * FROM ".$GLOBALS['ecs']->table('goods')."WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->getROW($sql); |
| | | $rank_price = rank_price($rank_id,$res['shop_price']); |
| | | if($res['is_promote'] == 1 && $res['promote_start_date'] < gmtime() && $res['promote_end_date'] > gmtime())//是促销商品 |
| | | { |
| | | if(empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $res['promote_price'])//本店价 > 促销价格 |
| | | { |
| | | if($res['promote_price'] > $rank_price) |
| | | { |
| | | $min_price = $rank_price; |
| | | }else |
| | | { |
| | | $min_price= $res['promote_price']; |
| | | } |
| | | return $min_price; |
| | | }else |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price = $rank_price; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | } |
| | | |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$res['promote_price'],$rank_price);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | }else//不是促销商品 |
| | | { |
| | | if($volume == '' && empty($volume))//不存在优惠价格 |
| | | { |
| | | if($res['shop_price'] > $rank_price) |
| | | { |
| | | $min_price = $rank_price; |
| | | }else |
| | | { |
| | | $min_price = $res['shop_price']; |
| | | } |
| | | return $min_price; |
| | | }else//存在优惠价格 |
| | | { |
| | | $min = min($volume,$res['shop_price'],$rank_price);//返回优惠 促销 本店 最小的价格 |
| | | $min_price = $min; |
| | | return $min_price; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | /* |
| | | * |
| | | *获取对应会员等级的优惠价格 |
| | | * |
| | | **/ |
| | | function rank_price($rank,$price) |
| | | { |
| | | $sql = "SELECT IFNULL(mp.user_price, r.discount * $price / 100) AS price " . |
| | | 'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ". |
| | | "ON mp.goods_id = '$goods_id' AND mp.user_rank = r.rank_id WHERE r.rank_id = '$rank'"; |
| | | $rank_price = $GLOBALS['db']->getOne($sql);//取得会员等级价格 |
| | | return $rank_price; |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * ��ҳ |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $result=array(); |
| | | |
| | | $first=$_GET['first']; |
| | | |
| | | $field=$_GET['field']; |
| | | |
| | | if($first=="Y"){ |
| | | |
| | | $article = $db -> getAll("SELECT article_id,title FROM ".$ecs->table('article')." WHERE cat_id= 2 AND is_open=1 order by article_id asc LIMIT 0 , 5"); |
| | | |
| | | $result['article']=$article; |
| | | |
| | | $banner = $db -> getAll("SELECT ad_name,ad_code,ad_link FROM ".$ecs->table('ad')." WHERE position_id='112' and start_time<='".time()."' and end_time>='".time()."' LIMIT 0 , 5"); |
| | | |
| | | $result['banner']=$banner; |
| | | |
| | | $result['topic_goods_tuijian'] = index_topic('tuijian');//推荐 |
| | | |
| | | $adList1 = $db -> getAll("SELECT ad_name,ad_code,ad_link FROM ".$ecs->table('ad')." WHERE position_id='113' and start_time<='".time()."' and end_time>='".time()."' order by ad_id asc LIMIT 0 , 4"); |
| | | |
| | | $result['adList1']=$adList1; |
| | | |
| | | |
| | | |
| | | $adList2 = $db -> getAll("SELECT ad_name,ad_code,ad_link FROM ".$ecs->table('ad')." WHERE position_id='114' and start_time<='".time()."' and end_time>='".time()."' order by ad_id asc LIMIT 0 , 3"); |
| | | |
| | | $result['adList2']=$adList2; |
| | | |
| | | $adList3 = $db -> getAll("SELECT ad_name,ad_code,ad_link FROM ".$ecs->table('ad')." WHERE position_id='115' and start_time<='".time()."' and end_time>='".time()."' order by ad_id asc LIMIT 0 , 4"); |
| | | $result['adList3']=$adList3; |
| | | |
| | | $adList4 = $db -> getAll("SELECT ad_name,ad_code,ad_link FROM ".$ecs->table('ad')." WHERE position_id='116' and start_time<='".time()."' and end_time>='".time()."' order by ad_id asc LIMIT 0 , 3"); |
| | | $result['adList4']=$adList4; |
| | | } |
| | | |
| | | |
| | | /* |
| | | $banner = $db -> getAll("SELECT ad_name,ad_code,ad_link FROM ".$ecs->table('ad')." WHERE position_id='100' and start_time<='".time()."' and end_time>='".time()."' LIMIT 0 , 5"); |
| | | $result['banner']=$banner; |
| | | */ |
| | | //填写对应的商品分类id |
| | | $cat_ids="3,5,6,7,11"; |
| | | $goods=array(); |
| | | $sql="SELECT cat_id,cat_name FROM ".$ecs->table('category')." WHERE cat_id IN (".$cat_ids.")"; |
| | | $cat_name_arr=array(); |
| | | foreach($db -> getAll($sql)as $k=>$v ){ |
| | | $cat_name_arr[$v['cat_id']]=$v['cat_name']; |
| | | } |
| | | |
| | | $cat_ids=explode(',',$cat_ids); |
| | | foreach($cat_ids as $v){ |
| | | $cat_id=get_children($v); |
| | | $sql="SELECT goods_id,goods_name,shop_price,is_promote,promote_start_date,market_price,promote_end_date,promote_price,goods_thumb FROM ".$ecs->table('goods')." as g WHERE $cat_id AND is_delete = '0' AND is_on_sale = '1' order by add_time desc LIMIT 0,3 "; |
| | | $goods[] = array('cat_name'=>$cat_name_arr[$v],'cat_id'=>$v,'list'=>$db -> getAll($sql)); |
| | | } |
| | | $result['category']=$goods; |
| | | //jx |
| | | //app头部名称 |
| | | $result['app_title'] = '研发'; |
| | | //楼层名称 |
| | | $result['app_lou1'] = '掌上秒杀'; |
| | | $result['app_lou2'] = '值得买'; |
| | | $result['app_lou3'] = '精品特惠'; |
| | | $result['app_lou4'] = '精品选购'; |
| | | $result['app_lou5'] = '新品上市'; |
| | | $result['app_lou6'] = '热卖商品'; |
| | | $result['app_lou7'] = ''; |
| | | $result['app_lou8'] = ''; |
| | | |
| | | //分享 |
| | | $result['app_fenxiang'] = '分享内容'; |
| | | |
| | | //关于我们的 |
| | | $result['app_id'] = '5'; |
| | | //地图 |
| | | //经纬度 |
| | | $result['app_J'] = '39.900715'; |
| | | $result['app_W'] = '119.538457'; |
| | | //企业名称 |
| | | $result['enterprisename'] = ""; |
| | | //企业简介 |
| | | $result['enterprise'] = "ECSHO行业“第一品牌”"; |
| | | |
| | | //短信内容 |
| | | $result['app_more'] = "发送短信内容"; |
| | | /* |
| | | *修改九宫格跳转到指定的品牌 |
| | | * |
| | | *brand("品牌的ID","品牌的名称"); |
| | | *九宫格名称 |
| | | * |
| | | *修改九宫格跳转到指定的商品类目 |
| | | * |
| | | *category("类目的ID","类目的名称"); |
| | | *九宫格名称 |
| | | * |
| | | */ |
| | | //九宫格 |
| | | //第一行第一个 |
| | | $result['indexMenu1'] = "gourl('shop_list.html','店铺街')"; |
| | | $result['indexMenuName1'] = '店铺街'; |
| | | //第一行第二个 |
| | | $result['indexMenu2'] = "gourl('brand_list.html','商品品牌')"; |
| | | $result['indexMenuName2'] = '商品品牌'; |
| | | //第一行第三个 |
| | | $result['indexMenu3'] = "gourl('user.html','用户中心')"; |
| | | $result['indexMenuName3'] = "用户中心"; |
| | | //第一行第四个 |
| | | $result['indexMenu4'] = "gourl('article_cat.html','文章分类')"; |
| | | $result['indexMenuName4'] = "文章分类"; |
| | | //第二行第一个 |
| | | $result['indexMenu5'] = "gourl('goods_promote_list.html','促销列表')"; |
| | | $result['indexMenuName5'] = "促销列表"; |
| | | //第二行第二个 |
| | | $result['indexMenu6'] = "openPage('flow.html','购物车')"; |
| | | $result['indexMenuName6'] = "购物车"; |
| | | //第二行第三个 |
| | | $result['indexMenu7'] = "ShowMap()"; |
| | | $result['indexMenuName7'] = "地图"; |
| | | //第二行第四个 |
| | | $result['indexMenu8'] = "CallGeiveMe()"; |
| | | $result['indexMenuName8'] = "联系我们"; |
| | | |
| | | |
| | | $timeVal=time(); |
| | | $sql="SELECT goods_id,goods_name,shop_price,promote_price,market_price,goods_thumb,is_hot,is_new,is_best,is_promote,promote_end_date,promote_start_date,click_count FROM ".$ecs->table('goods')." WHERE is_promote='1' AND is_delete = '0' AND is_on_sale = '1' AND promote_end_date>='$timeVal' order by sort_order,last_update desc LIMIT 0,9 "; |
| | | $result['is_promote']=$db -> getAll($sql); |
| | | |
| | | $sql="SELECT goods_id,goods_name,shop_price,promote_price,market_price,goods_thumb,is_hot,is_new,is_best,is_promote,promote_end_date,promote_start_date,click_count FROM ".$ecs->table('goods')." WHERE is_new='1' AND is_delete = '0' AND is_on_sale = '1' order by sort_order,last_update desc LIMIT 0,9 "; |
| | | $result['is_news']=$db -> getAll($sql); |
| | | |
| | | $sql="SELECT goods_id,goods_name,shop_price,promote_price,market_price,goods_thumb,is_hot,is_new,is_best,is_promote,promote_end_date,promote_start_date,click_count FROM ".$ecs->table('goods')." WHERE is_best='1' AND is_delete = '0' AND is_on_sale = '1' order by sort_order,last_update desc LIMIT 0,9 "; |
| | | $result['is_best']=$db -> getAll($sql); |
| | | |
| | | $sql="SELECT goods_id,goods_name,shop_price,promote_price,market_price,goods_thumb,is_hot,is_new,is_best,is_promote,promote_end_date,promote_start_date,click_count FROM ".$ecs->table('goods')." WHERE is_hot='1' AND is_delete = '0' AND is_on_sale = '1' order by sort_order,last_update desc LIMIT 0,9 "; |
| | | $result['is_hot']=$db -> getAll($sql); |
| | | |
| | | |
| | | /* |
| | | *换组修改代码结束 |
| | | * |
| | | * |
| | | */ |
| | | |
| | | /* |
| | | |=============================================================== |
| | | | 获取联系电话 |
| | | |=============================================================== |
| | | | |
| | | | |
| | | */ |
| | | |
| | | $sql="SELECT value FROM ".$ecs->table('shop_config')." WHERE id='115'"; |
| | | $shop_config=$db ->getRow($sql); |
| | | $result['phone1'] = explode("-",$shop_config['value']); |
| | | $result['phone'] = implode("",$result['phone1']); |
| | | |
| | | print_r(json_encode($result)); |
| | | function index_topic($cat) |
| | | { |
| | | global $ecs,$db; |
| | | $sql = "SELECT topic_id,title FROM " . $ecs->table('topic') ; |
| | | |
| | | |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $topic_arr = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | /*$row['index_img'] = $row['index_img']; |
| | | $row['index_goods1_img'] = $row['index_goods1_img']; |
| | | $row['index_goods2_img'] = $row['index_goods2_img']; |
| | | $row['index_goods3_img'] = $row['index_goods3_img'];*/ |
| | | $topic_arr[] = array( |
| | | 'topic' => $row, |
| | | //'goods_arr' => index_topic_goods($row['index_goods_id']) |
| | | ); |
| | | |
| | | } |
| | | return $topic_arr; |
| | | } |
| | | function index_topic_goods($index_goods_id) |
| | | { |
| | | global $ecs,$db; |
| | | $buf = array(); |
| | | |
| | | $ids = explode(",", $index_goods_id); |
| | | $n_ids = array(); |
| | | foreach($ids AS $k => $v){ |
| | | $v = intval(trim($v)); |
| | | if(!$v)continue; |
| | | $n_ids[] = $v; |
| | | } |
| | | $index_goods_id = implode(",", $n_ids); |
| | | if(!$index_goods_id){ |
| | | return $buf; |
| | | } |
| | | |
| | | $sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' . |
| | | "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, " . |
| | | 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . |
| | | "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " . |
| | | "WHERE g.goods_id in ($index_goods_id)"; |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $row['market_price'] = price_format($row['market_price']); |
| | | $row['shop_price'] = price_format($row['shop_price']); |
| | | $row['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : ''; |
| | | |
| | | $row['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']); |
| | | $row['goods_style_name'] = add_style($row['goods_name'], $row['goods_name_style']); |
| | | $row['short_name'] = sub_str($row['goods_name'], 8); |
| | | $row['short_name2'] = sub_str($row['goods_name'], 12); |
| | | $row['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); |
| | | $row['goods_img'] = get_image_path($row['goods_id'], $row['goods_thumb']); |
| | | |
| | | $row['wap_count'] = selled_wap_count($row['goods_id']); |
| | | |
| | | $row['short_style_name'] = add_style($row['short_name'], $row['goods_name_style']); |
| | | if($display == 'grid') |
| | | { |
| | | $row['goods_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name']; |
| | | } |
| | | else |
| | | { |
| | | $row['goods_name'] = $row['goods_name']; |
| | | } |
| | | |
| | | $buf[] = $row; |
| | | } |
| | | return $buf; |
| | | } |
| | | |
| | | |
| | | ?> |
| | | |
| | | |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 检查支付状态 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $order_sn=$_GET['order_sn']; |
| | | $sql="SELECT |
| | | pay_status |
| | | FROM ".$ecs->table('order_info')." WHERE order_sn='$order_sn'"; |
| | | $pay_status=$db ->getRow($sql); |
| | | print_r(json_encode($pay_status)); |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | define('IN_ECS', true); |
| | | |
| | | require('../includes/init.php'); |
| | | include('../includes/cls_json.php'); |
| | | $json = new JSON; |
| | | |
| | | /* |
| | | * 获取商品信息用于分享到朋友圈 |
| | | */ |
| | | if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'info') |
| | | { |
| | | |
| | | $goodsid = (isset($_REQUEST['goodsid']) && intval($_REQUEST['goodsid'])>0) ? intval($_REQUEST['goodsid']) : 0; |
| | | |
| | | if($goodsid>0){ |
| | | //商品信息 |
| | | $sql = "select goods_name,goods_thumb,goods_img,goods_id from ". $GLOBALS['ecs']->table('goods') ." where goods_id=".$goodsid; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $retinfo = array( |
| | | 'thumbImg'=>'http://www.jlv8.com/'.$row['goods_thumb'], |
| | | 'wedpageUrl'=>'http://www.jlv8.com/mobile/goods.php?id='.$goodsid, |
| | | 'scene'=>1, |
| | | 'title'=>$row['goods_name'], |
| | | 'description'=>$row['goods_name'] |
| | | ); |
| | | } |
| | | die($json->encode($retinfo)); |
| | | } |
| | | else if( $_REQUEST['act'] == 'inof') |
| | | { |
| | | /* |
| | | * |
| | | *获取商品信息用于分享到会话 |
| | | * |
| | | */ |
| | | $goodsid = (isset($_REQUEST['goodsid']) && intval($_REQUEST['goodsid'])>0) ? intval($_REQUEST['goodsid']) : 0; |
| | | |
| | | if($goodsid>0){ |
| | | //商品信息 |
| | | $sql = "select goods_name,goods_thumb,goods_img,goods_id from ". $GLOBALS['ecs']->table('goods') ." where goods_id=".$goodsid; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $retinfo = array( |
| | | 'thumbImg'=>'http://www.jlv8.com/'.$row['goods_thumb'], |
| | | 'wedpageUrl'=>'http://www.jlv8.com/mobile/goods.php?id='.$goodsid, |
| | | 'scene'=>0, |
| | | 'title'=>$row['goods_name'], |
| | | 'description'=>$row['goods_name'] |
| | | ); |
| | | } |
| | | die($json->encode($retinfo)); |
| | | } |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | define('IN_ECS', true); |
| | | |
| | | require('../includes/init.php'); |
| | | include('../includes/cls_json.php'); |
| | | $json = new JSON; |
| | | |
| | | |
| | | $smarty->template_dir = ROOT_PATH . 'json/tpl';//app部分模板所在位置 |
| | | |
| | | |
| | | /* |
| | | * 获取购物车中的商品 |
| | | */ |
| | | if (!empty($_REQUEST['act']) && $_REQUEST['act'] == 'txm') |
| | | { |
| | | $page = isset($_REQUEST['page']) && intval($_REQUEST['page']) > 0 ? intval($_REQUEST['page']) : 1; |
| | | $size = 6;//一页显示几个 |
| | | |
| | | $res = array('error' => 0, 'result' => '', 'message' => ''); |
| | | |
| | | |
| | | $txm = intval($_REQUEST['txm']); |
| | | if($txm > 0){ |
| | | |
| | | $sql = " select g.goods_id,g.goods_name,g.market_price,g.shop_price,g.promote_price,". |
| | | " g.promote_start_date, g.promote_end_date,g.supplier_id,g.goods_thumb,g.goods_img, ifnull( ssc.value, '网站自营' ) AS shopname ". |
| | | 'FROM ' . $GLOBALS['ecs']->table('bar_code') . ' AS bc ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "ON bc.goods_id = g.goods_id " . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('supplier_shop_config') . ' AS ssc ' . |
| | | "ON g.supplier_id = ssc.supplier_id AND ssc.code='shop_name'". |
| | | "WHERE bc.bar_code=".$txm." ORDER BY g.supplier_id LIMIT ".($page-1)*$size.",".$size; |
| | | //$res = $GLOBALS['db']->query($sql); |
| | | $arr = $GLOBALS['db']->getAll($sql); |
| | | foreach($arr as $key=>$row){ |
| | | if (intval($row['promote_price']) > 0) |
| | | { |
| | | $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); |
| | | } |
| | | else |
| | | { |
| | | $promote_price = 0; |
| | | } |
| | | $arr[$key]['market_price'] = price_format($row['market_price']); |
| | | $arr[$key]['shop_price'] = price_format($row['shop_price']); |
| | | $arr[$key]['promote_price'] = (intval($promote_price) > 0) ? price_format($promote_price) : price_format($row['shop_price']); |
| | | $arr[$key]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); |
| | | $arr[$key]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); |
| | | } |
| | | /* |
| | | $arr = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['promote_price'] > 0) |
| | | { |
| | | $promote_price = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']); |
| | | } |
| | | else |
| | | { |
| | | $promote_price = 0; |
| | | } |
| | | $row['market_price'] = price_format($row['market_price']); |
| | | $row['shop_price'] = price_format($row['shop_price']); |
| | | $row['promote_price'] = ($promote_price > 0) ? price_format($promote_price) : price_format($row['shop_price']); |
| | | $row['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true); |
| | | $row['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']); |
| | | $arr[] = $row; |
| | | }*/ |
| | | $smarty->assign('goods_list',$arr); |
| | | $res['result'] = $smarty->fetch('goodlist_app.lbi'); |
| | | }else{ |
| | | $res['error'] = 1; |
| | | } |
| | | die($json->encode($res)); |
| | | } |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 商品内容 |
| | | */ |
| | | ob_start(); |
| | | |
| | | require('includes/safety_mysql.php'); |
| | | define('IN_ECS', true); |
| | | require('../includes/init.php'); |
| | | //require('../includes/lib_goods.php'); |
| | | $act = isset($_REQUEST['act']) ? trim($_REQUEST['act']) : ''; |
| | | $atxt = isset($_REQUEST['atxt']) ? trim($_REQUEST['atxt']) : ''; |
| | | $goods_id = isset($_REQUEST['goods_id']) ? intval($_REQUEST['goods_id']) : 0; |
| | | $user_id = isset($_REQUEST['user_id']) ? intval($_REQUEST['user_id']) : 0; |
| | | $result=array(); |
| | | /*查找后台配置的库存管理*/ |
| | | $sql="SELECT value FROM ".$ecs->table('shop_config')." WHERE id='207'"; |
| | | $use_storage=$db ->getRow($sql); |
| | | $result['use_storage']=$use_storage; |
| | | |
| | | /*每100积分可抵多少元现金*/ |
| | | $sql="SELECT value FROM ".$ecs->table('shop_config')." WHERE id='211'"; |
| | | $shop_config=$db ->getRow($sql); |
| | | $shop_config_integral=$shop_config['value']; |
| | | |
| | | /*获取商品的图片*/ |
| | | if(empty($act)) |
| | | { |
| | | $sql="SELECT img_url FROM ".$ecs->table('goods_gallery')." WHERE goods_id='$goods_id' LIMIT 0 ,5 "; |
| | | $goods_gallery = $db -> getAll($sql); |
| | | /*获取商品的评论*/ |
| | | //$sql="SELECT user_name,content,add_time FROM ".$ecs->table('comment')." WHERE id_value='$goods_id' LIMIT 0 ,5 "; |
| | | //$comment = $db -> getAll($sql); |
| | | |
| | | /*获取商品的类型*/ |
| | | |
| | | $sql="SELECT attr.goods_attr_id,attr.attr_value,attribute.attr_name |
| | | FROM ".$ecs->table('goods_attr')." AS attr,".$ecs->table('attribute')." AS attribute |
| | | WHERE attr.goods_id='$goods_id' AND attr.attr_id=attribute.attr_id ;"; |
| | | |
| | | $sql="SELECT a.attr_id, a.attr_name, a.attr_group, a.is_linked, a.attr_type, g.goods_attr_id, g.attr_value, g.attr_price FROM ".$ecs->table('goods_attr')." AS g LEFT JOIN ".$ecs->table('attribute')." AS a ON a.attr_id = g.attr_id WHERE a.attr_group='0' AND g.goods_id = '$goods_id' ORDER BY a.sort_order, g.attr_price, g.goods_attr_id"; |
| | | $res = $db -> getAll($sql); |
| | | $goods_attr=array(); |
| | | $attr=array(); |
| | | $list=array(); |
| | | |
| | | if(count($res)!=0){ |
| | | foreach ($res AS $row) |
| | | { |
| | | |
| | | |
| | | $arr[$row['attr_id']]['attr_id'] = $row['attr_id']; |
| | | $arr[$row['attr_id']]['attr_type'] = $row['attr_type']; |
| | | $arr[$row['attr_id']]['name'] = $row['attr_name']; |
| | | $arr[$row['attr_id']]['values'][] = array( |
| | | 'label' => $row['attr_value'], |
| | | 'price' => $row['attr_price'], |
| | | |
| | | 'id' => $row['goods_attr_id'] |
| | | ); |
| | | |
| | | } |
| | | foreach($arr AS $key =>$row){ |
| | | $goods_attr[]=$row; |
| | | } |
| | | } |
| | | |
| | | $atr_price=0; |
| | | foreach ($goods_attr AS $key=>$val) |
| | | { |
| | | |
| | | |
| | | if($val['attr_type']==1) |
| | | { //echo $val['attr_id']; |
| | | $atr_price+=$val['values'][0]['price']; |
| | | } |
| | | |
| | | } |
| | | //exit; |
| | | |
| | | $sql="SELECT click_count FROM ".$ecs->table('goods')." WHERE goods_id='$goods_id'"; |
| | | $goods=$db ->getRow($sql); |
| | | $click_count=$goods['click_count']+1; |
| | | $db -> query("update ".$ecs->table('goods')." set click_count = '$click_count' where goods_id = '$goods_id'"); |
| | | |
| | | /*获取商品详细信息*/ |
| | | $sql="SELECT |
| | | g.goods_sn, |
| | | g.goods_name, |
| | | g.click_count, |
| | | g.brand_id, |
| | | g.goods_number, |
| | | g.goods_weight, |
| | | g.shop_price, |
| | | g.market_price, |
| | | g.promote_price, |
| | | g.promote_start_date, |
| | | g.promote_end_date, |
| | | g.goods_desc, |
| | | g.is_real, |
| | | g.is_promote, |
| | | g.integral, |
| | | g.give_integral, |
| | | g.rank_integral, |
| | | g.supplier_id, |
| | | ifnull(ssc.value,'网站自营') as shopname |
| | | FROM ".$ecs->table('goods')." AS g LEFT JOIN ".$ecs->table('supplier_shop_config')." AS ssc ON g.supplier_id=ssc.supplier_id AND ssc.code='shop_name' WHERE g.goods_id='$goods_id'"; |
| | | $goods=$db ->getRow($sql); |
| | | $goods['shop_logo'] = $db ->getOne("select value from ".$ecs->table('supplier_shop_config')." where code='shop_logo' and supplier_id=".$goods['supplier_id']); |
| | | $goods['service_phone'] = $db ->getOne("select value from ".$ecs->table('supplier_shop_config')." where code='service_phone' and supplier_id=".$goods['supplier_id']); |
| | | $goods_price = $goods['shop_price']; |
| | | $goods['shop_price']+=$atr_price; |
| | | |
| | | $goods['integral']=$goods['integral']/$shop_config_integral*100; |
| | | if($goods['give_integral']==-1){ |
| | | if($goods['is_promote']==1&&$goods['promote_start_date']<gmtime()&&$goods['promote_end_date']>gmtime()){ |
| | | $goods['give_integral'] = intval($goods['promote_price']); |
| | | }else{ |
| | | $goods['give_integral'] = intval($goods['shop_price']); |
| | | } |
| | | } |
| | | if($goods['rank_integral']==-1){ |
| | | if($goods['is_promote']==1&&$goods['promote_start_date']<gmtime()&&$goods['promote_end_date']>gmtime()){ |
| | | $goods['rank_integral']=$goods['promote_price']; |
| | | }else{ |
| | | $goods['rank_integral']=$goods['shop_price']; |
| | | } |
| | | } |
| | | $goods['volume'] = get_volume($goods_id);//查询商品的优惠价格 |
| | | $goods['shop_atr'] = $goods['shop_price']+$atr_price;//不是促销商品的总价格(加上属性价格) |
| | | $goods['promote_atr'] = $goods['promote_price']+$atr_price;//促销商品的总价格(加上属性价格) |
| | | // $result['linked_goods']=get_linked_goods($goods_id);//获取指定商品的关联商品 |
| | | $result['goods']=$goods; |
| | | $result['goods_gallery']=$goods_gallery; |
| | | $result['goods_attr']=$goods_attr; |
| | | $result['user_rank_info']=get_rank_info($user_id); |
| | | //$result['user_rank_prices']=get_user_rank_prices($goods_id, $goods['shop_price'],$user_id); |
| | | $result['user_rank_prices']=get_user_rank_prices($goods_id, $goods_price,$user_id,$atr_price,$goods['promote_price']); |
| | | foreach($user_rank_prices as $key => $value) |
| | | { |
| | | |
| | | } |
| | | $result['is_collect_goods']=is_collect_goods($goods_id,$user_id); |
| | | |
| | | print_r(json_encode($result)); |
| | | } |
| | | elseif(!empty($atxt)) |
| | | { |
| | | /* $sql="SELECT |
| | | shop_price FROM ".$ecs->table('goods')." WHERE goods_id='$goods_id'"; |
| | | $goods_price=$db ->getOne($sql);*/ |
| | | // $goods['shop_price']+=$atr_price; |
| | | $sql="SELECT |
| | | shop_price, |
| | | promote_price, |
| | | promote_start_date, |
| | | promote_end_date, |
| | | is_promote |
| | | FROM ".$ecs->table('goods')." WHERE goods_id='$goods_id'"; |
| | | $goods=$db ->getRow($sql); |
| | | $shop_pricr = $goods['shop_price']; |
| | | if($goods['is_promote'] == 1 && $goods['promote_start_date'] < gmtime() && $goods['promote_end_date'] > gmtime() && $goods['shop_price'] > $goods['promote_price']) |
| | | { |
| | | $result['shop_price_shao'] = $goods['promote_price']; |
| | | }else |
| | | { |
| | | $result['shop_price_shao']= $goods['shop_price']; |
| | | } |
| | | if($goods['is_promote'] == 1 && $goods['promote_start_date'] < gmtime() && $goods['promote_end_date'] > gmtime()) |
| | | { |
| | | $result['shop_price'] = $goods['promote_price']; |
| | | }else |
| | | { |
| | | $result['shop_price']= $goods['shop_price']; |
| | | } |
| | | $atr_price=0; |
| | | $goods_att=explode('@',$atxt); |
| | | $fuck = array_pop($goods_att);//弹出数组最后一个空值 |
| | | sort($goods_att); |
| | | $good_attr = implode('|',$goods_att); |
| | | //判断所选属性是不是有库存 |
| | | $sql = "SELECT product_number FROM ".$ecs->table('products')."WHERE goods_id = '$goods_id' and goods_attr = '$good_attr'"; |
| | | $product_number = $db ->getOne($sql); |
| | | if(empty($product_number)) |
| | | { |
| | | $result['error'] = '1'; |
| | | $result['result'] = "所选属性库存不足"; |
| | | } |
| | | foreach ($goods_att as $val) |
| | | { |
| | | |
| | | if(!empty($val)) |
| | | { |
| | | $sql="SELECT `attr_price` FROM " .$ecs->table('goods_attr')." WHERE goods_id='$goods_id' AND `goods_attr_id`='$val'"; |
| | | $atr_price+=$db->getOne($sql); |
| | | } |
| | | |
| | | } |
| | | $result['cart_price'] = $result['shop_price_shao']+$atr_price; //本店售价加上属性价格 |
| | | $result['is_promote'] = $goods['is_promote'];//$result['shop_price']=$goods_price+$atr_price; |
| | | $result['promote_start_date'] = $goods['promote_start_date']; |
| | | $result['promote_end_date'] = $goods['promote_end_date']; |
| | | $result['user_rank_info']=get_rank_info($user_id); |
| | | //$result['user_rank_prices']=get_user_rank_prices($goods_id, $result['shop_price'],$user_id); |
| | | $result['user_rank_prices']=get_user_rank_prices($goods_id, $shop_pricr,$user_id,$atr_price,$goods['promote_price']); |
| | | print_r(json_encode($result)); |
| | | } |
| | | |
| | | /*=====================================的一些函数方法======================================*/ |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获得指定商品的各会员等级对应的价格 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_user_rank_prices($goods_id, $shop_price,$user_id,$atr_price,$promote_price) |
| | | { |
| | | $user_rank = $GLOBALS['db']->getOne("SELECT user_rank FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '$user_id'"); |
| | | $sql = "SELECT rank_id, IFNULL(mp.user_price, r.discount * $shop_price / 100) AS price, r.rank_name, r.discount, r.show_price " . |
| | | 'FROM ' . $GLOBALS['ecs']->table('user_rank') . ' AS r ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . " AS mp ". |
| | | "ON mp.goods_id = '$goods_id' AND mp.user_rank = r.rank_id "; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $arr = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | |
| | | $arr[] = array( |
| | | 'rank_name' => htmlspecialchars($row['rank_name']), |
| | | 'rank_id' => $row['rank_id'], |
| | | 'price' => price_format($row['price']), |
| | | 'show_price' => $row['show_price'], |
| | | 'price_promote'=>price_format($promote_price+$atr_price), |
| | | 'price_shop'=> price_format($row['price']+$atr_price)); |
| | | } |
| | | |
| | | return $arr; |
| | | } |
| | | |
| | | /** |
| | | * 获得会员等级 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_rank_info($user_id) |
| | | { |
| | | $user_rank = $GLOBALS['db']->getOne("SELECT user_rank FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '$user_id'"); |
| | | |
| | | $sql = "SELECT rank_name FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '$user_rank'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $rank_name=$row['rank_name']; |
| | | |
| | | return array('rank_name'=>$rank_name); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 判断用户是否收藏 |
| | | * |
| | | * @param string $goods_id 商品编号 |
| | | * @param string $user_id 用户编号 |
| | | * |
| | | * @return 布尔值 |
| | | */ |
| | | function is_collect_goods($goods_id,$user_id) |
| | | { |
| | | $sql="SELECT * |
| | | FROM ".$GLOBALS['ecs']->table('collect_goods')." WHERE user_id='$user_id' and goods_id='$goods_id'"; |
| | | |
| | | $isCollect=$GLOBALS['db'] ->getRow($sql); |
| | | |
| | | if(!empty($isCollect)){return true;}else{return false;} |
| | | } |
| | | /** |
| | | * |
| | | * |
| | | *查询商品的优惠价格 |
| | | *@param string $goods_id 商品编号 |
| | | * |
| | | * |
| | | */ |
| | | function get_volume($goods_id) |
| | | { |
| | | $sql = "SELECT * FROM ".$GLOBALS['ecs']->table('volume_price')."WHERE goods_id = '$goods_id' order by volume_number ASC"; |
| | | $volume = $GLOBALS['db']->getAll($sql); |
| | | return $volume; |
| | | |
| | | } |
| | | ob_end_flush(); |
| | | ?> |
| | | |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 商品列表 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | $cat=$_REQUEST['cat_id']; |
| | | |
| | | |
| | | if(isset($_GET['brand'])){$brand=$_GET['brand'];}else{$brand="";} |
| | | $page=$_GET['page']*10; |
| | | $field=nl2br(htmlspecialchars($_GET['field'])); |
| | | $order=$_GET['order']; |
| | | // 获得分类的相关信息 |
| | | $sql = "SELECT * FROM " .$ecs->table('category'). " WHERE cat_id='$cat' LIMIT 1"; |
| | | $cat_info=$db->getRow($sql); |
| | | $cat_goods_ids=0; |
| | | if(!empty($cat)){ |
| | | if($cat=="undefined"){ |
| | | $cat=0; |
| | | } |
| | | $sql = "SELECT * FROM " .$ecs->table('category'). " WHERE parent_id='$cat' "; |
| | | $cat_List=$db->getAll($sql); |
| | | for($i=0;$i<count($cat_List);$i++){ |
| | | $cat.=",".$cat_List[$i]['cat_id']; |
| | | $cat_id1=$cat_List[$i]['cat_id']; |
| | | $sql = "SELECT * FROM " .$ecs->table('category'). " WHERE parent_id ='$cat_id1' "; |
| | | $cat_List2=$db->getAll($sql); |
| | | for($j=0;$j<count($cat_List2);$j++){ |
| | | $cat.=",".$cat_List2[$j]['cat_id']; |
| | | } |
| | | } |
| | | |
| | | $sql = "SELECT goods_id FROM " .$ecs->table('goods_cat'). " WHERE cat_id IN ($cat) "; |
| | | $cat_goods_ids_arr=$db->getAll($sql); |
| | | for($i=0;$i<count($cat_goods_ids_arr);$i++){ |
| | | $cat_goods_ids=$cat_goods_ids.",".$cat_goods_ids_arr[$i]['goods_id']; |
| | | } |
| | | } |
| | | if(isset($_GET['is_promote'])&&(!empty($_GET['is_promote']))){//促销列表 |
| | | $timeVal=time(); |
| | | if($field=="goods_number"){ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count,SUM( og.goods_number ) AS goods_number FROM ".$ecs->table('goods')." AS g,".$ecs->table(order_goods)." AS og WHERE is_delete = '0' AND is_on_sale = '1' AND g.goods_number >0 AND og.goods_id = g.goods_id AND g.is_promote = '1' AND g.promote_end_date>='$timeVal' AND g.promote_start_date<='$timeVal' order by goods_number DESC, g.shop_price $order LIMIT $page,10 "; |
| | | }else{ |
| | | $sql="SELECT g.add_time,g.goods_id,g.goods_name,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count FROM ".$ecs->table('goods')." AS g WHERE is_delete = '0' AND is_on_sale = '1' AND g.goods_number >0 AND is_promote = '1' AND g.promote_end_date>='$timeVal' AND g.promote_start_date<='$timeVal' order by g.$field $order LIMIT $page,10 "; |
| | | |
| | | } |
| | | |
| | | $res = $db -> getAll($sql); |
| | | for($i=0;$i<count($res);$i++){ |
| | | $res[$i]['add_time']=date('Y-m-d h:m',$res[$i]['add_time']); |
| | | } |
| | | |
| | | print_r(json_encode($res)); |
| | | exit(); |
| | | |
| | | } |
| | | |
| | | |
| | | if(isset($_GET['filter_attr'])&&(!empty($_GET['filter_attr']))){ |
| | | $filter_attr_str=$_GET['filter_attr']; |
| | | $filter_attr = empty($filter_attr_str) ? '' : explode('.', $filter_attr_str); |
| | | $cat_filter_attr = explode(',', $cat_info['filter_attr']); //提取出此分类的筛选属性 |
| | | $ext_sql = "SELECT DISTINCT(b.goods_id) FROM " . $ecs->table('goods_attr') . " AS a, " . $ecs->table('goods_attr') . " AS b " . "WHERE "; |
| | | $ext=""; |
| | | foreach ($filter_attr AS $k => $v){ |
| | | if (is_numeric($v) && $v !=0 &&isset($cat_filter_attr[$k])) |
| | | { |
| | | $sql = $ext_sql . "b.attr_value = a.attr_value AND b.attr_id = " . $cat_filter_attr[$k] ." AND a.goods_attr_id = " . $v; |
| | | $ext_group_goods = $db->getColCached($sql); |
| | | $ext .= ' AND ' . db_create_in($ext_group_goods, 'g.goods_id'); |
| | | } |
| | | } |
| | | if($field=="goods_number"){ |
| | | if(!empty($brand)){ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count,SUM( og.goods_number ) AS goods_number FROM ".$ecs->table('goods')." AS g LEFT JOIN ".$ecs->table('order_goods')." AS og ON is_delete = '0' AND is_on_sale = '1' AND g.brand_id='$brand' AND og.goods_id = g.goods_id AND (g.cat_id IN ($cat) OR g.goods_id IN ($cat_goods_ids) ) ".$ext." GROUP BY g.goods_id order by goods_number DESC , g.shop_price $order LIMIT $page,10"; |
| | | |
| | | }else{ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count,SUM( og.goods_number ) AS goods_number FROM ".$ecs->table('goods')." AS g LEFT JOIN ".$ecs->table('order_goods')." AS og ON is_delete = '0' AND is_on_sale = '1' AND og.goods_id = g.goods_id AND (g.cat_id IN ($cat) OR g.goods_id IN ($cat_goods_ids) ) ".$ext." GROUP BY g.goods_id order by goods_number DESC , g.shop_price $order LIMIT $page,10"; |
| | | } |
| | | }else{ |
| | | if(!empty($brand)){ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count FROM ".$ecs->table('goods')." AS g WHERE is_delete = '0' AND is_on_sale = '1' AND g.brand_id='$brand' AND (g.cat_id IN ($cat) OR g.goods_id IN ($cat_goods_ids) ) ".$ext." order by goods_number DESC, g.shop_price $order LIMIT $page,10"; |
| | | |
| | | }else{ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count FROM ".$ecs->table('goods')." AS g WHERE is_delete = '0' AND is_on_sale = '1' AND (g.cat_id IN ($cat) OR g.goods_id IN ($cat_goods_ids) ) ".$ext." order by goods_number DESC, g.shop_price $order LIMIT $page,10"; |
| | | } |
| | | } |
| | | |
| | | |
| | | $res = $db -> getAll($sql); |
| | | if($field=="goods_number"){ |
| | | for($i=0;$i<count($res);$i++){ |
| | | for($i=0;$i<count($res);$i++){ |
| | | if(empty($res[$i]['goods_number'])){ |
| | | $res[$i]['goods_number']=0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | print_r(json_encode($res)); |
| | | exit(); |
| | | } |
| | | if($field=="goods_number"){ |
| | | if(!empty($cat)){ |
| | | if( $cat==0){ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.goods_brief,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count,SUM( og.goods_number ) AS goods_number |
| | | FROM ".$ecs->table('goods')." AS g LEFT JOIN ".$ecs->table('order_goods')." AS og |
| | | ON og.goods_id = g.goods_id WHERE g.is_delete = '0' AND g.is_on_sale = '1' |
| | | GROUP BY g.goods_id order by goods_number DESC , g.shop_price $order LIMIT $page,10 "; |
| | | }else{ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.goods_brief,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count,SUM( og.goods_number ) AS goods_number |
| | | FROM ".$ecs->table('goods')." AS g LEFT JOIN ".$ecs->table('order_goods')." AS og ON og.goods_id = g.goods_id where g.is_delete = '0' AND g.is_on_sale = '1' AND (g.cat_id IN ($cat) OR g.goods_id IN ($cat_goods_ids) ) GROUP BY g.goods_id order by goods_number DESC, g.shop_price $order LIMIT $page,10"; |
| | | } |
| | | } |
| | | if(!empty($brand)){ |
| | | $sql="SELECT g.goods_id,g.goods_name,g.goods_brief,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count,SUM( og.goods_number ) AS goods_number |
| | | FROM ".$ecs->table('goods')." AS g LEFT JOIN ".$ecs->table('order_goods')." AS og ON og.goods_id = g.goods_id where g.is_delete = '0' AND g.is_on_sale = '1' AND g.brand_id='$brand' AND GROUP BY g.goods_id order by goods_number DESC , g.shop_price $order LIMIT $page,10"; |
| | | |
| | | } |
| | | $res = $db -> getAll($sql); |
| | | if(empty($res[0]['goods_id'])&&count($res)==1){ |
| | | $result=array(); |
| | | print_r(json_encode($result)); |
| | | exit(); |
| | | }else{ |
| | | for($i=0;$i<count($res);$i++){ |
| | | if(empty($res[$i]['goods_number'])){ |
| | | $res[$i]['goods_number']=0; |
| | | } |
| | | } |
| | | print_r(json_encode($res)); |
| | | exit(); |
| | | } |
| | | }else{ |
| | | if(!empty($cat)){ |
| | | if( $cat==0){ |
| | | $sql="SELECT g.add_time,g.goods_id,g.goods_name,g.goods_brief,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count FROM ".$ecs->table('goods')." AS g WHERE is_delete = '0' AND is_on_sale = '1' order by g.$field $order LIMIT $page,10 "; |
| | | }else{ |
| | | $sql="SELECT g.add_time,g.goods_id,g.goods_name,g.goods_brief,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count FROM ".$ecs->table('goods')." AS g WHERE is_delete = '0' AND is_on_sale = '1' AND (g.cat_id IN ($cat) OR g.goods_id IN ($cat_goods_ids) ) order by g.$field $order LIMIT $page,10"; |
| | | } |
| | | } |
| | | if(!empty($brand)){ |
| | | $sql="SELECT g.add_time,g.goods_id,g.goods_name,g.goods_brief,g.shop_price,g.goods_thumb,g.promote_price,g.is_promote,promote_end_date,promote_start_date,g.is_hot,g.is_new,g.is_best,g.click_count FROM ".$ecs->table('goods')." AS g WHERE is_delete = '0' AND is_on_sale = '1' AND g.brand_id='$brand' order by g.$field $order LIMIT $page,10"; |
| | | } |
| | | } |
| | | |
| | | |
| | | $res = $db -> getAll($sql); |
| | | for($i=0;$i<count($res);$i++){ |
| | | $res[$i]['add_time']=date('Y-m-d h:m',$res[$i]['add_time']); |
| | | } |
| | | |
| | | print_r(json_encode($res)); |
| | | |
| | | |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | * 商品内容 |
| | | */ |
| | | define('IN_ECS', true); |
| | | require('includes/init.php'); |
| | | //require('../includes/lib_goods.php'); |
| | | $goods_id = isset($_REQUEST['goods_id']) ? intval($_REQUEST['goods_id']) : 0; |
| | | |
| | | /*获取商品的评论*/ |
| | | $sql="SELECT user_name,content,add_time,comment_rank FROM ".$ecs->table('comment')." WHERE id_value='$goods_id' and status=1 ORDER BY add_time DESC"; |
| | | $comment = $db -> getAll($sql); |
| | | for($i=0;$i<count($comment);$i++){ |
| | | $comment[$i]['add_time'] = date("Y-m-d h:m:s",$comment[$i]['add_time']); |
| | | } |
| | | |
| | | print_r(json_encode($comment)); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | define('IN_ECS', true); |
| | | |
| | | require('../includes/init.php'); |
| | | include('../includes/cls_json.php'); |
| | | $json = new JSON; |
| | | |
| | | /* |
| | | * 获取商品信息用于分享到朋友圈 |
| | | */ |
| | | |
| | | |
| | | $goodsid = (isset($_REQUEST['goodsid']) && intval($_REQUEST['goodsid'])>0) ? intval($_REQUEST['goodsid']) : 0; |
| | | |
| | | if($goodsid>0){ |
| | | //商品信息 |
| | | $sql = "select goods_name,goods_thumb,goods_img,goods_id from ". $GLOBALS['ecs']->table('goods') ." where goods_id=".$goodsid; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $retinfo = array( |
| | | 'thumbImg'=>'http://www.jlv8.com/'.$row['goods_thumb'], |
| | | 'wedpageUrl'=>'http://www.jlv8.com/mobile/goods.php?id='.$goodsid, |
| | | //'scene'=>1, |
| | | 'title'=>$row['goods_name'], |
| | | 'description'=>$row['goods_name'] |
| | | ); |
| | | } |
| | | die($json->encode($retinfo)); |
| | | |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 后台自动操作数据库的类文件 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: cls_exchange.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | /*------------------------------------------------------ */ |
| | | //-- 该类用于与数据库数据进行交换 |
| | | /*------------------------------------------------------ */ |
| | | class exchange |
| | | { |
| | | var $table; |
| | | var $db; |
| | | var $id; |
| | | var $name; |
| | | var $error_msg; |
| | | |
| | | /** |
| | | * 构造函数 |
| | | * |
| | | * @access public |
| | | * @param string $table 数据库表名 |
| | | * @param dbobject $db aodb的对象 |
| | | * @param string $id 数据表主键字段名 |
| | | * @param string $name 数据表重要段名 |
| | | * |
| | | * @return void |
| | | */ |
| | | function exchange($table, &$db , $id, $name) |
| | | { |
| | | $this->table = $table; |
| | | $this->db = &$db; |
| | | $this->id = $id; |
| | | $this->name = $name; |
| | | $this->error_msg = ''; |
| | | } |
| | | |
| | | /** |
| | | * 判断表中某字段是否重复,若重复则中止程序,并给出错误信息 |
| | | * |
| | | * @access public |
| | | * @param string $col 字段名 |
| | | * @param string $name 字段值 |
| | | * @param integer $id |
| | | * |
| | | * @return void |
| | | */ |
| | | function is_only($col, $name, $id = 0, $where='') |
| | | { |
| | | $sql = 'SELECT COUNT(*) FROM ' .$this->table. " WHERE $col = '$name'"; |
| | | $sql .= empty($id) ? '' : ' AND ' . $this->id . " <> '$id'"; |
| | | $sql .= empty($where) ? '' : ' AND ' .$where; |
| | | |
| | | return ($this->db->getOne($sql) == 0); |
| | | } |
| | | |
| | | /** |
| | | * 返回指定名称记录再数据表中记录个数 |
| | | * |
| | | * @access public |
| | | * @param string $col 字段名 |
| | | * @param string $name 字段内容 |
| | | * |
| | | * @return int 记录个数 |
| | | */ |
| | | function num($col, $name, $id = 0) |
| | | { |
| | | $sql = 'SELECT COUNT(*) FROM ' .$this->table. " WHERE $col = '$name'"; |
| | | $sql .= empty($id) ? '' : ' AND '. $this->id ." != '$id' "; |
| | | |
| | | return $this->db->getOne($sql); |
| | | } |
| | | |
| | | /** |
| | | * 编辑某个字段 |
| | | * |
| | | * @access public |
| | | * @param string $set 要更新集合如" col = '$name', value = '$value'" |
| | | * @param int $id 要更新的记录编号 |
| | | * |
| | | * @return bool 成功或失败 |
| | | */ |
| | | function edit($set, $id) |
| | | { |
| | | $sql = 'UPDATE ' . $this->table . ' SET ' . $set . " WHERE $this->id = '$id'"; |
| | | |
| | | if ($this->db->query($sql)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得某个字段的值 |
| | | * |
| | | * @access public |
| | | * @param int $id 记录编号 |
| | | * @param string $id 字段名 |
| | | * |
| | | * @return string 取出的数据 |
| | | */ |
| | | function get_name($id, $name = '') |
| | | { |
| | | if (empty($name)) |
| | | { |
| | | $name = $this->name; |
| | | } |
| | | |
| | | $sql = "SELECT `$name` FROM " . $this->table . " WHERE $this->id = '$id'"; |
| | | |
| | | return $this->db->getOne($sql); |
| | | } |
| | | |
| | | /** |
| | | * 删除条记录 |
| | | * |
| | | * @access public |
| | | * @param int $id 记录编号 |
| | | * |
| | | * @return bool |
| | | */ |
| | | function drop($id) |
| | | { |
| | | $sql = 'DELETE FROM ' . $this->table . " WHERE $this->id = '$id'"; |
| | | |
| | | return $this->db->query($sql); |
| | | } |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | Google sitemap 类 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: cls_google_sitemap.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | class google_sitemap |
| | | { |
| | | var $header = "<\x3Fxml version=\"1.0\" encoding=\"UTF-8\"\x3F>\n\t<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; |
| | | var $charset = "UTF-8"; |
| | | var $footer = "\t</urlset>\n"; |
| | | var $items = array(); |
| | | |
| | | /** |
| | | * 增加一个新的子项 |
| | | *@access public |
| | | *@param google_sitemap item $new_item |
| | | */ |
| | | function add_item($new_item) |
| | | { |
| | | $this->items[] = $new_item; |
| | | } |
| | | |
| | | /** |
| | | * 生成XML文档 |
| | | *@access public |
| | | *@param string $file_name 如果提供了文件名则生成文件,否则返回字符串. |
| | | *@return [void|string] |
| | | */ |
| | | function build( $file_name = null ) |
| | | { |
| | | $map = $this->header . "\n"; |
| | | |
| | | foreach ($this->items AS $item) |
| | | { |
| | | $item->loc = htmlentities($item->loc, ENT_QUOTES); |
| | | $map .= "\t\t<url>\n\t\t\t<loc>$item->loc</loc>\n"; |
| | | |
| | | // lastmod |
| | | if ( !empty( $item->lastmod ) ) |
| | | $map .= "\t\t\t<lastmod>$item->lastmod</lastmod>\n"; |
| | | |
| | | // changefreq |
| | | if ( !empty( $item->changefreq ) ) |
| | | $map .= "\t\t\t<changefreq>$item->changefreq</changefreq>\n"; |
| | | |
| | | // priority |
| | | if ( !empty( $item->priority ) ) |
| | | $map .= "\t\t\t<priority>$item->priority</priority>\n"; |
| | | |
| | | $map .= "\t\t</url>\n\n"; |
| | | } |
| | | |
| | | $map .= $this->footer . "\n"; |
| | | |
| | | if (!is_null($file_name)) |
| | | { |
| | | return file_put_contents($file_name, $map); |
| | | } |
| | | else |
| | | { |
| | | return $map; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | class google_sitemap_item |
| | | { |
| | | /** |
| | | *@access public |
| | | *@param string $loc 位置 |
| | | *@param string $lastmod 日期格式 YYYY-MM-DD |
| | | *@param string $changefreq 更新频率的单位 (always, hourly, daily, weekly, monthly, yearly, never) |
| | | *@param string $priority 更新频率 0-1 |
| | | */ |
| | | function google_sitemap_item($loc, $lastmod = '', $changefreq = '', $priority = '') |
| | | { |
| | | $this->loc = $loc; |
| | | $this->lastmod = $lastmod; |
| | | $this->changefreq = $changefreq; |
| | | $this->priority = $priority; |
| | | } |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | ZIP 处理类 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: cls_phpzip.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | class PHPZip |
| | | { |
| | | function zip($dir, $zipfilename, $drop=false) |
| | | { |
| | | if (substr($dir, -1) != '/') |
| | | { |
| | | $dir = ($dir == '') ? './' : $dir . '/'; |
| | | } |
| | | |
| | | if (@function_exists('gzcompress')) |
| | | { |
| | | $curdir = getcwd(); |
| | | if (is_array($dir)) |
| | | { |
| | | $filelist = $dir; |
| | | } |
| | | else |
| | | { |
| | | $filelist = $this -> get_filelist($dir); |
| | | } |
| | | |
| | | if ((!empty($dir)) && (!is_array($dir))&&(file_exists($dir))) |
| | | { |
| | | chdir($dir); |
| | | } |
| | | else |
| | | { |
| | | chdir($curdir); |
| | | } |
| | | |
| | | if (count($filelist) > 0) |
| | | { |
| | | foreach ($filelist AS $filename) |
| | | { |
| | | if (is_file($filename)) |
| | | { |
| | | $fd = fopen ($filename, 'rb'); |
| | | $content = fread ($fd, filesize ($filename)); |
| | | fclose ($fd); |
| | | |
| | | if (is_array($dir)) |
| | | { |
| | | $filename = basename($filename); |
| | | } |
| | | $this -> add_file($content, $filename); |
| | | |
| | | if ($drop) |
| | | { |
| | | @unlink($filename); |
| | | } |
| | | } |
| | | } |
| | | $out = $this -> file(); |
| | | |
| | | chdir($curdir); |
| | | $fp = fopen($zipfilename, 'wb'); |
| | | fwrite($fp, $out, strlen($out)); |
| | | fclose($fp); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | function get_filelist($dir) |
| | | { |
| | | $file = array(); |
| | | $dir = rtrim($dir,'/'); |
| | | if (file_exists($dir)) |
| | | { |
| | | $args = func_get_args(); |
| | | $pref = isset($args[1]) ? $args[1] : ''; |
| | | |
| | | $dh = opendir($dir); |
| | | while (($files = readdir($dh)) !== false) |
| | | { |
| | | if (($files != '.') && ($files != '..')) |
| | | { |
| | | if (is_dir($dir .'/'. $files)) |
| | | { |
| | | $file = array_merge($file, $this -> get_filelist($dir .'/'. $files, "$pref$files/")); |
| | | } |
| | | else |
| | | { |
| | | $file[] = $pref . $files; |
| | | } |
| | | } |
| | | } |
| | | closedir($dh); |
| | | } |
| | | |
| | | return $file; |
| | | } |
| | | |
| | | var $datasec = array(); |
| | | var $ctrl_dir = array(); |
| | | var $eof_ctrl_dir = "\x50\x4b\x05\x06\x00\x00\x00\x00"; |
| | | var $old_offset = 0; |
| | | |
| | | /** |
| | | * Converts an Unix timestamp to a four byte DOS date and time format (date |
| | | * in high two bytes, time in low two bytes allowing magnitude comparison). |
| | | * |
| | | * @param integer the current Unix timestamp |
| | | * |
| | | * @return integer the current date in a four byte DOS format |
| | | * |
| | | * @access private |
| | | */ |
| | | function unix2DosTime($unixtime = 0) |
| | | { |
| | | $timearray = ($unixtime == 0) ? getdate() : getdate($unixtime); |
| | | |
| | | if ($timearray['year'] < 1980) { |
| | | $timearray['year'] = 1980; |
| | | $timearray['mon'] = 1; |
| | | $timearray['mday'] = 1; |
| | | $timearray['hours'] = 0; |
| | | $timearray['minutes'] = 0; |
| | | $timearray['seconds'] = 0; |
| | | } // end if |
| | | |
| | | return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | |
| | | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); |
| | | } // end of the 'unix2DosTime()' method |
| | | |
| | | /** |
| | | * Adds "file" to archive |
| | | * |
| | | * @param string file contents |
| | | * @param string name of the file in the archive (may contains the path) |
| | | * @param integer the current timestamp |
| | | * |
| | | * @access public |
| | | */ |
| | | function add_file($data, $name, $time = 0) |
| | | { |
| | | $name = str_replace('\\', '/', $name); |
| | | |
| | | $dtime = dechex($this->unix2DosTime($time)); |
| | | $hexdtime = '\x' . $dtime[6] . $dtime[7] |
| | | . '\x' . $dtime[4] . $dtime[5] |
| | | . '\x' . $dtime[2] . $dtime[3] |
| | | . '\x' . $dtime[0] . $dtime[1]; |
| | | eval('$hexdtime = "' . $hexdtime . '";'); |
| | | |
| | | $fr = "\x50\x4b\x03\x04"; |
| | | $fr .= "\x14\x00"; // ver needed to extract |
| | | $fr .= "\x00\x00"; // gen purpose bit flag |
| | | $fr .= "\x08\x00"; // compression method |
| | | $fr .= $hexdtime; // last mod time and date |
| | | |
| | | // "local file header" segment |
| | | $unc_len = strlen($data); |
| | | $crc = crc32($data); |
| | | $zdata = gzcompress($data); |
| | | $c_len = strlen($zdata); |
| | | $zdata = substr(substr($zdata, 0, strlen($zdata) - 4), 2); // fix crc bug |
| | | $fr .= pack('V', $crc); // crc32 |
| | | $fr .= pack('V', $c_len); // compressed filesize |
| | | $fr .= pack('V', $unc_len); // uncompressed filesize |
| | | $fr .= pack('v', strlen($name)); // length of filename |
| | | $fr .= pack('v', 0); // extra field length |
| | | $fr .= $name; |
| | | |
| | | // "file data" segment |
| | | $fr .= $zdata; |
| | | |
| | | // "data descriptor" segment (optional but necessary if archive is not |
| | | // served as file) |
| | | $fr .= pack('V', $crc); // crc32 |
| | | $fr .= pack('V', $c_len); // compressed filesize |
| | | $fr .= pack('V', $unc_len); // uncompressed filesize |
| | | |
| | | // add this entry to array |
| | | $this -> datasec[] = $fr; |
| | | $new_offset = strlen(implode('', $this->datasec)); |
| | | |
| | | // now add to central directory record |
| | | $cdrec = "\x50\x4b\x01\x02"; |
| | | $cdrec .= "\x00\x00"; // version made by |
| | | $cdrec .= "\x14\x00"; // version needed to extract |
| | | $cdrec .= "\x00\x00"; // gen purpose bit flag |
| | | $cdrec .= "\x08\x00"; // compression method |
| | | $cdrec .= $hexdtime; // last mod time & date |
| | | $cdrec .= pack('V', $crc); // crc32 |
| | | $cdrec .= pack('V', $c_len); // compressed filesize |
| | | $cdrec .= pack('V', $unc_len); // uncompressed filesize |
| | | $cdrec .= pack('v', strlen($name) ); // length of filename |
| | | $cdrec .= pack('v', 0 ); // extra field length |
| | | $cdrec .= pack('v', 0 ); // file comment length |
| | | $cdrec .= pack('v', 0 ); // disk number start |
| | | $cdrec .= pack('v', 0 ); // internal file attributes |
| | | $cdrec .= pack('V', 32 ); // external file attributes - 'archive' bit set |
| | | |
| | | $cdrec .= pack('V', $this -> old_offset ); // relative offset of local header |
| | | $this -> old_offset = $new_offset; |
| | | |
| | | $cdrec .= $name; |
| | | |
| | | // optional extra field, file comment goes here |
| | | // save to central directory |
| | | $this -> ctrl_dir[] = $cdrec; |
| | | } // end of the 'add_file()' method |
| | | |
| | | /** |
| | | * Dumps out file |
| | | * |
| | | * @return string the zipped file |
| | | * |
| | | * @access public |
| | | */ |
| | | function file() |
| | | { |
| | | $data = implode('', $this -> datasec); |
| | | $ctrldir = implode('', $this -> ctrl_dir); |
| | | |
| | | return |
| | | $data . |
| | | $ctrldir . |
| | | $this -> eof_ctrl_dir . |
| | | pack('v', sizeof($this -> ctrl_dir)) . // total # of entries "on this disk" |
| | | pack('v', sizeof($this -> ctrl_dir)) . // total # of entries overall |
| | | pack('V', strlen($ctrldir)) . // size of central dir |
| | | pack('V', strlen($data)) . // offset to start of central dir |
| | | "\x00\x00"; // .zip file comment length |
| | | } // end of the 'file()' method |
| | | } // end of the 'PHPZip' class |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 数据库导出类 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: cls_sql_dump.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | /** |
| | | * 对mysql敏感字符串转义 |
| | | * |
| | | * @access public |
| | | * @param string $str |
| | | * |
| | | * @return string |
| | | */ |
| | | function dump_escape_string($str) |
| | | { |
| | | return cls_mysql::escape_string($str); |
| | | } |
| | | |
| | | /** |
| | | * 对mysql记录中的null值进行处理 |
| | | * |
| | | * @access public |
| | | * @param string $str |
| | | * |
| | | * @return string |
| | | */ |
| | | function dump_null_string($str) |
| | | { |
| | | if (!isset($str) || is_null($str)) |
| | | { |
| | | $str = 'NULL'; |
| | | } |
| | | |
| | | return $str; |
| | | } |
| | | |
| | | |
| | | class cls_sql_dump |
| | | { |
| | | var $max_size = 2097152; // 2M |
| | | var $is_short = false; |
| | | var $offset = 300; |
| | | var $dump_sql = ''; |
| | | var $sql_num = 0; |
| | | var $error_msg = ''; |
| | | |
| | | var $db; |
| | | |
| | | /** |
| | | * 类的构造函数 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return void |
| | | */ |
| | | function cls_sql_dump(&$db, $max_size=0) |
| | | { |
| | | $this->db = &$db; |
| | | if ($max_size > 0 ) |
| | | { |
| | | $this->max_size = $max_size; |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 类的构造函数 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return void |
| | | */ |
| | | function __construct(&$db, $max_size =0) |
| | | { |
| | | $this->cls_sql_dump($db, $max_size); |
| | | } |
| | | |
| | | /** |
| | | * 获取指定表的定义 |
| | | * |
| | | * @access public |
| | | * @param string $table 数据表名 |
| | | * @param boolen $add_drop 是否加入drop table |
| | | * |
| | | * @return string $sql |
| | | */ |
| | | function get_table_df($table, $add_drop = false) |
| | | { |
| | | if ($add_drop) |
| | | { |
| | | $table_df = "DROP TABLE IF EXISTS `$table`;\r\n"; |
| | | } |
| | | else |
| | | { |
| | | $table_df = ''; |
| | | } |
| | | |
| | | $tmp_arr = $this->db->getRow("SHOW CREATE TABLE `$table`"); |
| | | $tmp_sql = $tmp_arr['Create Table']; |
| | | $tmp_sql = substr($tmp_sql, 0, strrpos($tmp_sql, ")") + 1); //去除行尾定义。 |
| | | |
| | | if ($this->db->version() >= '4.1') |
| | | { |
| | | $table_df .= $tmp_sql . " ENGINE=MyISAM DEFAULT CHARSET=" . str_replace('-', '', EC_CHARSET) . ";\r\n"; |
| | | } |
| | | else |
| | | { |
| | | $table_df .= $tmp_sql . " TYPE=MyISAM;\r\n"; |
| | | } |
| | | |
| | | return $table_df; |
| | | } |
| | | |
| | | /** |
| | | * 获取指定表的数据定义 |
| | | * |
| | | * @access public |
| | | * @param string $table 表名 |
| | | * @param int $pos 备份开始位置 |
| | | * |
| | | * @return int $post_pos 记录位置 |
| | | */ |
| | | function get_table_data($table, $pos) |
| | | { |
| | | $post_pos = $pos; |
| | | |
| | | /* 获取数据表记录总数 */ |
| | | $total = $this->db->getOne("SELECT COUNT(*) FROM $table"); |
| | | |
| | | if ($total == 0 || $pos >= $total) |
| | | { |
| | | /* 无须处理 */ |
| | | return -1; |
| | | } |
| | | |
| | | /* 确定循环次数 */ |
| | | $cycle_time = ceil(($total-$pos) / $this->offset); //每次取offset条数。需要取的次数 |
| | | |
| | | /* 循环查数据表 */ |
| | | for($i = 0; $i<$cycle_time; $i++) |
| | | { |
| | | /* 获取数据库数据 */ |
| | | $data = $this->db->getAll("SELECT * FROM $table LIMIT " . ($this->offset * $i + $pos) . ', ' . $this->offset); |
| | | $data_count = count($data); |
| | | |
| | | $fields = array_keys($data[0]); |
| | | $start_sql = "INSERT INTO `$table` ( `" . implode("`, `", $fields) . "` ) VALUES "; |
| | | |
| | | /* 循环将数据写入 */ |
| | | for($j=0; $j< $data_count; $j++) |
| | | { |
| | | $record = array_map("dump_escape_string", $data[$j]); //过滤非法字符 |
| | | $record = array_map("dump_null_string", $record); //处理null值 |
| | | |
| | | /* 检查是否能写入,能则写入 */ |
| | | if ($this->is_short) |
| | | { |
| | | if ($post_pos == $total-1) |
| | | { |
| | | $tmp_dump_sql = " ( '" . implode("', '" , $record) . "' );\r\n"; |
| | | } |
| | | else |
| | | { |
| | | if ($j == $data_count - 1) |
| | | { |
| | | $tmp_dump_sql = " ( '" . implode("', '" , $record) . "' );\r\n"; |
| | | } |
| | | else |
| | | { |
| | | $tmp_dump_sql = " ( '" . implode("', '" , $record) . "' ),\r\n"; |
| | | } |
| | | } |
| | | |
| | | if ($post_pos == $pos) |
| | | { |
| | | /* 第一次插入数据 */ |
| | | $tmp_dump_sql = $start_sql . "\r\n" . $tmp_dump_sql; |
| | | } |
| | | else |
| | | { |
| | | if ($j == 0) |
| | | { |
| | | $tmp_dump_sql = $start_sql . "\r\n" . $tmp_dump_sql; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $tmp_dump_sql = $start_sql . " ('" . implode("', '" , $record) . "');\r\n"; |
| | | } |
| | | |
| | | $tmp_str_pos = strpos($tmp_dump_sql, 'NULL'); //把记录中null值的引号去掉 |
| | | $tmp_dump_sql = empty($tmp_str_pos) ? $tmp_dump_sql : substr($tmp_dump_sql, 0, $tmp_str_pos - 1) . 'NULL' . substr($tmp_dump_sql, $tmp_str_pos + 5); |
| | | |
| | | if (strlen($this->dump_sql) + strlen($tmp_dump_sql) > $this->max_size - 32) |
| | | { |
| | | if ($this->sql_num == 0) |
| | | { |
| | | $this->dump_sql .= $tmp_dump_sql; //当是第一条记录时强制写入 |
| | | $this->sql_num++; |
| | | $post_pos++; |
| | | if ($post_pos == $total) |
| | | { |
| | | /* 所有数据已经写完 */ |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | return $post_pos; |
| | | } |
| | | else |
| | | { |
| | | $this->dump_sql .= $tmp_dump_sql; |
| | | $this->sql_num++; //记录sql条数 |
| | | $post_pos++; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* 所有数据已经写完 */ |
| | | return -1; |
| | | } |
| | | |
| | | /** |
| | | * 备份一个数据表 |
| | | * |
| | | * @access public |
| | | * @param string $path 保存路径表名的文件 |
| | | * @param int $vol 卷标 |
| | | * |
| | | * @return array $tables 未备份完的表列表 |
| | | */ |
| | | function dump_table($path, $vol) |
| | | { |
| | | $tables = $this->get_tables_list($path); |
| | | |
| | | if ($tables === false) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | if (empty($tables)) |
| | | { |
| | | return $tables; |
| | | } |
| | | |
| | | $this->dump_sql = $this->make_head($vol); |
| | | |
| | | foreach($tables as $table => $pos) |
| | | { |
| | | |
| | | if ($pos == -1) |
| | | { |
| | | /* 获取表定义,如果没有超过限制则保存 */ |
| | | $table_df = $this->get_table_df($table, true); |
| | | if (strlen($this->dump_sql) + strlen($table_df) > $this->max_size - 32) |
| | | { |
| | | if ($this->sql_num == 0) |
| | | { |
| | | /* 第一条记录,强制写入 */ |
| | | $this->dump_sql .= $table_df; |
| | | $this->sql_num +=2; |
| | | $tables[$table] = 0; |
| | | } |
| | | /* 已经达到上限 */ |
| | | |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | $this->dump_sql .= $table_df; |
| | | $this->sql_num +=2; |
| | | $pos = 0; |
| | | } |
| | | } |
| | | |
| | | /* 尽可能多获取数据表数据 */ |
| | | $post_pos = $this->get_table_data($table, $pos); |
| | | |
| | | if ($post_pos == -1) |
| | | { |
| | | /* 该表已经完成,清除该表 */ |
| | | unset($tables[$table]); |
| | | } |
| | | else |
| | | { |
| | | /* 该表未完成。说明将要到达上限,记录备份数据位置 */ |
| | | $tables[$table] = $post_pos; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | $this->dump_sql .= '-- END v2.x SQL Dump Program '; |
| | | $this->put_tables_list($path, $tables); |
| | | |
| | | return $tables; |
| | | } |
| | | |
| | | /** |
| | | * 生成备份文件头部 |
| | | * |
| | | * @access public |
| | | * @param int 文件卷数 |
| | | * |
| | | * @return string $str 备份文件头部 |
| | | */ |
| | | function make_head($vol) |
| | | { |
| | | /* 系统信息 */ |
| | | $sys_info['os'] = PHP_OS; |
| | | $sys_info['web_server'] = $GLOBALS['ecs']->get_domain(); |
| | | $sys_info['php_ver'] = PHP_VERSION; |
| | | $sys_info['mysql_ver'] = $this->db->version(); |
| | | $sys_info['date'] = date('Y-m-d H:i:s'); |
| | | |
| | | $head = "-- v2.x SQL Dump Program\r\n". |
| | | "-- " . $sys_info['web_server'] . "\r\n". |
| | | "-- \r\n". |
| | | "-- DATE : ".$sys_info["date"]."\r\n". |
| | | "-- MYSQL SERVER VERSION : ".$sys_info['mysql_ver']."\r\n". |
| | | "-- PHP VERSION : ".$sys_info['php_ver']."\r\n". |
| | | "-- VERSION : ".VERSION."\r\n". |
| | | "-- Vol : " . $vol . "\r\n"; |
| | | |
| | | return $head; |
| | | } |
| | | |
| | | /** |
| | | * 获取备份文件信息 |
| | | * |
| | | * @access public |
| | | * @param string $path 备份文件路径 |
| | | * |
| | | * @return array $arr 信息数组 |
| | | */ |
| | | function get_head($path) |
| | | { |
| | | /* 获取sql文件头部信息 */ |
| | | $sql_info = array('date'=>'', 'mysql_ver'=> '', 'php_ver'=>0, 'ecs_ver'=>'', 'vol'=>0); |
| | | $fp = fopen($path,'rb'); |
| | | $str = fread($fp, 250); |
| | | fclose($fp); |
| | | $arr = explode("\n", $str); |
| | | |
| | | foreach ($arr AS $val) |
| | | { |
| | | $pos = strpos($val, ':'); |
| | | if ($pos > 0) |
| | | { |
| | | $type = trim(substr($val, 0, $pos), "-\n\r\t "); |
| | | $value = trim(substr($val, $pos+1), "/\n\r\t "); |
| | | if ($type == 'DATE') |
| | | { |
| | | $sql_info['date'] = $value; |
| | | } |
| | | elseif ($type == 'MYSQL SERVER VERSION') |
| | | { |
| | | $sql_info['mysql_ver'] = $value; |
| | | } |
| | | elseif ($type == 'PHP VERSION') |
| | | { |
| | | $sql_info['php_ver'] = $value; |
| | | } |
| | | elseif ($type == ' VERSION') |
| | | { |
| | | $sql_info['ecs_ver'] = $value; |
| | | } |
| | | elseif ($type == 'Vol') |
| | | { |
| | | $sql_info['vol'] = $value; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return $sql_info; |
| | | } |
| | | |
| | | /** |
| | | * 将文件中数据表列表取出 |
| | | * |
| | | * @access public |
| | | * @param string $path 文件路径 |
| | | * |
| | | * @return array $arr 数据表列表 |
| | | */ |
| | | function get_tables_list($path) |
| | | { |
| | | if (!file_exists($path)) |
| | | { |
| | | $this->error_msg = $path . ' is not exists'; |
| | | |
| | | return false; |
| | | } |
| | | |
| | | $arr = array(); |
| | | $str = @file_get_contents($path); |
| | | |
| | | if (!empty($str)) |
| | | { |
| | | $tmp_arr = explode("\n", $str); |
| | | foreach ($tmp_arr as $val) |
| | | { |
| | | $val = trim ($val, "\r;"); |
| | | if (!empty($val)) |
| | | { |
| | | list($table, $count) = explode(':',$val); |
| | | $arr[$table] = $count; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return $arr; |
| | | } |
| | | |
| | | /** |
| | | * 将数据表数组写入指定文件 |
| | | * |
| | | * @access public |
| | | * @param string $path 文件路径 |
| | | * @param array $arr 要写入的数据 |
| | | * |
| | | * @return boolen |
| | | */ |
| | | function put_tables_list($path, $arr) |
| | | { |
| | | if (is_array($arr)) |
| | | { |
| | | $str = ''; |
| | | foreach($arr as $key => $val) |
| | | { |
| | | $str .= $key . ':' . $val . ";\r\n"; |
| | | } |
| | | |
| | | if (@file_put_contents($path, $str)) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | $this->error_msg = 'Can not write ' . $path; |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $this->error_msg = 'It need a array'; |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 返回一个随机的名字 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return string $str 随机名称 |
| | | */ |
| | | function get_random_name() |
| | | { |
| | | $str = date('Ymd'); |
| | | |
| | | for ($i = 0; $i < 6; $i++) |
| | | { |
| | | $str .= chr(mt_rand(97, 122)); |
| | | } |
| | | |
| | | return $str; |
| | | } |
| | | |
| | | /** |
| | | * 返回错误信息 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return void |
| | | */ |
| | | function errorMsg() |
| | | { |
| | | return $this->error_msg; |
| | | } |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 管理中心菜单数组 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: inc_menu.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | $modules['02_cat_and_goods']['01_goods_list'] = 'goods.php?act=list'; // 商品列表 |
| | | $modules['02_cat_and_goods']['02_goods_add'] = 'goods.php?act=add'; // 添加商品 |
| | | $modules['02_cat_and_goods']['03_category_list'] = 'category.php?act=list'; |
| | | $modules['02_cat_and_goods']['05_comment_manage'] = 'comment_manage.php?act=list'; |
| | | $modules['02_cat_and_goods']['06_goods_brand_list'] = 'brand.php?act=list'; |
| | | $modules['02_cat_and_goods']['08_goods_type'] = 'goods_type.php?act=manage'; |
| | | $modules['02_cat_and_goods']['11_goods_trash'] = 'goods.php?act=trash'; // 商品回收站 |
| | | $modules['02_cat_and_goods']['12_batch_pic'] = 'picture_batch.php'; |
| | | $modules['02_cat_and_goods']['13_batch_add'] = 'goods_batch.php?act=add'; // 商品批量上传 |
| | | $modules['02_cat_and_goods']['14_goods_export'] = 'goods_export.php?act=goods_export'; |
| | | $modules['02_cat_and_goods']['15_batch_edit'] = 'goods_batch.php?act=select'; // 商品批量修改 |
| | | $modules['02_cat_and_goods']['16_goods_script'] = 'gen_goods_script.php?act=setup'; |
| | | $modules['02_cat_and_goods']['17_tag_manage'] = 'tag_manage.php?act=list'; |
| | | $modules['02_cat_and_goods']['50_virtual_card_list'] = 'goods.php?act=list&extension_code=virtual_card'; |
| | | $modules['02_cat_and_goods']['51_virtual_card_add'] = 'goods.php?act=add&extension_code=virtual_card'; |
| | | $modules['02_cat_and_goods']['52_virtual_card_change'] = 'virtual_card.php?act=change'; |
| | | $modules['02_cat_and_goods']['goods_auto'] = 'goods_auto.php?act=list'; |
| | | |
| | | |
| | | $modules['03_promotion']['02_snatch_list'] = 'snatch.php?act=list'; |
| | | $modules['03_promotion']['04_bonustype_list'] = 'bonus.php?act=list'; |
| | | $modules['03_promotion']['06_pack_list'] = 'pack.php?act=list'; |
| | | $modules['03_promotion']['07_card_list'] = 'card.php?act=list'; |
| | | $modules['03_promotion']['08_group_buy'] = 'group_buy.php?act=list'; |
| | | $modules['03_promotion']['09_topic'] = 'topic.php?act=list'; |
| | | $modules['03_promotion']['10_auction'] = 'auction.php?act=list'; |
| | | $modules['03_promotion']['12_favourable'] = 'favourable.php?act=list'; |
| | | $modules['03_promotion']['13_wholesale'] = 'wholesale.php?act=list'; |
| | | $modules['03_promotion']['14_package_list'] = 'package.php?act=list'; |
| | | //$modules['03_promotion']['ebao_commend'] = 'ebao_commend.php?act=list'; |
| | | $modules['03_promotion']['15_exchange_goods'] = 'exchange_goods.php?act=list'; |
| | | |
| | | |
| | | $modules['04_order']['02_order_list'] = 'order.php?act=list'; |
| | | $modules['04_order']['03_order_query'] = 'order.php?act=order_query'; |
| | | $modules['04_order']['04_merge_order'] = 'order.php?act=merge'; |
| | | $modules['04_order']['05_edit_order_print'] = 'order.php?act=templates'; |
| | | $modules['04_order']['06_undispose_booking'] = 'goods_booking.php?act=list_all'; |
| | | //$modules['04_order']['07_repay_application'] = 'repay.php?act=list_all'; |
| | | $modules['04_order']['08_add_order'] = 'order.php?act=add'; |
| | | $modules['04_order']['09_delivery_order'] = 'order.php?act=delivery_list'; |
| | | $modules['04_order']['10_back_order'] = 'order.php?act=back_list'; |
| | | |
| | | $modules['05_banner']['ad_position'] = 'ad_position.php?act=list'; |
| | | $modules['05_banner']['ad_list'] = 'ads.php?act=list'; |
| | | |
| | | $modules['06_stats']['flow_stats'] = 'flow_stats.php?act=view'; |
| | | $modules['06_stats']['searchengine_stats'] = 'searchengine_stats.php?act=view'; |
| | | $modules['06_stats']['z_clicks_stats'] = 'adsense.php?act=list'; |
| | | $modules['06_stats']['report_guest'] = 'guest_stats.php?act=list'; |
| | | $modules['06_stats']['report_order'] = 'order_stats.php?act=list'; |
| | | $modules['06_stats']['report_sell'] = 'sale_general.php?act=list'; |
| | | $modules['06_stats']['sale_list'] = 'sale_list.php?act=list'; |
| | | $modules['06_stats']['sell_stats'] = 'sale_order.php?act=goods_num'; |
| | | $modules['06_stats']['report_users'] = 'users_order.php?act=order_num'; |
| | | $modules['06_stats']['visit_buy_per'] = 'visit_sold.php?act=list'; |
| | | |
| | | $modules['07_content']['03_article_list'] = 'article.php?act=list'; |
| | | $modules['07_content']['02_articlecat_list'] = 'articlecat.php?act=list'; |
| | | $modules['07_content']['vote_list'] = 'vote.php?act=list'; |
| | | $modules['07_content']['article_auto'] = 'article_auto.php?act=list'; |
| | | //$modules['07_content']['shop_help'] = 'shophelp.php?act=list_cat'; |
| | | //$modules['07_content']['shop_info'] = 'shopinfo.php?act=list'; |
| | | |
| | | |
| | | $modules['08_members']['03_users_list'] = 'users.php?act=list'; |
| | | $modules['08_members']['04_users_add'] = 'users.php?act=add'; |
| | | $modules['08_members']['05_user_rank_list'] = 'user_rank.php?act=list'; |
| | | $modules['08_members']['06_list_integrate'] = 'integrate.php?act=list'; |
| | | $modules['08_members']['08_unreply_msg'] = 'user_msg.php?act=list_all'; |
| | | $modules['08_members']['09_user_account'] = 'user_account.php?act=list'; |
| | | $modules['08_members']['10_user_account_manage'] = 'user_account_manage.php?act=list'; |
| | | |
| | | $modules['10_priv_admin']['admin_logs'] = 'admin_logs.php?act=list'; |
| | | $modules['10_priv_admin']['admin_list'] = 'privilege.php?act=list'; |
| | | $modules['10_priv_admin']['admin_role'] = 'role.php?act=list'; |
| | | $modules['10_priv_admin']['agency_list'] = 'agency.php?act=list'; |
| | | $modules['10_priv_admin']['suppliers_list'] = 'suppliers.php?act=list'; // 供货商 |
| | | |
| | | $modules['11_system']['01_shop_config'] = 'shop_config.php?act=list_edit'; |
| | | $modules['11_system']['shop_authorized'] = 'license.php?act=list_edit'; |
| | | $modules['11_system']['02_payment_list'] = 'payment.php?act=list'; |
| | | $modules['11_system']['03_shipping_list'] = 'shipping.php?act=list'; |
| | | $modules['11_system']['04_mail_settings'] = 'shop_config.php?act=mail_settings'; |
| | | $modules['11_system']['05_area_list'] = 'area_manage.php?act=list'; |
| | | //$modules['11_system']['06_plugins'] = 'plugins.php?act=list'; |
| | | $modules['11_system']['07_cron_schcron'] = 'cron.php?act=list'; |
| | | $modules['11_system']['08_friendlink_list'] = 'friend_link.php?act=list'; |
| | | $modules['11_system']['sitemap'] = 'sitemap.php'; |
| | | $modules['11_system']['check_file_priv'] = 'check_file_priv.php?act=check'; |
| | | $modules['11_system']['captcha_manage'] = 'captcha_manage.php?act=main'; |
| | | $modules['11_system']['ucenter_setup'] = 'integrate.php?act=setup&code=ucenter'; |
| | | $modules['11_system']['flashplay'] = 'flashplay.php?act=list'; |
| | | $modules['11_system']['navigator'] = 'navigator.php?act=list'; |
| | | $modules['11_system']['file_check'] = 'filecheck.php'; |
| | | //$modules['11_system']['fckfile_manage'] = 'fckfile_manage.php?act=list'; |
| | | $modules['11_system']['021_reg_fields'] = 'reg_fields.php?act=list'; |
| | | |
| | | |
| | | $modules['12_template']['02_template_select'] = 'template.php?act=list'; |
| | | $modules['12_template']['03_template_setup'] = 'template.php?act=setup'; |
| | | $modules['12_template']['04_template_library'] = 'template.php?act=library'; |
| | | $modules['12_template']['05_edit_languages'] = 'edit_languages.php?act=list'; |
| | | $modules['12_template']['06_template_backup'] = 'template.php?act=backup_setting'; |
| | | $modules['12_template']['mail_template_manage'] = 'mail_template.php?act=list'; |
| | | |
| | | |
| | | $modules['13_backup']['02_db_manage'] = 'database.php?act=backup'; |
| | | $modules['13_backup']['03_db_optimize'] = 'database.php?act=optimize'; |
| | | $modules['13_backup']['04_sql_query'] = 'sql.php?act=main'; |
| | | //$modules['13_backup']['05_synchronous'] = 'integrate.php?act=sync'; |
| | | $modules['13_backup']['convert'] = 'convert.php?act=main'; |
| | | |
| | | |
| | | //$modules['14_sms']['02_sms_my_info'] = 'sms.php?act=display_my_info'; |
| | | $modules['14_sms']['03_sms_send'] = 'sms.php?act=display_send_ui'; |
| | | //$modules['14_sms']['04_sms_charge'] = 'sms.php?act=display_charge_ui'; |
| | | //$modules['14_sms']['05_sms_send_history'] = 'sms.php?act=display_send_history_ui'; |
| | | //$modules['14_sms']['06_sms_charge_history'] = 'sms.php?act=display_charge_history_ui'; |
| | | |
| | | $modules['15_rec']['affiliate'] = 'affiliate.php?act=list'; |
| | | $modules['15_rec']['affiliate_ck'] = 'affiliate_ck.php?act=list'; |
| | | |
| | | $modules['16_email_manage']['email_list'] = 'email_list.php?act=list'; |
| | | $modules['16_email_manage']['magazine_list'] = 'magazine_list.php?act=list'; |
| | | $modules['16_email_manage']['attention_list'] = 'attention_list.php?act=list'; |
| | | $modules['16_email_manage']['view_sendlist'] = 'view_sendlist.php?act=list'; |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 权限对照表 |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | //商品管理权限 |
| | | $purview['01_goods_list'] = array('goods_manage', 'remove_back'); |
| | | $purview['02_goods_add'] = 'goods_manage'; |
| | | $purview['03_category_list'] = array('cat_manage', 'cat_drop'); //分类添加、分类转移和删除 |
| | | $purview['05_comment_manage'] = 'comment_priv'; |
| | | $purview['06_goods_brand_list'] = 'brand_manage'; |
| | | $purview['08_goods_type'] = 'attr_manage'; //商品属性 |
| | | $purview['11_goods_trash'] = array('goods_manage', 'remove_back'); |
| | | $purview['12_batch_pic'] = 'picture_batch'; |
| | | $purview['13_batch_add'] = 'goods_batch'; |
| | | $purview['14_goods_export'] = 'goods_export'; |
| | | $purview['15_batch_edit'] = 'goods_batch'; |
| | | $purview['16_goods_script'] = 'gen_goods_script'; |
| | | $purview['17_tag_manage'] = 'tag_manage'; |
| | | $purview['50_virtual_card_list'] = 'virualcard'; |
| | | $purview['51_virtual_card_add'] = 'virualcard'; |
| | | $purview['52_virtual_card_change'] = 'virualcard'; |
| | | $purview['goods_auto'] = 'goods_auto'; |
| | | |
| | | //促销管理权限 |
| | | $purview['02_snatch_list'] = 'snatch_manage'; |
| | | $purview['04_bonustype_list'] = 'bonus_manage'; |
| | | $purview['06_pack_list'] = 'pack'; |
| | | $purview['07_card_list'] = 'card_manage'; |
| | | $purview['08_group_buy'] = 'group_by'; |
| | | $purview['09_topic'] = 'topic_manage'; |
| | | $purview['10_auction'] = 'auction'; |
| | | $purview['12_favourable'] = 'favourable'; |
| | | $purview['13_wholesale'] = 'whole_sale'; |
| | | $purview['14_package_list'] = 'package_manage'; |
| | | // $purview['02_snatch_list'] = 'gift_manage'; //赠品管理 |
| | | $purview['15_exchange_goods'] = 'exchange_goods'; //赠品管理 |
| | | |
| | | //文章管理权限 |
| | | $purview['02_articlecat_list'] = 'article_cat'; |
| | | $purview['03_article_list'] = 'article_manage'; |
| | | $purview['article_auto'] = 'article_auto'; |
| | | $purview['vote_list'] = 'vote_priv'; |
| | | |
| | | //会员管理权限 |
| | | $purview['03_users_list'] = 'users_manage'; |
| | | $purview['04_users_add'] = 'users_manage'; |
| | | $purview['05_user_rank_list'] = 'user_rank'; |
| | | $purview['09_user_account'] = 'surplus_manage'; |
| | | $purview['06_list_integrate'] = 'integrate_users'; |
| | | $purview['08_unreply_msg'] = 'feedback_priv'; |
| | | $purview['10_user_account_manage'] = 'account_manage'; |
| | | |
| | | //权限管理 |
| | | $purview['admin_logs'] = array('logs_manage', 'logs_drop'); |
| | | $purview['admin_list'] = array('admin_manage', 'admin_drop', 'allot_priv'); |
| | | $purview['agency_list'] = 'agency_manage'; |
| | | $purview['suppliers_list'] = 'suppliers_manage'; // 供货商 |
| | | $purview['admin_role'] = 'role_manage'; |
| | | |
| | | //商店设置权限 |
| | | $purview['01_shop_config'] = 'shop_config'; |
| | | $purview['shop_authorized'] = 'shop_authorized'; |
| | | $purview['shp_webcollect'] = 'webcollect_manage'; |
| | | $purview['02_payment_list'] = 'payment'; |
| | | $purview['03_shipping_list'] = array('ship_manage','shiparea_manage'); |
| | | $purview['04_mail_settings'] = 'shop_config'; |
| | | $purview['05_area_list'] = 'area_manage'; |
| | | $purview['07_cron_schcron'] = 'cron'; |
| | | $purview['08_friendlink_list'] = 'friendlink'; |
| | | $purview['sitemap'] = 'sitemap'; |
| | | $purview['check_file_priv'] = 'file_priv'; |
| | | $purview['captcha_manage'] = 'shop_config'; |
| | | $purview['file_check'] = 'file_check'; |
| | | $purview['navigator'] = 'navigator'; |
| | | $purview['flashplay'] = 'flash_manage'; |
| | | $purview['ucenter_setup'] = 'integrate_users'; |
| | | $purview['021_reg_fields'] = 'reg_fields'; |
| | | |
| | | //广告管理 |
| | | $purview['z_clicks_stats'] = 'ad_manage'; |
| | | $purview['ad_position'] = 'ad_manage'; |
| | | $purview['ad_list'] = 'ad_manage'; |
| | | |
| | | //订单管理权限 |
| | | $purview['02_order_list'] = 'order_view'; |
| | | $purview['03_order_query'] = 'order_view'; |
| | | $purview['04_merge_order'] = 'order_os_edit'; |
| | | $purview['05_edit_order_print'] = 'order_os_edit'; |
| | | $purview['06_undispose_booking'] = 'booking'; |
| | | $purview['08_add_order'] = 'order_edit'; |
| | | $purview['09_delivery_order'] = 'delivery_view'; |
| | | $purview['10_back_order'] = 'back_view'; |
| | | |
| | | //报表统计权限 |
| | | $purview['flow_stats'] = 'client_flow_stats'; |
| | | $purview['report_guest'] = 'client_flow_stats'; |
| | | $purview['report_users'] = 'client_flow_stats'; |
| | | $purview['visit_buy_per'] = 'client_flow_stats'; |
| | | $purview['searchengine_stats'] = 'client_flow_stats'; |
| | | $purview['report_order'] = 'sale_order_stats'; |
| | | $purview['report_sell'] = 'sale_order_stats'; |
| | | $purview['sale_list'] = 'sale_order_stats'; |
| | | $purview['sell_stats'] = 'sale_order_stats'; |
| | | |
| | | |
| | | //模板管理 |
| | | $purview['02_template_select'] = 'template_select'; |
| | | $purview['03_template_setup'] = 'template_setup'; |
| | | $purview['04_template_library'] = 'library_manage'; |
| | | $purview['05_edit_languages'] = 'lang_edit'; |
| | | $purview['06_template_backup'] = 'backup_setting'; |
| | | $purview['mail_template_manage'] = 'mail_template'; |
| | | |
| | | //数据库管理 |
| | | $purview['02_db_manage'] = array('db_backup', 'db_renew'); |
| | | $purview['03_db_optimize'] = 'db_optimize'; |
| | | $purview['04_sql_query'] = 'sql_query'; |
| | | $purview['convert'] = 'convert'; |
| | | |
| | | //短信管理 |
| | | $purview['02_sms_my_info'] = 'my_info'; |
| | | $purview['03_sms_send'] = 'sms_send'; |
| | | $purview['04_sms_charge'] = 'sms_charge'; |
| | | $purview['05_sms_send_history'] = 'send_history'; |
| | | $purview['06_sms_charge_history']= 'charge_history'; |
| | | |
| | | //推荐管理 |
| | | $purview['affiliate'] = 'affiliate'; |
| | | $purview['affiliate_ck'] = 'affiliate_ck'; |
| | | |
| | | //邮件群发管理 |
| | | $purview['attention_list'] = 'attention_list'; |
| | | $purview['email_list'] = 'email_list'; |
| | | $purview['magazine_list'] = 'magazine_list'; |
| | | $purview['view_sendlist'] = 'view_sendlist'; |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | /** |
| | | 管理中心公用文件 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: init.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | define('ECS_ADMIN', true); |
| | | |
| | | error_reporting(E_ALL); |
| | | |
| | | if (__FILE__ == '') |
| | | { |
| | | die('Fatal error code: 0'); |
| | | } |
| | | |
| | | /* 初始化设置 */ |
| | | @ini_set('memory_limit', '64M'); |
| | | @ini_set('session.cache_expire', 180); |
| | | @ini_set('session.use_trans_sid', 0); |
| | | @ini_set('session.use_cookies', 1); |
| | | @ini_set('session.auto_start', 0); |
| | | @ini_set('display_errors', 1); |
| | | /* 代码增加 By Start */ |
| | | define('MYSQL_ERROR_DISPLAY', 0); |
| | | /* 代码增加 By End */ |
| | | |
| | | if (DIRECTORY_SEPARATOR == '\\') |
| | | { |
| | | @ini_set('include_path', '.;' . ROOT_PATH); |
| | | } |
| | | else |
| | | { |
| | | @ini_set('include_path', '.:' . ROOT_PATH); |
| | | } |
| | | |
| | | if (file_exists('../data/config.php')) |
| | | { |
| | | include('../data/config.php'); |
| | | } |
| | | else |
| | | { |
| | | include('../includes/config.php'); |
| | | } |
| | | |
| | | /* 取得当前 所在的根目录 */ |
| | | if(!defined('ADMIN_PATH')) |
| | | { |
| | | define('ADMIN_PATH','json'); |
| | | } |
| | | define('ROOT_PATH', str_replace('json/includes/init.php', '', str_replace('\\', '/', __FILE__))); |
| | | |
| | | |
| | | if (defined('DEBUG_MODE') == false) |
| | | { |
| | | define('DEBUG_MODE', 0); |
| | | } |
| | | |
| | | if (PHP_VERSION >= '5.1' && !empty($timezone)) |
| | | { |
| | | date_default_timezone_set($timezone); |
| | | } |
| | | |
| | | if (isset($_SERVER['PHP_SELF'])) |
| | | { |
| | | define('PHP_SELF', $_SERVER['PHP_SELF']); |
| | | } |
| | | else |
| | | { |
| | | define('PHP_SELF', $_SERVER['SCRIPT_NAME']); |
| | | } |
| | | |
| | | require( '../includes/inc_constant.php'); |
| | | require('../includes/cls_ecshop.php'); |
| | | require('../includes/cls_error.php'); |
| | | require('../includes/lib_time.php'); |
| | | require('../includes/lib_base.php'); |
| | | require('../includes/lib_common.php'); |
| | | require('./includes/lib_main.php'); |
| | | require('./includes/cls_exchange.php'); |
| | | |
| | | |
| | | |
| | | /* 创建 对象 */ |
| | | $ecs = new ECS($db_name, $prefix); |
| | | define('DATA_DIR', $ecs->data_dir()); |
| | | define('IMAGE_DIR', $ecs->image_dir()); |
| | | |
| | | /* 初始化数据库类 */ |
| | | require('../includes/cls_mysql.php'); |
| | | $db = new cls_mysql($db_host, $db_user, $db_pass, $db_name); |
| | | $db_host = $db_user = $db_pass = $db_name = NULL; |
| | | |
| | | /* 载入系统参数 */ |
| | | $_CFG = load_config(); |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 管理中心商品相关函数 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: lib_goods.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | /** |
| | | * 取得推荐类型列表 |
| | | * @return array 推荐类型列表 |
| | | */ |
| | | function get_intro_list() |
| | | { |
| | | return array( |
| | | 'is_best' => $GLOBALS['_LANG']['is_best'], |
| | | 'is_new' => $GLOBALS['_LANG']['is_new'], |
| | | 'is_hot' => $GLOBALS['_LANG']['is_hot'], |
| | | 'is_promote' => $GLOBALS['_LANG']['is_promote'], |
| | | 'all_type' => $GLOBALS['_LANG']['all_type'], |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 取得重量单位列表 |
| | | * @return array 重量单位列表 |
| | | */ |
| | | function get_unit_list() |
| | | { |
| | | return array( |
| | | '1' => $GLOBALS['_LANG']['unit_kg'], |
| | | '0.001' => $GLOBALS['_LANG']['unit_g'], |
| | | ); |
| | | } |
| | | |
| | | /** |
| | | * 取得会员等级列表 |
| | | * @return array 会员等级列表 |
| | | */ |
| | | function get_user_rank_list() |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_rank') . |
| | | " ORDER BY min_points"; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得某商品的会员价格列表 |
| | | * @param int $goods_id 商品编号 |
| | | * @return array 会员价格列表 user_rank => user_price |
| | | */ |
| | | function get_member_price_list($goods_id) |
| | | { |
| | | /* 取得会员价格 */ |
| | | $price_list = array(); |
| | | $sql = "SELECT user_rank, user_price FROM " . |
| | | $GLOBALS['ecs']->table('member_price') . |
| | | " WHERE goods_id = '$goods_id'"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $price_list[$row['user_rank']] = $row['user_price']; |
| | | } |
| | | |
| | | return $price_list; |
| | | } |
| | | |
| | | /** |
| | | * 插入或更新商品属性 |
| | | * |
| | | * @param int $goods_id 商品编号 |
| | | * @param array $id_list 属性编号数组 |
| | | * @param array $is_spec_list 是否规格数组 'true' | 'false' |
| | | * @param array $value_price_list 属性值数组 |
| | | * @return array 返回受到影响的goods_attr_id数组 |
| | | */ |
| | | function handle_goods_attr($goods_id, $id_list, $is_spec_list, $value_price_list) |
| | | { |
| | | $goods_attr_id = array(); |
| | | |
| | | /* 循环处理每个属性 */ |
| | | foreach ($id_list AS $key => $id) |
| | | { |
| | | $is_spec = $is_spec_list[$key]; |
| | | if ($is_spec == 'false') |
| | | { |
| | | $value = $value_price_list[$key]; |
| | | $price = ''; |
| | | } |
| | | else |
| | | { |
| | | $value_list = array(); |
| | | $price_list = array(); |
| | | if ($value_price_list[$key]) |
| | | { |
| | | $vp_list = explode(chr(13), $value_price_list[$key]); |
| | | foreach ($vp_list AS $v_p) |
| | | { |
| | | $arr = explode(chr(9), $v_p); |
| | | $value_list[] = $arr[0]; |
| | | $price_list[] = $arr[1]; |
| | | } |
| | | } |
| | | $value = join(chr(13), $value_list); |
| | | $price = join(chr(13), $price_list); |
| | | } |
| | | |
| | | // 插入或更新记录 |
| | | $sql = "SELECT goods_attr_id FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_id = '$goods_id' AND attr_id = '$id' AND attr_value = '$value' LIMIT 0, 1"; |
| | | $result_id = $GLOBALS['db']->getOne($sql); |
| | | if (!empty($result_id)) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('goods_attr') . " |
| | | SET attr_value = '$value' |
| | | WHERE goods_id = '$goods_id' |
| | | AND attr_id = '$id' |
| | | AND goods_attr_id = '$result_id'"; |
| | | |
| | | $goods_attr_id[$id] = $result_id; |
| | | } |
| | | else |
| | | { |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_attr') . " (goods_id, attr_id, attr_value, attr_price) " . |
| | | "VALUES ('$goods_id', '$id', '$value', '$price')"; |
| | | } |
| | | |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | if ($goods_attr_id[$id] == '') |
| | | { |
| | | $goods_attr_id[$id] = $GLOBALS['db']->insert_id(); |
| | | } |
| | | } |
| | | |
| | | return $goods_attr_id; |
| | | } |
| | | |
| | | /** |
| | | * 保存某商品的会员价格 |
| | | * @param int $goods_id 商品编号 |
| | | * @param array $rank_list 等级列表 |
| | | * @param array $price_list 价格列表 |
| | | * @return void |
| | | */ |
| | | function handle_member_price($goods_id, $rank_list, $price_list) |
| | | { |
| | | /* 循环处理每个会员等级 */ |
| | | foreach ($rank_list AS $key => $rank) |
| | | { |
| | | /* 会员等级对应的价格 */ |
| | | $price = $price_list[$key]; |
| | | |
| | | // 插入或更新记录 |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('member_price') . |
| | | " WHERE goods_id = '$goods_id' AND user_rank = '$rank'"; |
| | | if ($GLOBALS['db']->getOne($sql) > 0) |
| | | { |
| | | /* 如果会员价格是小于0则删除原来价格,不是则更新为新的价格 */ |
| | | if ($price < 0) |
| | | { |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('member_price') . |
| | | " WHERE goods_id = '$goods_id' AND user_rank = '$rank' LIMIT 1"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('member_price') . |
| | | " SET user_price = '$price' " . |
| | | "WHERE goods_id = '$goods_id' " . |
| | | "AND user_rank = '$rank' LIMIT 1"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if ($price == -1) |
| | | { |
| | | $sql = ''; |
| | | } |
| | | else |
| | | { |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('member_price') . " (goods_id, user_rank, user_price) " . |
| | | "VALUES ('$goods_id', '$rank', '$price')"; |
| | | } |
| | | } |
| | | |
| | | if ($sql) |
| | | { |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存某商品的扩展分类 |
| | | * @param int $goods_id 商品编号 |
| | | * @param array $cat_list 分类编号数组 |
| | | * @return void |
| | | */ |
| | | function handle_other_cat($goods_id, $cat_list) |
| | | { |
| | | /* 查询现有的扩展分类 */ |
| | | $sql = "SELECT cat_id FROM " . $GLOBALS['ecs']->table('goods_cat') . |
| | | " WHERE goods_id = '$goods_id'"; |
| | | $exist_list = $GLOBALS['db']->getCol($sql); |
| | | |
| | | /* 删除不再有的分类 */ |
| | | $delete_list = array_diff($exist_list, $cat_list); |
| | | if ($delete_list) |
| | | { |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_cat') . |
| | | " WHERE goods_id = '$goods_id' " . |
| | | "AND cat_id " . db_create_in($delete_list); |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /* 添加新加的分类 */ |
| | | $add_list = array_diff($cat_list, $exist_list, array(0)); |
| | | foreach ($add_list AS $cat_id) |
| | | { |
| | | // 插入记录 |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_cat') . |
| | | " (goods_id, cat_id) " . |
| | | "VALUES ('$goods_id', '$cat_id')"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存某商品的关联商品 |
| | | * @param int $goods_id |
| | | * @return void |
| | | */ |
| | | function handle_link_goods($goods_id) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('link_goods') . " SET " . |
| | | " goods_id = '$goods_id' " . |
| | | " WHERE goods_id = '0'" . |
| | | " AND admin_id = '$_SESSION[admin_id]'"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('link_goods') . " SET " . |
| | | " link_goods_id = '$goods_id' " . |
| | | " WHERE link_goods_id = '0'" . |
| | | " AND admin_id = '$_SESSION[admin_id]'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 保存某商品的配件 |
| | | * @param int $goods_id |
| | | * @return void |
| | | */ |
| | | function handle_group_goods($goods_id) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('group_goods') . " SET " . |
| | | " parent_id = '$goods_id' " . |
| | | " WHERE parent_id = '0'" . |
| | | " AND admin_id = '$_SESSION[admin_id]'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 保存某商品的关联文章 |
| | | * @param int $goods_id |
| | | * @return void |
| | | */ |
| | | function handle_goods_article($goods_id) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('goods_article') . " SET " . |
| | | " goods_id = '$goods_id' " . |
| | | " WHERE goods_id = '0'" . |
| | | " AND admin_id = '$_SESSION[admin_id]'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 保存某商品的相册图片 |
| | | * @param int $goods_id |
| | | * @param array $image_files |
| | | * @param array $image_descs |
| | | * @return void |
| | | */ |
| | | function handle_gallery_image($goods_id, $image_files, $image_descs, $image_urls) |
| | | { |
| | | /* 是否处理缩略图 */ |
| | | $proc_thumb = (isset($GLOBALS['shop_id']) && $GLOBALS['shop_id'] > 0)? false : true; |
| | | foreach ($image_descs AS $key => $img_desc) |
| | | { |
| | | /* 是否成功上传 */ |
| | | $flag = false; |
| | | if (isset($image_files['error'])) |
| | | { |
| | | if ($image_files['error'][$key] == 0) |
| | | { |
| | | $flag = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if ($image_files['tmp_name'][$key] != 'none') |
| | | { |
| | | $flag = true; |
| | | } |
| | | } |
| | | |
| | | if ($flag) |
| | | { |
| | | // 生成缩略图 |
| | | if ($proc_thumb) |
| | | { |
| | | $thumb_url = $GLOBALS['image']->make_thumb($image_files['tmp_name'][$key], $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']); |
| | | $thumb_url = is_string($thumb_url) ? $thumb_url : ''; |
| | | } |
| | | |
| | | $upload = array( |
| | | 'name' => $image_files['name'][$key], |
| | | 'type' => $image_files['type'][$key], |
| | | 'tmp_name' => $image_files['tmp_name'][$key], |
| | | 'size' => $image_files['size'][$key], |
| | | ); |
| | | if (isset($image_files['error'])) |
| | | { |
| | | $upload['error'] = $image_files['error'][$key]; |
| | | } |
| | | $img_original = $GLOBALS['image']->upload_image($upload); |
| | | if ($img_original === false) |
| | | { |
| | | sys_msg($GLOBALS['image']->error_msg(), 1, array(), false); |
| | | } |
| | | $img_url = $img_original; |
| | | |
| | | if (!$proc_thumb) |
| | | { |
| | | $thumb_url = $img_original; |
| | | } |
| | | // 如果服务器支持GD 则添加水印 |
| | | if ($proc_thumb && gd_version() > 0) |
| | | { |
| | | $pos = strpos(basename($img_original), '.'); |
| | | $newname = dirname($img_original) . '/' . $GLOBALS['image']->random_filename() . substr(basename($img_original), $pos); |
| | | copy('../' . $img_original, '../' . $newname); |
| | | $img_url = $newname; |
| | | |
| | | $GLOBALS['image']->add_watermark('../'.$img_url,'',$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']); |
| | | } |
| | | |
| | | /* 重新格式化图片名称 */ |
| | | $img_original = reformat_image_name('gallery', $goods_id, $img_original, 'source'); |
| | | $img_url = reformat_image_name('gallery', $goods_id, $img_url, 'goods'); |
| | | $thumb_url = reformat_image_name('gallery_thumb', $goods_id, $thumb_url, 'thumb'); |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . |
| | | "VALUES ('$goods_id', '$img_url', '$img_desc', '$thumb_url', '$img_original')"; |
| | | $GLOBALS['db']->query($sql); |
| | | /* 不保留商品原图的时候删除原图 */ |
| | | if ($proc_thumb && !$GLOBALS['_CFG']['retain_original_img'] && !empty($img_original)) |
| | | { |
| | | $GLOBALS['db']->query("UPDATE " . $GLOBALS['ecs']->table('goods_gallery') . " SET img_original='' WHERE `goods_id`='{$goods_id}'"); |
| | | @unlink('../' . $img_original); |
| | | } |
| | | } |
| | | elseif (!empty($image_urls[$key]) && ($image_urls[$key] != $GLOBALS['_LANG']['img_file']) && ($image_urls[$key] != 'http://') && copy(trim($image_urls[$key]), ROOT_PATH . 'temp/' . basename($image_urls[$key]))) |
| | | { |
| | | $image_url = trim($image_urls[$key]); |
| | | |
| | | //定义原图路径 |
| | | $down_img = ROOT_PATH . 'temp/' . basename($image_url); |
| | | |
| | | // 生成缩略图 |
| | | if ($proc_thumb) |
| | | { |
| | | $thumb_url = $GLOBALS['image']->make_thumb($down_img, $GLOBALS['_CFG']['thumb_width'], $GLOBALS['_CFG']['thumb_height']); |
| | | $thumb_url = is_string($thumb_url) ? $thumb_url : ''; |
| | | $thumb_url = reformat_image_name('gallery_thumb', $goods_id, $thumb_url, 'thumb'); |
| | | } |
| | | |
| | | if (!$proc_thumb) |
| | | { |
| | | $thumb_url = htmlspecialchars($image_url); |
| | | } |
| | | |
| | | /* 重新格式化图片名称 */ |
| | | $img_url = $img_original = htmlspecialchars($image_url); |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('goods_gallery') . " (goods_id, img_url, img_desc, thumb_url, img_original) " . |
| | | "VALUES ('$goods_id', '$img_url', '$img_desc', '$thumb_url', '$img_original')"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | @unlink($down_img); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改商品某字段值 |
| | | * @param string $goods_id 商品编号,可以为多个,用 ',' 隔开 |
| | | * @param string $field 字段名 |
| | | * @param string $value 字段值 |
| | | * @return bool |
| | | */ |
| | | function update_goods($goods_id, $field, $value) |
| | | { |
| | | if ($goods_id) |
| | | { |
| | | /* 清除缓存 */ |
| | | clear_cache_files(); |
| | | |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('goods') . |
| | | " SET $field = '$value' , last_update = '". gmtime() ."' " . |
| | | "WHERE goods_id " . db_create_in($goods_id); |
| | | return $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 从回收站删除多个商品 |
| | | * @param mix $goods_id 商品id列表:可以逗号格开,也可以是数组 |
| | | * @return void |
| | | */ |
| | | function delete_goods($goods_id) |
| | | { |
| | | if (empty($goods_id)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | /* 取得有效商品id */ |
| | | $sql = "SELECT DISTINCT goods_id FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id " . db_create_in($goods_id) . " AND is_delete = 1"; |
| | | $goods_id = $GLOBALS['db']->getCol($sql); |
| | | if (empty($goods_id)) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | /* 删除商品图片和轮播图片文件 */ |
| | | $sql = "SELECT goods_thumb, goods_img, original_img " . |
| | | "FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id " . db_create_in($goods_id); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($goods = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if (!empty($goods['goods_thumb'])) |
| | | { |
| | | @unlink('../' . $goods['goods_thumb']); |
| | | } |
| | | if (!empty($goods['goods_img'])) |
| | | { |
| | | @unlink('../' . $goods['goods_img']); |
| | | } |
| | | if (!empty($goods['original_img'])) |
| | | { |
| | | @unlink('../' . $goods['original_img']); |
| | | } |
| | | } |
| | | |
| | | /* 删除商品 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 删除商品的货品记录 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('products') . |
| | | " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 删除商品相册的图片文件 */ |
| | | $sql = "SELECT img_url, thumb_url, img_original " . |
| | | "FROM " . $GLOBALS['ecs']->table('goods_gallery') . |
| | | " WHERE goods_id " . db_create_in($goods_id); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if (!empty($row['img_url'])) |
| | | { |
| | | @unlink('../' . $row['img_url']); |
| | | } |
| | | if (!empty($row['thumb_url'])) |
| | | { |
| | | @unlink('../' . $row['thumb_url']); |
| | | } |
| | | if (!empty($row['img_original'])) |
| | | { |
| | | @unlink('../' . $row['img_original']); |
| | | } |
| | | } |
| | | |
| | | /* 删除商品相册 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_gallery') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 删除相关表记录 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('collect_goods') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_article') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('goods_cat') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('member_price') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('group_goods') . " WHERE parent_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('group_goods') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('link_goods') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('link_goods') . " WHERE link_goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('tag') . " WHERE goods_id " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('comment') . " WHERE comment_type = 0 AND id_value " . db_create_in($goods_id); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 删除相应虚拟商品记录 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('virtual_card') . " WHERE goods_id " . db_create_in($goods_id); |
| | | if (!$GLOBALS['db']->query($sql, 'SILENT') && $GLOBALS['db']->errno() != 1146) |
| | | { |
| | | die($GLOBALS['db']->error()); |
| | | } |
| | | |
| | | /* 清除缓存 */ |
| | | clear_cache_files(); |
| | | } |
| | | |
| | | /** |
| | | * 为某商品生成唯一的货号 |
| | | * @param int $goods_id 商品编号 |
| | | * @return string 唯一的货号 |
| | | */ |
| | | function generate_goods_sn($goods_id) |
| | | { |
| | | $goods_sn = $GLOBALS['_CFG']['sn_prefix'] . str_repeat('0', 6 - strlen($goods_id)) . $goods_id; |
| | | |
| | | $sql = "SELECT goods_sn FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_sn LIKE '" . mysql_like_quote($goods_sn) . "%' AND goods_id <> '$goods_id' " . |
| | | " ORDER BY LENGTH(goods_sn) DESC"; |
| | | $sn_list = $GLOBALS['db']->getCol($sql); |
| | | if (in_array($goods_sn, $sn_list)) |
| | | { |
| | | $max = pow(10, strlen($sn_list[0]) - strlen($goods_sn) + 1) - 1; |
| | | $new_sn = $goods_sn . mt_rand(0, $max); |
| | | while (in_array($new_sn, $sn_list)) |
| | | { |
| | | $new_sn = $goods_sn . mt_rand(0, $max); |
| | | } |
| | | $goods_sn = $new_sn; |
| | | } |
| | | |
| | | return $goods_sn; |
| | | } |
| | | |
| | | /** |
| | | * 商品货号是否重复 |
| | | * |
| | | * @param string $goods_sn 商品货号;请在传入本参数前对本参数进行SQl脚本过滤 |
| | | * @param int $goods_id 商品id;默认值为:0,没有商品id |
| | | * @return bool true,重复;false,不重复 |
| | | */ |
| | | function check_goods_sn_exist($goods_sn, $goods_id = 0) |
| | | { |
| | | $goods_sn = trim($goods_sn); |
| | | $goods_id = intval($goods_id); |
| | | if (strlen($goods_sn) == 0) |
| | | { |
| | | return true; //重复 |
| | | } |
| | | |
| | | if (empty($goods_id)) |
| | | { |
| | | $sql = "SELECT goods_id FROM " . $GLOBALS['ecs']->table('goods') ." |
| | | WHERE goods_sn = '$goods_sn'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT goods_id FROM " . $GLOBALS['ecs']->table('goods') ." |
| | | WHERE goods_sn = '$goods_sn' |
| | | AND goods_id <> '$goods_id'"; |
| | | } |
| | | |
| | | $res = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if (empty($res)) |
| | | { |
| | | return false; //不重复 |
| | | } |
| | | else |
| | | { |
| | | return true; //重复 |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 取得通用属性和某分类的属性,以及某商品的属性值 |
| | | * @param int $cat_id 分类编号 |
| | | * @param int $goods_id 商品编号 |
| | | * @return array 规格与属性列表 |
| | | */ |
| | | function get_attr_list($cat_id, $goods_id = 0) |
| | | { |
| | | if (empty($cat_id)) |
| | | { |
| | | return array(); |
| | | } |
| | | |
| | | // 查询属性值及商品的属性值 |
| | | $sql = "SELECT a.attr_id, a.attr_name, a.attr_input_type, a.attr_type, a.attr_values, v.attr_value, v.attr_price ". |
| | | "FROM " .$GLOBALS['ecs']->table('attribute'). " AS a ". |
| | | "LEFT JOIN " .$GLOBALS['ecs']->table('goods_attr'). " AS v ". |
| | | "ON v.attr_id = a.attr_id AND v.goods_id = '$goods_id' ". |
| | | "WHERE a.cat_id = " . intval($cat_id) ." OR a.cat_id = 0 ". |
| | | "ORDER BY a.sort_order, a.attr_type, a.attr_id, v.attr_price, v.goods_attr_id"; |
| | | |
| | | $row = $GLOBALS['db']->GetAll($sql); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 获取商品类型中包含规格的类型列表 |
| | | * |
| | | * @access public |
| | | * @return array |
| | | */ |
| | | function get_goods_type_specifications() |
| | | { |
| | | // 查询 |
| | | $sql = "SELECT DISTINCT cat_id |
| | | FROM " .$GLOBALS['ecs']->table('attribute'). " |
| | | WHERE attr_type = 1"; |
| | | $row = $GLOBALS['db']->GetAll($sql); |
| | | |
| | | $return_arr = array(); |
| | | if (!empty($row)) |
| | | { |
| | | foreach ($row as $value) |
| | | { |
| | | $return_arr[$value['cat_id']] = $value['cat_id']; |
| | | } |
| | | } |
| | | return $return_arr; |
| | | } |
| | | |
| | | /** |
| | | * 根据属性数组创建属性的表单 |
| | | * |
| | | * @access public |
| | | * @param int $cat_id 分类编号 |
| | | * @param int $goods_id 商品编号 |
| | | * @return string |
| | | */ |
| | | function build_attr_html($cat_id, $goods_id = 0) |
| | | { |
| | | $attr = get_attr_list($cat_id, $goods_id); |
| | | $html = '<table width="100%" id="attrTable">'; |
| | | $spec = 0; |
| | | |
| | | foreach ($attr AS $key => $val) |
| | | { |
| | | $html .= "<tr><td class='label'>"; |
| | | if ($val['attr_type'] == 1 || $val['attr_type'] == 2) |
| | | { |
| | | $html .= ($spec != $val['attr_id']) ? |
| | | "<a href='javascript:;' onclick='addSpec(this)'>[+]</a>" : |
| | | "<a href='javascript:;' onclick='removeSpec(this)'>[-]</a>"; |
| | | $spec = $val['attr_id']; |
| | | } |
| | | |
| | | $html .= "$val[attr_name]</td><td><input type='hidden' name='attr_id_list[]' value='$val[attr_id]' />"; |
| | | |
| | | if ($val['attr_input_type'] == 0) |
| | | { |
| | | $html .= '<input name="attr_value_list[]" type="text" value="' .htmlspecialchars($val['attr_value']). '" size="40" /> '; |
| | | } |
| | | elseif ($val['attr_input_type'] == 2) |
| | | { |
| | | $html .= '<textarea name="attr_value_list[]" rows="3" cols="40">' .htmlspecialchars($val['attr_value']). '</textarea>'; |
| | | } |
| | | else |
| | | { |
| | | $html .= '<select name="attr_value_list[]">'; |
| | | $html .= '<option value="">' .$GLOBALS['_LANG']['select_please']. '</option>'; |
| | | |
| | | $attr_values = explode("\n", $val['attr_values']); |
| | | |
| | | foreach ($attr_values AS $opt) |
| | | { |
| | | $opt = trim(htmlspecialchars($opt)); |
| | | |
| | | $html .= ($val['attr_value'] != $opt) ? |
| | | '<option value="' . $opt . '">' . $opt . '</option>' : |
| | | '<option value="' . $opt . '" selected="selected">' . $opt . '</option>'; |
| | | } |
| | | $html .= '</select> '; |
| | | } |
| | | |
| | | $html .= ($val['attr_type'] == 1 || $val['attr_type'] == 2) ? |
| | | $GLOBALS['_LANG']['spec_price'].' <input type="text" name="attr_price_list[]" value="' . $val['attr_price'] . '" size="5" maxlength="10" />' : |
| | | ' <input type="hidden" name="attr_price_list[]" value="0" />'; |
| | | |
| | | $html .= '</td></tr>'; |
| | | } |
| | | |
| | | $html .= '</table>'; |
| | | |
| | | return $html; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定商品相关的商品 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_linked_goods($goods_id) |
| | | { |
| | | $sql = "SELECT lg.link_goods_id AS goods_id, g.goods_name, lg.is_double " . |
| | | "FROM " . $GLOBALS['ecs']->table('link_goods') . " AS lg, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE lg.goods_id = '$goods_id' " . |
| | | "AND lg.link_goods_id = g.goods_id "; |
| | | if ($goods_id == 0) |
| | | { |
| | | $sql .= " AND lg.admin_id = '$_SESSION[admin_id]'"; |
| | | } |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | foreach ($row AS $key => $val) |
| | | { |
| | | $linked_type = $val['is_double'] == 0 ? $GLOBALS['_LANG']['single'] : $GLOBALS['_LANG']['double']; |
| | | |
| | | $row[$key]['goods_name'] = $val['goods_name'] . " -- [$linked_type]"; |
| | | |
| | | unset($row[$key]['is_double']); |
| | | } |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定商品的配件 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_group_goods($goods_id) |
| | | { |
| | | $sql = "SELECT gg.goods_id, CONCAT(g.goods_name, ' -- [', gg.goods_price, ']') AS goods_name " . |
| | | "FROM " . $GLOBALS['ecs']->table('group_goods') . " AS gg, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE gg.parent_id = '$goods_id' " . |
| | | "AND gg.goods_id = g.goods_id "; |
| | | if ($goods_id == 0) |
| | | { |
| | | $sql .= " AND gg.admin_id = '$_SESSION[admin_id]'"; |
| | | } |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品的关联文章 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_goods_articles($goods_id) |
| | | { |
| | | $sql = "SELECT g.article_id, a.title " . |
| | | "FROM " .$GLOBALS['ecs']->table('goods_article') . " AS g, " . |
| | | $GLOBALS['ecs']->table('article') . " AS a " . |
| | | "WHERE g.goods_id = '$goods_id' " . |
| | | "AND g.article_id = a.article_id "; |
| | | if ($goods_id == 0) |
| | | { |
| | | $sql .= " AND g.admin_id = '$_SESSION[admin_id]'"; |
| | | } |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品列表 |
| | | * |
| | | * @access public |
| | | * @params integer $isdelete |
| | | * @params integer $real_goods |
| | | * @params integer $conditions |
| | | * @return array |
| | | */ |
| | | function goods_list($is_delete, $real_goods=1, $conditions = '') |
| | | { |
| | | /* 过滤条件 */ |
| | | $param_str = '-' . $is_delete . '-' . $real_goods; |
| | | $result = get_filter($param_str); |
| | | if ($result === false) |
| | | { |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | $filter['cat_id'] = empty($_REQUEST['cat_id']) ? 0 : intval($_REQUEST['cat_id']); |
| | | $filter['intro_type'] = empty($_REQUEST['intro_type']) ? '' : trim($_REQUEST['intro_type']); |
| | | $filter['is_promote'] = empty($_REQUEST['is_promote']) ? 0 : intval($_REQUEST['is_promote']); |
| | | $filter['stock_warning'] = empty($_REQUEST['stock_warning']) ? 0 : intval($_REQUEST['stock_warning']); |
| | | $filter['brand_id'] = empty($_REQUEST['brand_id']) ? 0 : intval($_REQUEST['brand_id']); |
| | | $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']); |
| | | $filter['suppliers_id'] = isset($_REQUEST['suppliers_id']) ? (empty($_REQUEST['suppliers_id']) ? '' : trim($_REQUEST['suppliers_id'])) : ''; |
| | | $filter['is_on_sale'] = isset($_REQUEST['is_on_sale']) ? ((empty($_REQUEST['is_on_sale']) && $_REQUEST['is_on_sale'] === 0) ? '' : trim($_REQUEST['is_on_sale'])) : ''; |
| | | if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) |
| | | { |
| | | $filter['keyword'] = json_str_iconv($filter['keyword']); |
| | | } |
| | | $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'goods_id' : trim($_REQUEST['sort_by']); |
| | | $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); |
| | | $filter['extension_code'] = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']); |
| | | $filter['is_delete'] = $is_delete; |
| | | $filter['real_goods'] = $real_goods; |
| | | |
| | | $where = $filter['cat_id'] > 0 ? " AND " . get_children($filter['cat_id']) : ''; |
| | | |
| | | /* 推荐类型 */ |
| | | switch ($filter['intro_type']) |
| | | { |
| | | case 'is_best': |
| | | $where .= " AND is_best=1"; |
| | | break; |
| | | case 'is_hot': |
| | | $where .= ' AND is_hot=1'; |
| | | break; |
| | | case 'is_new': |
| | | $where .= ' AND is_new=1'; |
| | | break; |
| | | case 'is_promote': |
| | | $where .= " AND is_promote = 1 AND promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today'"; |
| | | break; |
| | | case 'all_type'; |
| | | $where .= " AND (is_best=1 OR is_hot=1 OR is_new=1 OR (is_promote = 1 AND promote_price > 0 AND promote_start_date <= '" . $today . "' AND promote_end_date >= '" . $today . "'))"; |
| | | } |
| | | |
| | | /* 库存警告 */ |
| | | if ($filter['stock_warning']) |
| | | { |
| | | $where .= ' AND goods_number <= warn_number '; |
| | | } |
| | | |
| | | /* 品牌 */ |
| | | if ($filter['brand_id']) |
| | | { |
| | | $where .= " AND brand_id='$filter[brand_id]'"; |
| | | } |
| | | |
| | | /* 扩展 */ |
| | | if ($filter['extension_code']) |
| | | { |
| | | $where .= " AND extension_code='$filter[extension_code]'"; |
| | | } |
| | | |
| | | /* 关键字 */ |
| | | if (!empty($filter['keyword'])) |
| | | { |
| | | $where .= " AND (goods_sn LIKE '%" . mysql_like_quote($filter['keyword']) . "%' OR goods_name LIKE '%" . mysql_like_quote($filter['keyword']) . "%')"; |
| | | } |
| | | |
| | | if ($real_goods > -1) |
| | | { |
| | | $where .= " AND is_real='$real_goods'"; |
| | | } |
| | | |
| | | /* 上架 */ |
| | | if ($filter['is_on_sale'] !== '') |
| | | { |
| | | $where .= " AND (is_on_sale = '" . $filter['is_on_sale'] . "')"; |
| | | } |
| | | |
| | | /* 供货商 */ |
| | | if (!empty($filter['suppliers_id'])) |
| | | { |
| | | $where .= " AND (suppliers_id = '" . $filter['suppliers_id'] . "')"; |
| | | } |
| | | |
| | | $where .= $conditions; |
| | | |
| | | /* 记录总数 */ |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('goods'). " AS g WHERE is_delete='$is_delete' $where"; |
| | | $filter['record_count'] = $GLOBALS['db']->getOne($sql); |
| | | |
| | | /* 分页大小 */ |
| | | $filter = page_and_size($filter); |
| | | |
| | | $sql = "SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot, sort_order, goods_number, integral, " . |
| | | " (promote_price > 0 AND promote_start_date <= '$today' AND promote_end_date >= '$today') AS is_promote ". |
| | | " FROM " . $GLOBALS['ecs']->table('goods') . " AS g WHERE is_delete='$is_delete' $where" . |
| | | " ORDER BY $filter[sort_by] $filter[sort_order] ". |
| | | " LIMIT " . $filter['start'] . ",$filter[page_size]"; |
| | | |
| | | $filter['keyword'] = stripslashes($filter['keyword']); |
| | | set_filter($filter, $sql, $param_str); |
| | | } |
| | | else |
| | | { |
| | | $sql = $result['sql']; |
| | | $filter = $result['filter']; |
| | | } |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | return array('goods' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); |
| | | } |
| | | |
| | | /** |
| | | * 检测商品是否有货品 |
| | | * |
| | | * @access public |
| | | * @params integer $goods_id 商品id |
| | | * @params string $conditions sql条件,AND语句开头 |
| | | * @return string number -1,错误;1,存在;0,不存在 |
| | | */ |
| | | function check_goods_product_exist($goods_id, $conditions = '') |
| | | { |
| | | if (empty($goods_id)) |
| | | { |
| | | return -1; //$goods_id不能为空 |
| | | } |
| | | |
| | | $sql = "SELECT goods_id |
| | | FROM " . $GLOBALS['ecs']->table('products') . " |
| | | WHERE goods_id = '$goods_id' |
| | | " . $conditions . " |
| | | LIMIT 0, 1"; |
| | | $result = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (empty($result)) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品的货品总库存 |
| | | * |
| | | * @access public |
| | | * @params integer $goods_id 商品id |
| | | * @params string $conditions sql条件,AND语句开头 |
| | | * @return string number |
| | | */ |
| | | function product_number_count($goods_id, $conditions = '') |
| | | { |
| | | if (empty($goods_id)) |
| | | { |
| | | return -1; //$goods_id不能为空 |
| | | } |
| | | |
| | | $sql = "SELECT SUM(product_number) |
| | | FROM " . $GLOBALS['ecs']->table('products') . " |
| | | WHERE goods_id = '$goods_id' |
| | | " . $conditions; |
| | | $nums = $GLOBALS['db']->getOne($sql); |
| | | $nums = empty($nums) ? 0 : $nums; |
| | | |
| | | return $nums; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品的规格属性值列表 |
| | | * |
| | | * @access public |
| | | * @params integer $goods_id |
| | | * @return array |
| | | */ |
| | | function product_goods_attr_list($goods_id) |
| | | { |
| | | if (empty($goods_id)) |
| | | { |
| | | return array(); //$goods_id不能为空 |
| | | } |
| | | |
| | | $sql = "SELECT goods_attr_id, attr_value FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_id = '$goods_id'"; |
| | | $results = $GLOBALS['db']->getAll($sql); |
| | | |
| | | $return_arr = array(); |
| | | foreach ($results as $value) |
| | | { |
| | | $return_arr[$value['goods_attr_id']] = $value['attr_value']; |
| | | } |
| | | |
| | | return $return_arr; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品已添加的规格列表 |
| | | * |
| | | * @access public |
| | | * @params integer $goods_id |
| | | * @return array |
| | | */ |
| | | function get_goods_specifications_list($goods_id) |
| | | { |
| | | if (empty($goods_id)) |
| | | { |
| | | return array(); //$goods_id不能为空 |
| | | } |
| | | |
| | | $sql = "SELECT g.goods_attr_id, g.attr_value, g.attr_id, a.attr_name |
| | | FROM " . $GLOBALS['ecs']->table('goods_attr') . " AS g |
| | | LEFT JOIN " . $GLOBALS['ecs']->table('attribute') . " AS a |
| | | ON a.attr_id = g.attr_id |
| | | WHERE goods_id = '$goods_id' |
| | | AND a.attr_type = 1 |
| | | ORDER BY g.attr_id ASC"; |
| | | $results = $GLOBALS['db']->getAll($sql); |
| | | |
| | | return $results; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品的货品列表 |
| | | * |
| | | * @access public |
| | | * @params integer $goods_id |
| | | * @params string $conditions |
| | | * @return array |
| | | */ |
| | | function product_list($goods_id, $conditions = '') |
| | | { |
| | | /* 过滤条件 */ |
| | | $param_str = '-' . $goods_id; |
| | | $result = get_filter($param_str); |
| | | if ($result === false) |
| | | { |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | $filter['goods_id'] = $goods_id; |
| | | $filter['keyword'] = empty($_REQUEST['keyword']) ? '' : trim($_REQUEST['keyword']); |
| | | $filter['stock_warning'] = empty($_REQUEST['stock_warning']) ? 0 : intval($_REQUEST['stock_warning']); |
| | | |
| | | if (isset($_REQUEST['is_ajax']) && $_REQUEST['is_ajax'] == 1) |
| | | { |
| | | $filter['keyword'] = json_str_iconv($filter['keyword']); |
| | | } |
| | | $filter['sort_by'] = empty($_REQUEST['sort_by']) ? 'product_id' : trim($_REQUEST['sort_by']); |
| | | $filter['sort_order'] = empty($_REQUEST['sort_order']) ? 'DESC' : trim($_REQUEST['sort_order']); |
| | | $filter['extension_code'] = empty($_REQUEST['extension_code']) ? '' : trim($_REQUEST['extension_code']); |
| | | $filter['page_count'] = isset($filter['page_count']) ? $filter['page_count'] : 1; |
| | | |
| | | $where = ''; |
| | | |
| | | /* 库存警告 */ |
| | | if ($filter['stock_warning']) |
| | | { |
| | | $where .= ' AND goods_number <= warn_number '; |
| | | } |
| | | |
| | | /* 关键字 */ |
| | | if (!empty($filter['keyword'])) |
| | | { |
| | | $where .= " AND (product_sn LIKE '%" . $filter['keyword'] . "%')"; |
| | | } |
| | | |
| | | $where .= $conditions; |
| | | |
| | | /* 记录总数 */ |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('products'). " AS p WHERE goods_id = $goods_id $where"; |
| | | $filter['record_count'] = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $sql = "SELECT product_id, goods_id, goods_attr, product_sn, product_number |
| | | FROM " . $GLOBALS['ecs']->table('products') . " AS g |
| | | WHERE goods_id = $goods_id $where |
| | | ORDER BY $filter[sort_by] $filter[sort_order]"; |
| | | |
| | | $filter['keyword'] = stripslashes($filter['keyword']); |
| | | //set_filter($filter, $sql, $param_str); |
| | | } |
| | | else |
| | | { |
| | | $sql = $result['sql']; |
| | | $filter = $result['filter']; |
| | | } |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | /* 处理规格属性 */ |
| | | $goods_attr = product_goods_attr_list($goods_id); |
| | | foreach ($row as $key => $value) |
| | | { |
| | | $_goods_attr_array = explode('|', $value['goods_attr']); |
| | | if (is_array($_goods_attr_array)) |
| | | { |
| | | $_temp = ''; |
| | | foreach ($_goods_attr_array as $_goods_attr_value) |
| | | { |
| | | $_temp[] = $goods_attr[$_goods_attr_value]; |
| | | } |
| | | $row[$key]['goods_attr'] = $_temp; |
| | | } |
| | | } |
| | | |
| | | return array('product' => $row, 'filter' => $filter, 'page_count' => $filter['page_count'], 'record_count' => $filter['record_count']); |
| | | } |
| | | |
| | | /** |
| | | * 取货品信息 |
| | | * |
| | | * @access public |
| | | * @param int $product_id 货品id |
| | | * @param int $filed 字段 |
| | | * @return array |
| | | */ |
| | | function get_product_info($product_id, $filed = '') |
| | | { |
| | | $return_array = array(); |
| | | |
| | | if (empty($product_id)) |
| | | { |
| | | return $return_array; |
| | | } |
| | | |
| | | $filed = trim($filed); |
| | | if (empty($filed)) |
| | | { |
| | | $filed = '*'; |
| | | } |
| | | |
| | | $sql = "SELECT $filed FROM " . $GLOBALS['ecs']->table('products') . " WHERE product_id = '$product_id'"; |
| | | $return_array = $GLOBALS['db']->getRow($sql); |
| | | |
| | | return $return_array; |
| | | } |
| | | |
| | | /** |
| | | * 检查单个商品是否存在规格 |
| | | * |
| | | * @param int $goods_id 商品id |
| | | * @return bool true,存在;false,不存在 |
| | | */ |
| | | function check_goods_specifications_exist($goods_id) |
| | | { |
| | | $goods_id = intval($goods_id); |
| | | |
| | | $sql = "SELECT COUNT(a.attr_id) |
| | | FROM " .$GLOBALS['ecs']->table('attribute'). " AS a, " .$GLOBALS['ecs']->table('goods'). " AS g |
| | | WHERE a.cat_id = g.goods_type |
| | | AND g.goods_id = '$goods_id'"; |
| | | |
| | | $count = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if ($count > 0) |
| | | { |
| | | return true; //存在 |
| | | } |
| | | else |
| | | { |
| | | return false; //不存在 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 商品的货品规格是否存在 |
| | | * |
| | | * @param string $goods_attr 商品的货品规格 |
| | | * @param string $goods_id 商品id |
| | | * @param int $product_id 商品的货品id;默认值为:0,没有货品id |
| | | * @return bool true,重复;false,不重复 |
| | | */ |
| | | function check_goods_attr_exist($goods_attr, $goods_id, $product_id = 0) |
| | | { |
| | | $goods_id = intval($goods_id); |
| | | if (strlen($goods_attr) == 0 || empty($goods_id)) |
| | | { |
| | | return true; //重复 |
| | | } |
| | | |
| | | if (empty($product_id)) |
| | | { |
| | | $sql = "SELECT product_id FROM " . $GLOBALS['ecs']->table('products') ." |
| | | WHERE goods_attr = '$goods_attr' |
| | | AND goods_id = '$goods_id'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT product_id FROM " . $GLOBALS['ecs']->table('products') ." |
| | | WHERE goods_attr = '$goods_attr' |
| | | AND goods_id = '$goods_id' |
| | | AND product_id <> '$product_id'"; |
| | | } |
| | | |
| | | $res = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if (empty($res)) |
| | | { |
| | | return false; //不重复 |
| | | } |
| | | else |
| | | { |
| | | return true; //重复 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 商品的货品货号是否重复 |
| | | * |
| | | * @param string $product_sn 商品的货品货号;请在传入本参数前对本参数进行SQl脚本过滤 |
| | | * @param int $product_id 商品的货品id;默认值为:0,没有货品id |
| | | * @return bool true,重复;false,不重复 |
| | | */ |
| | | function check_product_sn_exist($product_sn, $product_id = 0) |
| | | { |
| | | $product_sn = trim($product_sn); |
| | | $product_id = intval($product_id); |
| | | if (strlen($product_sn) == 0) |
| | | { |
| | | return true; //重复 |
| | | } |
| | | $sql="SELECT goods_id FROM ". $GLOBALS['ecs']->table('goods')."WHERE goods_sn='$product_sn'"; |
| | | if($GLOBALS['db']->getOne($sql)) |
| | | { |
| | | return true; //重复 |
| | | } |
| | | |
| | | |
| | | if (empty($product_id)) |
| | | { |
| | | $sql = "SELECT product_id FROM " . $GLOBALS['ecs']->table('products') ." |
| | | WHERE product_sn = '$product_sn'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT product_id FROM " . $GLOBALS['ecs']->table('products') ." |
| | | WHERE product_sn = '$product_sn' |
| | | AND product_id <> '$product_id'"; |
| | | } |
| | | |
| | | $res = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if (empty($res)) |
| | | { |
| | | return false; //不重复 |
| | | } |
| | | else |
| | | { |
| | | return true; //重复 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 格式化商品图片名称(按目录存储) |
| | | * |
| | | */ |
| | | function reformat_image_name($type, $goods_id, $source_img, $position='') |
| | | { |
| | | $rand_name = gmtime() . sprintf("%03d", mt_rand(1,999)); |
| | | $img_ext = substr($source_img, strrpos($source_img, '.')); |
| | | $dir = 'images'; |
| | | if (defined('IMAGE_DIR')) |
| | | { |
| | | $dir = IMAGE_DIR; |
| | | } |
| | | $sub_dir = date('Ym', gmtime()); |
| | | if (!make_dir(ROOT_PATH.$dir.'/'.$sub_dir)) |
| | | { |
| | | return false; |
| | | } |
| | | if (!make_dir(ROOT_PATH.$dir.'/'.$sub_dir.'/source_img')) |
| | | { |
| | | return false; |
| | | } |
| | | if (!make_dir(ROOT_PATH.$dir.'/'.$sub_dir.'/goods_img')) |
| | | { |
| | | return false; |
| | | } |
| | | if (!make_dir(ROOT_PATH.$dir.'/'.$sub_dir.'/thumb_img')) |
| | | { |
| | | return false; |
| | | } |
| | | switch($type) |
| | | { |
| | | case 'goods': |
| | | $img_name = $goods_id . '_G_' . $rand_name; |
| | | break; |
| | | case 'goods_thumb': |
| | | $img_name = $goods_id . '_thumb_G_' . $rand_name; |
| | | break; |
| | | case 'gallery': |
| | | $img_name = $goods_id . '_P_' . $rand_name; |
| | | break; |
| | | case 'gallery_thumb': |
| | | $img_name = $goods_id . '_thumb_P_' . $rand_name; |
| | | break; |
| | | } |
| | | if ($position == 'source') |
| | | { |
| | | if (move_image_file(ROOT_PATH.$source_img, ROOT_PATH.$dir.'/'.$sub_dir.'/source_img/'.$img_name.$img_ext)) |
| | | { |
| | | return $dir.'/'.$sub_dir.'/source_img/'.$img_name.$img_ext; |
| | | } |
| | | } |
| | | elseif ($position == 'thumb') |
| | | { |
| | | if (move_image_file(ROOT_PATH.$source_img, ROOT_PATH.$dir.'/'.$sub_dir.'/thumb_img/'.$img_name.$img_ext)) |
| | | { |
| | | return $dir.'/'.$sub_dir.'/thumb_img/'.$img_name.$img_ext; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (move_image_file(ROOT_PATH.$source_img, ROOT_PATH.$dir.'/'.$sub_dir.'/goods_img/'.$img_name.$img_ext)) |
| | | { |
| | | return $dir.'/'.$sub_dir.'/goods_img/'.$img_name.$img_ext; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | function move_image_file($source, $dest) |
| | | { |
| | | if (@copy($source, $dest)) |
| | | { |
| | | @unlink($source); |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 管理中心公用函数库 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: lib_main.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | /** |
| | | * 获得所有模块的名称以及链接地址 |
| | | * |
| | | * @access public |
| | | * @param string $directory 插件存放的目录 |
| | | * @return array |
| | | */ |
| | | function read_modules($directory = '.') |
| | | { |
| | | global $_LANG; |
| | | |
| | | $dir = @opendir($directory); |
| | | $set_modules = true; |
| | | $modules = array(); |
| | | |
| | | while (false !== ($file = @readdir($dir))) |
| | | { |
| | | if (preg_match("/^.*?\.php$/", $file)) |
| | | { |
| | | include_once($directory. '/' .$file); |
| | | } |
| | | } |
| | | @closedir($dir); |
| | | unset($set_modules); |
| | | |
| | | foreach ($modules AS $key => $value) |
| | | { |
| | | ksort($modules[$key]); |
| | | } |
| | | ksort($modules); |
| | | |
| | | return $modules; |
| | | } |
| | | |
| | | /** |
| | | * 系统提示信息 |
| | | * |
| | | * @access public |
| | | * @param string msg_detail 消息内容 |
| | | * @param int msg_type 消息类型, 0消息,1错误,2询问 |
| | | * @param array links 可选的链接 |
| | | * @param boolen $auto_redirect 是否需要自动跳转 |
| | | * @return void |
| | | */ |
| | | function sys_msg($msg_detail, $msg_type = 0, $links = array(), $auto_redirect = true) |
| | | { |
| | | if (count($links) == 0) |
| | | { |
| | | $links[0]['text'] = $GLOBALS['_LANG']['go_back']; |
| | | $links[0]['href'] = 'javascript:history.go(-1)'; |
| | | } |
| | | |
| | | assign_query_info(); |
| | | |
| | | $GLOBALS['smarty']->assign('ur_here', $GLOBALS['_LANG']['system_message']); |
| | | $GLOBALS['smarty']->assign('msg_detail', $msg_detail); |
| | | $GLOBALS['smarty']->assign('msg_type', $msg_type); |
| | | $GLOBALS['smarty']->assign('links', $links); |
| | | $GLOBALS['smarty']->assign('default_url', $links[0]['href']); |
| | | $GLOBALS['smarty']->assign('auto_redirect', $auto_redirect); |
| | | |
| | | $GLOBALS['smarty']->display('message.htm'); |
| | | |
| | | exit; |
| | | } |
| | | |
| | | /** |
| | | * 记录管理员的操作内容 |
| | | * |
| | | * @access public |
| | | * @param string $sn 数据的唯一值 |
| | | * @param string $action 操作的类型 |
| | | * @param string $content 操作的内容 |
| | | * @return void |
| | | */ |
| | | function admin_log($sn = '', $action, $content) |
| | | { |
| | | $log_info = $GLOBALS['_LANG']['log_action'][$action] . $GLOBALS['_LANG']['log_action'][$content] .': '. addslashes($sn); |
| | | |
| | | $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('admin_log') . ' (log_time, user_id, log_info, ip_address) ' . |
| | | " VALUES ('" . gmtime() . "', $_SESSION[admin_id], '" . stripslashes($log_info) . "', '" . real_ip() . "')"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 将通过表单提交过来的年月日变量合成为"2004-05-10"的格式。 |
| | | * |
| | | * 此函数适用于通过smarty函数html_select_date生成的下拉日期。 |
| | | * |
| | | * @param string $prefix 年月日变量的共同的前缀。 |
| | | * @return date 日期变量。 |
| | | */ |
| | | function sys_joindate($prefix) |
| | | { |
| | | /* 返回年-月-日的日期格式 */ |
| | | $year = empty($_POST[$prefix . 'Year']) ? '0' : $_POST[$prefix . 'Year']; |
| | | $month = empty($_POST[$prefix . 'Month']) ? '0' : $_POST[$prefix . 'Month']; |
| | | $day = empty($_POST[$prefix . 'Day']) ? '0' : $_POST[$prefix . 'Day']; |
| | | |
| | | return $year . '-' . $month . '-' . $day; |
| | | } |
| | | |
| | | /** |
| | | * 设置管理员的session内容 |
| | | * |
| | | * @access public |
| | | * @param integer $user_id 管理员编号 |
| | | * @param string $username 管理员姓名 |
| | | * @param string $action_list 权限列表 |
| | | * @param string $last_time 最后登录时间 |
| | | * @return void |
| | | */ |
| | | function set_admin_session($user_id, $username, $action_list, $last_time) |
| | | { |
| | | $_SESSION['admin_id'] = $user_id; |
| | | $_SESSION['admin_name'] = $username; |
| | | $_SESSION['action_list'] = $action_list; |
| | | $_SESSION['last_check'] = $last_time; // 用于保存最后一次检查订单的时间 |
| | | } |
| | | |
| | | /** |
| | | * 插入一个配置信息 |
| | | * |
| | | * @access public |
| | | * @param string $parent 分组的code |
| | | * @param string $code 该配置信息的唯一标识 |
| | | * @param string $value 该配置信息值 |
| | | * @return void |
| | | */ |
| | | function insert_config($parent, $code, $value) |
| | | { |
| | | global $ecs, $db, $_LANG; |
| | | |
| | | $sql = 'SELECT id FROM ' . $ecs->table('shop_config') . " WHERE code = '$parent' AND type = 1"; |
| | | $parent_id = $db->getOne($sql); |
| | | |
| | | $sql = 'INSERT INTO ' . $ecs->table('shop_config') . ' (parent_id, code, value) ' . |
| | | "VALUES('$parent_id', '$code', '$value')"; |
| | | $db->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 判断管理员对某一个操作是否有权限。 |
| | | * |
| | | * 根据当前对应的action_code,然后再和用户session里面的action_list做匹配,以此来决定是否可以继续执行。 |
| | | * @param string $priv_str 操作对应的priv_str |
| | | * @param string $msg_type 返回的类型 |
| | | * @return true/false |
| | | */ |
| | | function admin_priv($priv_str, $msg_type = '' , $msg_output = true) |
| | | { |
| | | global $_LANG; |
| | | |
| | | if ($_SESSION['action_list'] == 'all') |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (strpos(',' . $_SESSION['action_list'] . ',', ',' . $priv_str . ',') === false) |
| | | { |
| | | $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)'); |
| | | if ( $msg_output) |
| | | { |
| | | sys_msg($_LANG['priv_error'], 0, $link); |
| | | } |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查管理员权限 |
| | | * |
| | | * @access public |
| | | * @param string $authz |
| | | * @return boolean |
| | | */ |
| | | function check_authz($authz) |
| | | { |
| | | return (preg_match('/,*'.$authz.',*/', $_SESSION['action_list']) || $_SESSION['action_list'] == 'all'); |
| | | } |
| | | |
| | | /** |
| | | * 检查管理员权限,返回JSON格式数剧 |
| | | * |
| | | * @access public |
| | | * @param string $authz |
| | | * @return void |
| | | */ |
| | | function check_authz_json($authz) |
| | | { |
| | | if (!check_authz($authz)) |
| | | { |
| | | make_json_error($GLOBALS['_LANG']['priv_error']); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得红包类型数组(用于生成下拉列表) |
| | | * |
| | | * @return array 分类数组 bonus_typeid => bonus_type_name |
| | | */ |
| | | function get_bonus_type() |
| | | { |
| | | $bonus = array(); |
| | | $sql = 'SELECT type_id, type_name, type_money FROM ' . $GLOBALS['ecs']->table('bonus_type') . |
| | | ' WHERE send_type = 3'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $bonus[$row['type_id']] = $row['type_name'].' [' .sprintf($GLOBALS['_CFG']['currency_format'], $row['type_money']).']'; |
| | | } |
| | | |
| | | return $bonus; |
| | | } |
| | | |
| | | /** |
| | | * 取得用户等级数组,按用户级别排序 |
| | | * @param bool $is_special 是否只显示特殊会员组 |
| | | * @return array rank_id=>rank_name |
| | | */ |
| | | function get_rank_list($is_special = false) |
| | | { |
| | | $rank_list = array(); |
| | | $sql = 'SELECT rank_id, rank_name, min_points FROM ' . $GLOBALS['ecs']->table('user_rank'); |
| | | if ($is_special) |
| | | { |
| | | $sql .= ' WHERE special_rank = 1'; |
| | | } |
| | | $sql .= ' ORDER BY min_points'; |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $rank_list[$row['rank_id']] = $row['rank_name']; |
| | | } |
| | | |
| | | return $rank_list; |
| | | } |
| | | |
| | | /** |
| | | * 按等级取得用户列表(用于生成下拉列表) |
| | | * |
| | | * @return array 分类数组 user_id => user_name |
| | | */ |
| | | function get_user_rank($rankid, $where) |
| | | { |
| | | $user_list = array(); |
| | | $sql = 'SELECT user_id, user_name FROM ' . $GLOBALS['ecs']->table('users') . $where. |
| | | ' ORDER BY user_id DESC'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $user_list[$row['user_id']] = $row['user_name']; |
| | | } |
| | | |
| | | return $user_list; |
| | | } |
| | | |
| | | /** |
| | | * 取得广告位置数组(用于生成下拉列表) |
| | | * |
| | | * @return array 分类数组 position_id => position_name |
| | | */ |
| | | function get_position_list() |
| | | { |
| | | $position_list = array(); |
| | | $sql = 'SELECT position_id, position_name, ad_width, ad_height '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('ad_position'); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $position_list[$row['position_id']] = addslashes($row['position_name']). ' [' .$row['ad_width']. 'x' .$row['ad_height']. ']'; |
| | | } |
| | | |
| | | return $position_list; |
| | | } |
| | | |
| | | /** |
| | | * 生成编辑器 |
| | | * @param string input_name 输入框名称 |
| | | * @param string input_value 输入框值 |
| | | */ |
| | | function create_html_editor($input_name, $input_value = '') |
| | | { |
| | | global $smarty; |
| | | |
| | | $editor = new FCKeditor($input_name); |
| | | $editor->BasePath = '../includes/fckeditor/'; |
| | | $editor->ToolbarSet = 'Normal'; |
| | | $editor->Width = '100%'; |
| | | $editor->Height = '320'; |
| | | $editor->Value = $input_value; |
| | | $FCKeditor = $editor->CreateHtml(); |
| | | $smarty->assign('FCKeditor', $FCKeditor); |
| | | } |
| | | |
| | | /** |
| | | * 取得商品列表:用于把商品添加到组合、关联类、赠品类 |
| | | * @param object $filters 过滤条件 |
| | | */ |
| | | function get_goods_list($filter) |
| | | { |
| | | $filter->keyword = json_str_iconv($filter->keyword); |
| | | $where = get_where_sql($filter); // 取得过滤条件 |
| | | |
| | | /* 取得数据 */ |
| | | $sql = 'SELECT goods_id, goods_name, shop_price '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . $where . |
| | | 'LIMIT 50'; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 取得文章列表:用于商品关联文章 |
| | | * @param object $filters 过滤条件 |
| | | */ |
| | | function get_article_list($filter) |
| | | { |
| | | /* 创建数据容器对象 */ |
| | | $ol = new OptionList(); |
| | | |
| | | /* 取得过滤条件 */ |
| | | $where = ' WHERE a.cat_id = c.cat_id AND c.cat_type = 1 '; |
| | | $where .= isset($filter->title) ? " AND a.title LIKE '%" . mysql_like_quote($filter->title) . "%'" : ''; |
| | | |
| | | /* 取得数据 */ |
| | | $sql = 'SELECT a.article_id, a.title '. |
| | | 'FROM ' .$GLOBALS['ecs']->table('article'). ' AS a, ' .$GLOBALS['ecs']->table('article_cat'). ' AS c ' . $where; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $ol->add_option($row['article_id'], $row['title']); |
| | | } |
| | | |
| | | /* 生成列表 */ |
| | | $ol->build_select(); |
| | | } |
| | | |
| | | /** |
| | | * 返回是否 |
| | | * @param int $var 变量 1, 0 |
| | | */ |
| | | function get_yes_no($var) |
| | | { |
| | | return empty($var) ? '<img src="images/no.gif" border="0" />' : '<img src="images/yes.gif" border="0" />'; |
| | | } |
| | | |
| | | /** |
| | | * 生成过滤条件:用于 get_goodslist 和 get_goods_list |
| | | * @param object $filter |
| | | * @return string |
| | | */ |
| | | function get_where_sql($filter) |
| | | { |
| | | $time = date('Y-m-d'); |
| | | |
| | | $where = isset($filter->is_delete) && $filter->is_delete == '1' ? |
| | | ' WHERE is_delete = 1 ' : ' WHERE is_delete = 0 '; |
| | | $where .= (isset($filter->real_goods) && ($filter->real_goods > -1)) ? ' AND is_real = ' . intval($filter->real_goods) : ''; |
| | | $where .= isset($filter->cat_id) && $filter->cat_id > 0 ? ' AND ' . get_children($filter->cat_id) : ''; |
| | | $where .= isset($filter->brand_id) && $filter->brand_id > 0 ? " AND brand_id = '" . $filter->brand_id . "'" : ''; |
| | | $where .= isset($filter->intro_type) && $filter->intro_type != '0' ? ' AND ' . $filter->intro_type . " = '1'" : ''; |
| | | $where .= isset($filter->intro_type) && $filter->intro_type == 'is_promote' ? |
| | | " AND promote_start_date <= '$time' AND promote_end_date >= '$time' " : ''; |
| | | $where .= isset($filter->keyword) && trim($filter->keyword) != '' ? |
| | | " AND (goods_name LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR goods_sn LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR goods_id LIKE '%" . mysql_like_quote($filter->keyword) . "%') " : ''; |
| | | $where .= isset($filter->suppliers_id) && trim($filter->suppliers_id) != '' ? |
| | | " AND (suppliers_id = '" . $filter->suppliers_id . "') " : ''; |
| | | |
| | | $where .= isset($filter->in_ids) ? ' AND goods_id ' . db_create_in($filter->in_ids) : ''; |
| | | $where .= isset($filter->exclude) ? ' AND goods_id NOT ' . db_create_in($filter->exclude) : ''; |
| | | $where .= isset($filter->stock_warning) ? ' AND goods_number <= warn_number' : ''; |
| | | |
| | | return $where; |
| | | } |
| | | |
| | | /** |
| | | * 获取地区列表的函数。 |
| | | * |
| | | * @access public |
| | | * @param int $region_id 上级地区id |
| | | * @return void |
| | | */ |
| | | function area_list($region_id) |
| | | { |
| | | $area_arr = array(); |
| | | |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('region'). |
| | | " WHERE parent_id = '$region_id' ORDER BY region_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $row['type'] = ($row['region_type'] == 0) ? $GLOBALS['_LANG']['country'] : ''; |
| | | $row['type'] .= ($row['region_type'] == 1) ? $GLOBALS['_LANG']['province'] : ''; |
| | | $row['type'] .= ($row['region_type'] == 2) ? $GLOBALS['_LANG']['city'] : ''; |
| | | $row['type'] .= ($row['region_type'] == 3) ? $GLOBALS['_LANG']['cantonal'] : ''; |
| | | |
| | | $area_arr[] = $row; |
| | | } |
| | | |
| | | return $area_arr; |
| | | } |
| | | |
| | | /** |
| | | * 取得图表颜色 |
| | | * |
| | | * @access public |
| | | * @param integer $n 颜色顺序 |
| | | * @return void |
| | | */ |
| | | function chart_color($n) |
| | | { |
| | | /* 随机显示颜色代码 */ |
| | | $arr = array('33FF66', 'FF6600', '3399FF', '009966', 'CC3399', 'FFCC33', '6699CC', 'CC3366', '33FF66', 'FF6600', '3399FF'); |
| | | |
| | | if ($n > 8) |
| | | { |
| | | $n = $n % 8; |
| | | } |
| | | |
| | | return $arr[$n]; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品类型的列表 |
| | | * |
| | | * @access public |
| | | * @param integer $selected 选定的类型编号 |
| | | * @return string |
| | | */ |
| | | function goods_type_list($selected) |
| | | { |
| | | $sql = 'SELECT cat_id, cat_name FROM ' . $GLOBALS['ecs']->table('goods_type') . ' WHERE enabled = 1'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $lst = ''; |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $lst .= "<option value='$row[cat_id]'"; |
| | | $lst .= ($selected == $row['cat_id']) ? ' selected="true"' : ''; |
| | | $lst .= '>' . htmlspecialchars($row['cat_name']). '</option>'; |
| | | } |
| | | |
| | | return $lst; |
| | | } |
| | | |
| | | /** |
| | | * 取得货到付款和非货到付款的支付方式 |
| | | * @return array('is_cod' => '', 'is_not_cod' => '') |
| | | */ |
| | | function get_pay_ids() |
| | | { |
| | | $ids = array('is_cod' => '0', 'is_not_cod' => '0'); |
| | | $sql = 'SELECT pay_id, is_cod FROM ' .$GLOBALS['ecs']->table('payment'). ' WHERE enabled = 1'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['is_cod']) |
| | | { |
| | | $ids['is_cod'] .= ',' . $row['pay_id']; |
| | | } |
| | | else |
| | | { |
| | | $ids['is_not_cod'] .= ',' . $row['pay_id']; |
| | | } |
| | | } |
| | | |
| | | return $ids; |
| | | } |
| | | |
| | | /** |
| | | * 清空表数据 |
| | | * @param string $table_name 表名称 |
| | | */ |
| | | function truncate_table($table_name) |
| | | { |
| | | $sql = 'TRUNCATE TABLE ' .$GLOBALS['ecs']->table($table_name); |
| | | |
| | | return $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 返回字符集列表数组 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return void |
| | | */ |
| | | function get_charset_list() |
| | | { |
| | | return array( |
| | | 'UTF8' => 'UTF-8', |
| | | 'GB2312' => 'GB2312/GBK', |
| | | 'BIG5' => 'BIG5', |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建一个JSON格式的数据 |
| | | * |
| | | * @access public |
| | | * @param string $content |
| | | * @param integer $error |
| | | * @param string $message |
| | | * @param array $append |
| | | * @return void |
| | | */ |
| | | function make_json_response($content='', $error="0", $message='', $append=array()) |
| | | { |
| | | include_once(ROOT_PATH . 'includes/cls_json.php'); |
| | | |
| | | $json = new JSON; |
| | | |
| | | $res = array('error' => $error, 'message' => $message, 'content' => $content); |
| | | |
| | | if (!empty($append)) |
| | | { |
| | | foreach ($append AS $key => $val) |
| | | { |
| | | $res[$key] = $val; |
| | | } |
| | | } |
| | | |
| | | $val = $json->encode($res); |
| | | |
| | | exit($val); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * |
| | | * @access public |
| | | * @param |
| | | * @return void |
| | | */ |
| | | function make_json_result($content, $message='', $append=array()) |
| | | { |
| | | make_json_response($content, 0, $message, $append); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个JSON格式的错误信息 |
| | | * |
| | | * @access public |
| | | * @param string $msg |
| | | * @return void |
| | | */ |
| | | function make_json_error($msg) |
| | | { |
| | | make_json_response('', 1, $msg); |
| | | } |
| | | |
| | | /** |
| | | * 根据过滤条件获得排序的标记 |
| | | * |
| | | * @access public |
| | | * @param array $filter |
| | | * @return array |
| | | */ |
| | | function sort_flag($filter) |
| | | { |
| | | $flag['tag'] = 'sort_' . preg_replace('/^.*\./', '', $filter['sort_by']); |
| | | $flag['img'] = '<img src="images/' . ($filter['sort_order'] == "DESC" ? 'sort_desc.gif' : 'sort_asc.gif') . '"/>'; |
| | | |
| | | return $flag; |
| | | } |
| | | |
| | | /** |
| | | * 分页的信息加入条件的数组 |
| | | * |
| | | * @access public |
| | | * @return array |
| | | */ |
| | | function page_and_size($filter) |
| | | { |
| | | if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) |
| | | { |
| | | $filter['page_size'] = intval($_REQUEST['page_size']); |
| | | } |
| | | elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) |
| | | { |
| | | $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']); |
| | | } |
| | | else |
| | | { |
| | | $filter['page_size'] = 15; |
| | | } |
| | | |
| | | /* 每页显示 */ |
| | | $filter['page'] = (empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0) ? 1 : intval($_REQUEST['page']); |
| | | |
| | | /* page 总数 */ |
| | | $filter['page_count'] = (!empty($filter['record_count']) && $filter['record_count'] > 0) ? ceil($filter['record_count'] / $filter['page_size']) : 1; |
| | | |
| | | /* 边界处理 */ |
| | | if ($filter['page'] > $filter['page_count']) |
| | | { |
| | | $filter['page'] = $filter['page_count']; |
| | | } |
| | | |
| | | $filter['start'] = ($filter['page'] - 1) * $filter['page_size']; |
| | | |
| | | return $filter; |
| | | } |
| | | |
| | | /** |
| | | * 将含有单位的数字转成字节 |
| | | * |
| | | * @access public |
| | | * @param string $val 带单位的数字 |
| | | * |
| | | * @return int $val |
| | | */ |
| | | function return_bytes($val) |
| | | { |
| | | $val = trim($val); |
| | | $last = strtolower($val{strlen($val)-1}); |
| | | switch($last) |
| | | { |
| | | case 'g': |
| | | $val *= 1024; |
| | | case 'm': |
| | | $val *= 1024; |
| | | case 'k': |
| | | $val *= 1024; |
| | | } |
| | | |
| | | return $val; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定的商品类型下所有的属性分组 |
| | | * |
| | | * @param integer $cat_id 商品类型ID |
| | | * |
| | | * @return array |
| | | */ |
| | | function get_attr_groups($cat_id) |
| | | { |
| | | $sql = "SELECT attr_group FROM " . $GLOBALS['ecs']->table('goods_type') . " WHERE cat_id='$cat_id'"; |
| | | $grp = str_replace("\r", '', $GLOBALS['db']->getOne($sql)); |
| | | |
| | | if ($grp) |
| | | { |
| | | return explode("\n", $grp); |
| | | } |
| | | else |
| | | { |
| | | return array(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成链接后缀 |
| | | */ |
| | | function list_link_postfix() |
| | | { |
| | | return 'uselastfilter=1'; |
| | | } |
| | | |
| | | /** |
| | | * 保存过滤条件 |
| | | * @param array $filter 过滤条件 |
| | | * @param string $sql 查询语句 |
| | | * @param string $param_str 参数字符串,由list函数的参数组成 |
| | | */ |
| | | function set_filter($filter, $sql, $param_str = '') |
| | | { |
| | | $filterfile = basename(PHP_SELF, '.php'); |
| | | if ($param_str) |
| | | { |
| | | $filterfile .= $param_str; |
| | | } |
| | | setcookie('ECSCP[lastfilterfile]', sprintf('%X', crc32($filterfile)), time() + 600); |
| | | setcookie('ECSCP[lastfilter]', urlencode(serialize($filter)), time() + 600); |
| | | setcookie('ECSCP[lastfiltersql]', base64_encode($sql), time() + 600); |
| | | } |
| | | |
| | | /** |
| | | * 取得上次的过滤条件 |
| | | * @param string $param_str 参数字符串,由list函数的参数组成 |
| | | * @return 如果有,返回array('filter' => $filter, 'sql' => $sql);否则返回false |
| | | */ |
| | | function get_filter($param_str = '') |
| | | { |
| | | $filterfile = basename(PHP_SELF, '.php'); |
| | | if ($param_str) |
| | | { |
| | | $filterfile .= $param_str; |
| | | } |
| | | if (isset($_GET['uselastfilter']) && isset($_COOKIE['ECSCP']['lastfilterfile']) |
| | | && $_COOKIE['ECSCP']['lastfilterfile'] == sprintf('%X', crc32($filterfile))) |
| | | { |
| | | return array( |
| | | 'filter' => unserialize(urldecode($_COOKIE['ECSCP']['lastfilter'])), |
| | | 'sql' => base64_decode($_COOKIE['ECSCP']['lastfiltersql']) |
| | | ); |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * URL过滤 |
| | | * @param string $url 参数字符串,一个urld地址,对url地址进行校正 |
| | | * @return 返回校正过的url; |
| | | */ |
| | | function sanitize_url($url , $check = 'http://') |
| | | { |
| | | if (strpos( $url, $check ) === false) |
| | | { |
| | | $url = $check . $url; |
| | | } |
| | | return $url; |
| | | } |
| | | |
| | | /** |
| | | * 检查分类是否已经存在 |
| | | * |
| | | * @param string $cat_name 分类名称 |
| | | * @param integer $parent_cat 上级分类 |
| | | * @param integer $exclude 排除的分类ID |
| | | * |
| | | * @return boolean |
| | | */ |
| | | function cat_exists($cat_name, $parent_cat, $exclude = 0) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('category'). |
| | | " WHERE parent_id = '$parent_cat' AND cat_name = '$cat_name' AND cat_id<>'$exclude'"; |
| | | return ($GLOBALS['db']->getOne($sql) > 0) ? true : false; |
| | | } |
| | | |
| | | function brand_exists($brand_name) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('brand'). |
| | | " WHERE brand_name = '" . $brand_name . "'"; |
| | | return ($GLOBALS['db']->getOne($sql) > 0) ? true : false; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前管理员信息 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return Array |
| | | */ |
| | | function admin_info() |
| | | { |
| | | $sql = "SELECT * FROM ". $GLOBALS['ecs']->table('admin_user')." |
| | | WHERE user_id = '$_SESSION[admin_id]' |
| | | LIMIT 0, 1"; |
| | | $admin_info = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (empty($admin_info)) |
| | | { |
| | | return $admin_info = array(); |
| | | } |
| | | |
| | | return $admin_info; |
| | | } |
| | | |
| | | /** |
| | | * 供货商列表信息 |
| | | * |
| | | * @param string $conditions |
| | | * @return array |
| | | */ |
| | | function suppliers_list_info($conditions = '') |
| | | { |
| | | $where = ''; |
| | | if (!empty($conditions)) |
| | | { |
| | | $where .= 'WHERE '; |
| | | $where .= $conditions; |
| | | } |
| | | |
| | | /* 查询 */ |
| | | $sql = "SELECT suppliers_id, suppliers_name, suppliers_desc |
| | | FROM " . $GLOBALS['ecs']->table("suppliers") . " |
| | | $where"; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 供货商名 |
| | | * |
| | | * @return array |
| | | */ |
| | | function suppliers_list_name() |
| | | { |
| | | /* 查询 */ |
| | | $suppliers_list = suppliers_list_info(' is_check = 1 '); |
| | | |
| | | /* 供货商名字 */ |
| | | $suppliers_name = array(); |
| | | if (count($suppliers_list) > 0) |
| | | { |
| | | foreach ($suppliers_list as $suppliers) |
| | | { |
| | | $suppliers_name[$suppliers['suppliers_id']] = $suppliers['suppliers_name']; |
| | | } |
| | | } |
| | | |
| | | return $suppliers_name; |
| | | } |
| | | |
| | | /** |
| | | * 更新用户SESSION,COOKIE及登录时间、登录次数。 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function update_user_info() |
| | | { |
| | | if (!$_SESSION['user_id']) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | /* 查询会员信息 */ |
| | | $time = date('Y-m-d'); |
| | | $sql = 'SELECT u.user_money,u.email, u.pay_points, u.user_rank, u.rank_points, '. |
| | | ' IFNULL(b.type_money, 0) AS user_bonus, u.last_login, u.last_ip'. |
| | | ' FROM ' .$GLOBALS['ecs']->table('users'). ' AS u ' . |
| | | ' LEFT JOIN ' .$GLOBALS['ecs']->table('user_bonus'). ' AS ub'. |
| | | ' ON ub.user_id = u.user_id AND ub.used_time = 0 ' . |
| | | ' LEFT JOIN ' .$GLOBALS['ecs']->table('bonus_type'). ' AS b'. |
| | | " ON b.type_id = ub.bonus_type_id AND b.use_start_date <= '$time' AND b.use_end_date >= '$time' ". |
| | | " WHERE u.user_id = '$_SESSION[user_id]'"; |
| | | if ($row = $GLOBALS['db']->getRow($sql)) |
| | | { |
| | | /* 更新SESSION */ |
| | | $_SESSION['last_time'] = $row['last_login']; |
| | | $_SESSION['last_ip'] = $row['last_ip']; |
| | | $_SESSION['login_fail'] = 0; |
| | | $_SESSION['email'] = $row['email']; |
| | | |
| | | /*判断是否是特殊等级,可能后台把特殊会员组更改普通会员组*/ |
| | | if($row['user_rank'] >0) |
| | | { |
| | | $sql="SELECT special_rank from ".$GLOBALS['ecs']->table('user_rank')."where rank_id='$row[user_rank]'"; |
| | | if($GLOBALS['db']->getOne($sql)==='0' || $GLOBALS['db']->getOne($sql)===null) |
| | | { |
| | | $sql="update ".$GLOBALS['ecs']->table('users')."set user_rank='0' where user_id='$_SESSION[user_id]'"; |
| | | $GLOBALS['db']->query($sql); |
| | | $row['user_rank']=0; |
| | | } |
| | | } |
| | | |
| | | /* 取得用户等级和折扣 */ |
| | | if ($row['user_rank'] == 0) |
| | | { |
| | | // 非特殊等级,根据等级积分计算用户等级(注意:不包括特殊等级) |
| | | $sql = 'SELECT rank_id, discount FROM ' . $GLOBALS['ecs']->table('user_rank') . " WHERE special_rank = '0' AND min_points <= " . intval($row['rank_points']) . ' AND max_points > ' . intval($row['rank_points']); |
| | | if ($row = $GLOBALS['db']->getRow($sql)) |
| | | { |
| | | $_SESSION['user_rank'] = $row['rank_id']; |
| | | $_SESSION['discount'] = $row['discount'] / 100.00; |
| | | } |
| | | else |
| | | { |
| | | $_SESSION['user_rank'] = 0; |
| | | $_SESSION['discount'] = 1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | // 特殊等级 |
| | | $sql = 'SELECT rank_id, discount FROM ' . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '$row[user_rank]'"; |
| | | if ($row = $GLOBALS['db']->getRow($sql)) |
| | | { |
| | | $_SESSION['user_rank'] = $row['rank_id']; |
| | | $_SESSION['discount'] = $row['discount'] / 100.00; |
| | | } |
| | | else |
| | | { |
| | | $_SESSION['user_rank'] = 0; |
| | | $_SESSION['discount'] = 1; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* 更新登录时间,登录次数及登录ip */ |
| | | $sql = "UPDATE " .$GLOBALS['ecs']->table('users'). " SET". |
| | | " visit_count = visit_count + 1, ". |
| | | " last_ip = '" .real_ip(). "',". |
| | | " last_login = '" .gmtime(). "'". |
| | | " WHERE user_id = '" . $_SESSION['user_id'] . "'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息数组 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return array $user 用户信息数组 |
| | | */ |
| | | function get_user_info($id=0) |
| | | { |
| | | if ($id == 0) |
| | | { |
| | | $id = $_SESSION['user_id']; |
| | | } |
| | | $time = date('Y-m-d'); |
| | | $sql = 'SELECT u.user_id, u.email,u.user_rank, u.user_name, u.user_money, u.pay_points'. |
| | | ' FROM ' .$GLOBALS['ecs']->table('users'). ' AS u ' . |
| | | " WHERE u.user_id = '$id'"; |
| | | $user = $GLOBALS['db']->getRow($sql); |
| | | $bonus = get_user_bonus($id); |
| | | if($user['user_rank'] == 0) |
| | | { |
| | | $user['user_rank'] = "非会员"; |
| | | }else |
| | | { |
| | | $rank_id = $user['user_rank']; |
| | | $sql = "SELECT rank_name FROM ".$GLOBALS['ecs']->table('user_rank')."WHERE rank_id='$rank_id'"; |
| | | $user['user_rank'] = $GLOBALS['db']->getOne($sql); |
| | | } |
| | | $user['username'] = $user['user_name']; |
| | | $user['user_points'] = $user['pay_points'] . $GLOBALS['_CFG']['integral_name']; |
| | | $user['user_money'] = price_format($user['user_money'], false); |
| | | $user['user_bonus'] = price_format($bonus['bonus_value'], false); |
| | | return $user; |
| | | } |
| | | /** |
| | | * 取得当前位置和页面标题 |
| | | * |
| | | * @access public |
| | | * @param integer $cat 分类编号(只有商品及分类、文章及分类用到) |
| | | * @param string $str 商品名、文章标题或其他附加的内容(无链接) |
| | | * @return array |
| | | */ |
| | | function assign_ur_here($cat = 0, $str = '') |
| | | { |
| | | /* 判断是否重写,取得文件名 */ |
| | | $cur_url = basename(PHP_SELF); |
| | | if (intval($GLOBALS['_CFG']['rewrite'])) |
| | | { |
| | | $filename = strpos($cur_url,'-') ? substr($cur_url, 0, strpos($cur_url,'-')) : substr($cur_url, 0, -4); |
| | | } |
| | | else |
| | | { |
| | | $filename = substr($cur_url, 0, -4); |
| | | } |
| | | |
| | | /* 初始化“页面标题”和“当前位置” */ |
| | | $page_title = $GLOBALS['_CFG']['shop_title'] . ' ' . ''; |
| | | $ur_here = '<a href=".">' . $GLOBALS['_LANG']['home'] . '</a>'; |
| | | |
| | | /* 根据文件名分别处理中间的部分 */ |
| | | if ($filename != 'index') |
| | | { |
| | | /* 处理有分类的 */ |
| | | if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand'))) |
| | | { |
| | | /* 商品分类或商品 */ |
| | | if ('category' == $filename || 'goods' == $filename || 'brand' == $filename) |
| | | { |
| | | if ($cat > 0) |
| | | { |
| | | $cat_arr = get_parent_cats($cat); |
| | | |
| | | $key = 'cid'; |
| | | $type = 'category'; |
| | | } |
| | | else |
| | | { |
| | | $cat_arr = array(); |
| | | } |
| | | } |
| | | /* 文章分类或文章 */ |
| | | elseif ('article_cat' == $filename || 'article' == $filename) |
| | | { |
| | | if ($cat > 0) |
| | | { |
| | | $cat_arr = get_article_parent_cats($cat); |
| | | |
| | | $key = 'acid'; |
| | | $type = 'article_cat'; |
| | | } |
| | | else |
| | | { |
| | | $cat_arr = array(); |
| | | } |
| | | } |
| | | |
| | | /* 循环分类 */ |
| | | if (!empty($cat_arr)) |
| | | { |
| | | krsort($cat_arr); |
| | | foreach ($cat_arr AS $val) |
| | | { |
| | | $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title; |
| | | $args = array($key => $val['cat_id']); |
| | | $ur_here .= ' <code>></code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' . |
| | | htmlspecialchars($val['cat_name']) . '</a>'; |
| | | } |
| | | } |
| | | } |
| | | /* 处理无分类的 */ |
| | | else |
| | | { |
| | | /* 团购 */ |
| | | if ('group_buy' == $filename) |
| | | { |
| | | $page_title = $GLOBALS['_LANG']['group_buy_goods'] . '_' . $page_title; |
| | | $args = array('gbid' => '0'); |
| | | $ur_here .= ' <code>></code> <a href="group_buy.php">' . |
| | | $GLOBALS['_LANG']['group_buy_goods'] . '</a>'; |
| | | } |
| | | /* 拍卖 */ |
| | | elseif ('auction' == $filename) |
| | | { |
| | | $page_title = $GLOBALS['_LANG']['auction'] . '_' . $page_title; |
| | | $args = array('auid' => '0'); |
| | | $ur_here .= ' <code>></code> <a href="auction.php">' . |
| | | $GLOBALS['_LANG']['auction'] . '</a>'; |
| | | } |
| | | /* 夺宝 */ |
| | | elseif ('snatch' == $filename) |
| | | { |
| | | $page_title = $GLOBALS['_LANG']['snatch'] . '_' . $page_title; |
| | | $args = array('id' => '0'); |
| | | $ur_here .= ' <code> > </code><a href="snatch.php">' . $GLOBALS['_LANG']['snatch_list'] . '</a>'; |
| | | } |
| | | /* 批发 */ |
| | | elseif ('wholesale' == $filename) |
| | | { |
| | | $page_title = $GLOBALS['_LANG']['wholesale'] . '_' . $page_title; |
| | | $args = array('wsid' => '0'); |
| | | $ur_here .= ' <code>></code> <a href="wholesale.php">' . |
| | | $GLOBALS['_LANG']['wholesale'] . '</a>'; |
| | | } |
| | | /* 积分兑换 */ |
| | | elseif ('exchange' == $filename) |
| | | { |
| | | $page_title = $GLOBALS['_LANG']['exchange'] . '_' . $page_title; |
| | | $args = array('wsid' => '0'); |
| | | $ur_here .= ' <code>></code> <a href="exchange.php">' . |
| | | $GLOBALS['_LANG']['exchange'] . '</a>'; |
| | | } |
| | | /* 其他的在这里补充 */ |
| | | } |
| | | } |
| | | |
| | | /* 处理最后一部分 */ |
| | | if (!empty($str)) |
| | | { |
| | | $page_title = $str . '_' . $page_title; |
| | | $ur_here .= ' <code>></code> ' . $str; |
| | | } |
| | | |
| | | /* 返回值 */ |
| | | return array('title' => $page_title, 'ur_here' => $ur_here); |
| | | } |
| | | |
| | | /** |
| | | * 获得指定分类的所有上级分类 |
| | | * |
| | | * @access public |
| | | * @param integer $cat 分类编号 |
| | | * @return array |
| | | */ |
| | | function get_parent_cats($cat) |
| | | { |
| | | if ($cat == 0) |
| | | { |
| | | return array(); |
| | | } |
| | | |
| | | $arr = $GLOBALS['db']->GetAll('SELECT cat_id, cat_name, parent_id FROM ' . $GLOBALS['ecs']->table('category')); |
| | | |
| | | if (empty($arr)) |
| | | { |
| | | return array(); |
| | | } |
| | | |
| | | $index = 0; |
| | | $cats = array(); |
| | | |
| | | while (1) |
| | | { |
| | | foreach ($arr AS $row) |
| | | { |
| | | if ($cat == $row['cat_id']) |
| | | { |
| | | $cat = $row['parent_id']; |
| | | |
| | | $cats[$index]['cat_id'] = $row['cat_id']; |
| | | $cats[$index]['cat_name'] = $row['cat_name']; |
| | | |
| | | $index++; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if ($index == 0 || $cat == 0) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return $cats; |
| | | } |
| | | |
| | | /** |
| | | * 根据提供的数组编译成页面标题 |
| | | * |
| | | * @access public |
| | | * @param string $type 类型 |
| | | * @param array $arr 分类数组 |
| | | * @return string |
| | | */ |
| | | function build_pagetitle($arr, $type = 'category') |
| | | { |
| | | $str = ''; |
| | | |
| | | foreach ($arr AS $val) |
| | | { |
| | | $str .= htmlspecialchars($val['cat_name']) . '_'; |
| | | } |
| | | |
| | | return $str; |
| | | } |
| | | |
| | | /** |
| | | * 根据提供的数组编译成当前位置 |
| | | * |
| | | * @access public |
| | | * @param string $type 类型 |
| | | * @param array $arr 分类数组 |
| | | * @return void |
| | | */ |
| | | function build_urhere($arr, $type = 'category') |
| | | { |
| | | krsort($arr); |
| | | |
| | | $str = ''; |
| | | foreach ($arr AS $val) |
| | | { |
| | | switch ($type) |
| | | { |
| | | case 'category': |
| | | case 'brand': |
| | | $args = array('cid' => $val['cat_id']); |
| | | break; |
| | | case 'article_cat': |
| | | $args = array('acid' => $val['cat_id']); |
| | | break; |
| | | } |
| | | |
| | | $str .= ' <code>></code> <a href="' . build_uri($type, $args). '">' . htmlspecialchars($val['cat_name']) . '</a>'; |
| | | } |
| | | |
| | | return $str; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定页面的动态内容 |
| | | * |
| | | * @access public |
| | | * @param string $tmp 模板名称 |
| | | * @return void |
| | | */ |
| | | function assign_dynamic($tmp) |
| | | { |
| | | $sql = 'SELECT id, number, type FROM ' . $GLOBALS['ecs']->table('template') . |
| | | " WHERE filename = '$tmp' AND type > 0 AND remarks ='' AND theme='" . $GLOBALS['_CFG']['template'] . "'"; |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | foreach ($res AS $row) |
| | | { |
| | | switch ($row['type']) |
| | | { |
| | | case 1: |
| | | /* 分类下的商品 */ |
| | | $GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number'])); |
| | | break; |
| | | case 2: |
| | | /* 品牌的商品 */ |
| | | $brand_goods = assign_brand_goods($row['id'], $row['number']); |
| | | |
| | | $GLOBALS['smarty']->assign('brand_goods_' . $row['id'], $brand_goods['goods']); |
| | | $GLOBALS['smarty']->assign('goods_brand_' . $row['id'], $brand_goods['brand']); |
| | | break; |
| | | case 3: |
| | | /* 文章列表 */ |
| | | $cat_articles = assign_articles($row['id'], $row['number']); |
| | | |
| | | $GLOBALS['smarty']->assign('articles_cat_' . $row['id'], $cat_articles['cat']); |
| | | $GLOBALS['smarty']->assign('articles_' . $row['id'], $cat_articles['arr']); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 分配文章列表给smarty |
| | | * |
| | | * @access public |
| | | * @param integer $id 文章分类的编号 |
| | | * @param integer $num 文章数量 |
| | | * @return array |
| | | */ |
| | | function assign_articles($id, $num) |
| | | { |
| | | $sql = 'SELECT cat_name FROM ' . $GLOBALS['ecs']->table('article_cat') . " WHERE cat_id = '" . $id ."'"; |
| | | |
| | | $cat['id'] = $id; |
| | | $cat['name'] = $GLOBALS['db']->getOne($sql); |
| | | $cat['url'] = build_uri('article_cat', array('acid' => $id), $cat['name']); |
| | | |
| | | $articles['cat'] = $cat; |
| | | $articles['arr'] = get_cat_articles($id, 1, $num); |
| | | |
| | | return $articles; |
| | | } |
| | | |
| | | /** |
| | | * 分配帮助信息 |
| | | * |
| | | * @access public |
| | | * @return array |
| | | */ |
| | | function get_shop_help() |
| | | { |
| | | $sql = 'SELECT c.cat_id, c.cat_name, c.sort_order, a.article_id, a.title, a.file_url, a.open_type ' . |
| | | 'FROM ' .$GLOBALS['ecs']->table('article'). ' AS a ' . |
| | | 'LEFT JOIN ' .$GLOBALS['ecs']->table('article_cat'). ' AS c ' . |
| | | 'ON a.cat_id = c.cat_id WHERE c.cat_type = 5 AND a.is_open = 1 ' . |
| | | 'ORDER BY c.sort_order ASC, a.article_id'; |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | $arr = array(); |
| | | foreach ($res AS $key => $row) |
| | | { |
| | | $arr[$row['cat_id']]['cat_id'] = build_uri('article_cat', array('acid'=> $row['cat_id']), $row['cat_name']); |
| | | $arr[$row['cat_id']]['cat_name'] = $row['cat_name']; |
| | | $arr[$row['cat_id']]['article'][$key]['article_id'] = $row['article_id']; |
| | | $arr[$row['cat_id']]['article'][$key]['title'] = $row['title']; |
| | | $arr[$row['cat_id']]['article'][$key]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? |
| | | sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title']; |
| | | $arr[$row['cat_id']]['article'][$key]['url'] = $row['open_type'] != 1 ? |
| | | build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']); |
| | | } |
| | | |
| | | return $arr; |
| | | } |
| | | |
| | | /** |
| | | * 创建分页信息 |
| | | * |
| | | * @access public |
| | | * @param string $app 程序名称,如category |
| | | * @param string $cat 分类ID |
| | | * @param string $record_count 记录总数 |
| | | * @param string $size 每页记录数 |
| | | * @param string $sort 排序类型 |
| | | * @param string $order 排序顺序 |
| | | * @param string $page 当前页 |
| | | * @param string $keywords 查询关键字 |
| | | * @param string $brand 品牌 |
| | | * @param string $price_min 最小价格 |
| | | * @param string $price_max 最高价格 |
| | | * @return void |
| | | */ |
| | | function assign_pager($app, $cat, $record_count, $size, $sort, $order, $page = 1, |
| | | $keywords = '', $brand = 0, $price_min = 0, $price_max = 0, $display_type = 'list', $filter_attr='', $url_format='', $sch_array='') |
| | | { |
| | | $sch = array('keywords' => $keywords, |
| | | 'sort' => $sort, |
| | | 'order' => $order, |
| | | 'cat' => $cat, |
| | | 'brand' => $brand, |
| | | 'price_min' => $price_min, |
| | | 'price_max' => $price_max, |
| | | 'filter_attr'=>$filter_attr, |
| | | 'display' => $display_type |
| | | ); |
| | | |
| | | $page = intval($page); |
| | | if ($page < 1) |
| | | { |
| | | $page = 1; |
| | | } |
| | | |
| | | $page_count = $record_count > 0 ? intval(ceil($record_count / $size)) : 1; |
| | | |
| | | $pager['page'] = $page; |
| | | $pager['size'] = $size; |
| | | $pager['sort'] = $sort; |
| | | $pager['order'] = $order; |
| | | $pager['record_count'] = $record_count; |
| | | $pager['page_count'] = $page_count; |
| | | $pager['display'] = $display_type; |
| | | |
| | | switch ($app) |
| | | { |
| | | case 'supplier': |
| | | $uri_args = array('suppid'=>$_GET['suppId'],'go'=>$_GET['go'],'cid' => $cat); |
| | | break; |
| | | case 'category': |
| | | $uri_args = array('cid' => $cat, 'bid' => $brand, 'price_min'=>$price_min, 'price_max'=>$price_max, 'filter_attr'=>$filter_attr, 'sort' => $sort, 'order' => $order, 'display' => $display_type); |
| | | break; |
| | | case 'article_cat': |
| | | $uri_args = array('acid' => $cat, 'sort' => $sort, 'order' => $order); |
| | | break; |
| | | case 'brand': |
| | | $uri_args = array('cid' => $cat, 'bid' => $brand, 'sort' => $sort, 'order' => $order, 'display' => $display_type); |
| | | break; |
| | | case 'search': |
| | | $uri_args = array('cid' => $cat, 'bid' => $brand, 'sort' => $sort, 'order' => $order); |
| | | break; |
| | | case 'pro_search': |
| | | $uri_args = array('cid' => $cat, 'bid' => $brand, 'sort' => $sort, 'order' => $order); |
| | | break; |
| | | case 'exchange': |
| | | $uri_args = array('cid' => $cat, 'integral_min'=>$price_min, 'integral_max'=>$price_max, 'sort' => $sort, 'order' => $order, 'display' => $display_type); |
| | | break; |
| | | } |
| | | /* 分页样式 */ |
| | | $pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0; |
| | | |
| | | $page_prev = ($page > 1) ? $page - 1 : 1; |
| | | $page_next = ($page < $page_count) ? $page + 1 : $page_count; |
| | | if ($pager['styleid'] == 0) |
| | | { |
| | | if (!empty($url_format)) |
| | | { |
| | | $pager['page_first'] = $url_format . 1; |
| | | $pager['page_prev'] = $url_format . $page_prev; |
| | | $pager['page_next'] = $url_format . $page_next; |
| | | $pager['page_last'] = $url_format . $page_count; |
| | | } |
| | | else |
| | | { |
| | | $pager['page_first'] = build_uri($app, $uri_args, '', 1, $keywords); |
| | | $pager['page_prev'] = build_uri($app, $uri_args, '', $page_prev, $keywords); |
| | | $pager['page_next'] = build_uri($app, $uri_args, '', $page_next, $keywords); |
| | | $pager['page_last'] = build_uri($app, $uri_args, '', $page_count, $keywords); |
| | | } |
| | | $pager['array'] = array(); |
| | | |
| | | for ($i = 1; $i <= $page_count; $i++) |
| | | { |
| | | $pager['array'][$i] = $i; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $_pagenum = 10; // 显示的页码 |
| | | $_offset = 2; // 当前页偏移值 |
| | | $_from = $_to = 0; // 开始页, 结束页 |
| | | if($_pagenum > $page_count) |
| | | { |
| | | $_from = 1; |
| | | $_to = $page_count; |
| | | } |
| | | else |
| | | { |
| | | $_from = $page - $_offset; |
| | | $_to = $_from + $_pagenum - 1; |
| | | if($_from < 1) |
| | | { |
| | | $_to = $page + 1 - $_from; |
| | | $_from = 1; |
| | | if($_to - $_from < $_pagenum) |
| | | { |
| | | $_to = $_pagenum; |
| | | } |
| | | } |
| | | elseif($_to > $page_count) |
| | | { |
| | | $_from = $page_count - $_pagenum + 1; |
| | | $_to = $page_count; |
| | | } |
| | | } |
| | | if (!empty($url_format)) |
| | | { |
| | | $pager['page_first'] = ($page - $_offset > 1 && $_pagenum < $page_count) ? $url_format . 1 : ''; |
| | | $pager['page_prev'] = ($page > 1) ? $url_format . $page_prev : ''; |
| | | $pager['page_next'] = ($page < $page_count) ? $url_format . $page_next : ''; |
| | | $pager['page_last'] = ($_to < $page_count) ? $url_format . $page_count : ''; |
| | | $pager['page_kbd'] = ($_pagenum < $page_count) ? true : false; |
| | | $pager['page_number'] = array(); |
| | | for ($i=$_from;$i<=$_to;++$i) |
| | | { |
| | | $pager['page_number'][$i] = $url_format . $i; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $pager['page_first'] = ($page - $_offset > 1 && $_pagenum < $page_count) ? build_uri($app, $uri_args, '', 1, $keywords) : ''; |
| | | $pager['page_prev'] = ($page > 1) ? build_uri($app, $uri_args, '', $page_prev, $keywords) : ''; |
| | | $pager['page_next'] = ($page < $page_count) ? build_uri($app, $uri_args, '', $page_next, $keywords) : ''; |
| | | $pager['page_last'] = ($_to < $page_count) ? build_uri($app, $uri_args, '', $page_count, $keywords) : ''; |
| | | $pager['page_kbd'] = ($_pagenum < $page_count) ? true : false; |
| | | $pager['page_number'] = array(); |
| | | for ($i=$_from;$i<=$_to;++$i) |
| | | { |
| | | $pager['page_number'][$i] = build_uri($app, $uri_args, '', $i, $keywords); |
| | | } |
| | | } |
| | | } |
| | | if (!empty($sch_array)) |
| | | { |
| | | $pager['search'] = $sch_array; |
| | | } |
| | | else |
| | | { |
| | | $pager['search']['category'] = $cat; |
| | | foreach ($sch AS $key => $row) |
| | | { |
| | | $pager['search'][$key] = $row; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | $GLOBALS['smarty']->assign('pager', $pager); |
| | | } |
| | | |
| | | /** |
| | | * 生成给pager.lbi赋值的数组 |
| | | * |
| | | * @access public |
| | | * @param string $url 分页的链接地址(必须是带有参数的地址,若不是可以伪造一个无用参数) |
| | | * @param array $param 链接参数 key为参数名,value为参数值 |
| | | * @param int $record 记录总数量 |
| | | * @param int $page 当前页数 |
| | | * @param int $size 每页大小 |
| | | * |
| | | * @return array $pager |
| | | */ |
| | | function get_pager($url, $param, $record_count, $page = 1, $size = 10) |
| | | { |
| | | $size = intval($size); |
| | | if ($size < 1) |
| | | { |
| | | $size = 10; |
| | | } |
| | | |
| | | $page = intval($page); |
| | | if ($page < 1) |
| | | { |
| | | $page = 1; |
| | | } |
| | | |
| | | $record_count = intval($record_count); |
| | | |
| | | $page_count = $record_count > 0 ? intval(ceil($record_count / $size)) : 1; |
| | | if ($page > $page_count) |
| | | { |
| | | $page = $page_count; |
| | | } |
| | | /* 分页样式 */ |
| | | $pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0; |
| | | |
| | | $page_prev = ($page > 1) ? $page - 1 : 1; |
| | | $page_next = ($page < $page_count) ? $page + 1 : $page_count; |
| | | |
| | | /* 将参数合成url字串 */ |
| | | $param_url = '?'; |
| | | foreach ($param AS $key => $value) |
| | | { |
| | | $param_url .= $key . '=' . $value . '&'; |
| | | } |
| | | |
| | | $pager['url'] = $url; |
| | | $pager['start'] = ($page -1) * $size; |
| | | $pager['page'] = $page; |
| | | $pager['size'] = $size; |
| | | $pager['record_count'] = $record_count; |
| | | $pager['page_count'] = $page_count; |
| | | |
| | | if ($pager['styleid'] == 0) |
| | | { |
| | | $pager['page_first'] = $url . $param_url . 'page=1'; |
| | | $pager['page_prev'] = $url . $param_url . 'page=' . $page_prev; |
| | | $pager['page_next'] = $url . $param_url . 'page=' . $page_next; |
| | | $pager['page_last'] = $url . $param_url . 'page=' . $page_count; |
| | | $pager['array'] = array(); |
| | | for ($i = 1; $i <= $page_count; $i++) |
| | | { |
| | | $pager['array'][$i] = $i; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $_pagenum = 10; // 显示的页码 |
| | | $_offset = 2; // 当前页偏移值 |
| | | $_from = $_to = 0; // 开始页, 结束页 |
| | | if($_pagenum > $page_count) |
| | | { |
| | | $_from = 1; |
| | | $_to = $page_count; |
| | | } |
| | | else |
| | | { |
| | | $_from = $page - $_offset; |
| | | $_to = $_from + $_pagenum - 1; |
| | | if($_from < 1) |
| | | { |
| | | $_to = $page + 1 - $_from; |
| | | $_from = 1; |
| | | if($_to - $_from < $_pagenum) |
| | | { |
| | | $_to = $_pagenum; |
| | | } |
| | | } |
| | | elseif($_to > $page_count) |
| | | { |
| | | $_from = $page_count - $_pagenum + 1; |
| | | $_to = $page_count; |
| | | } |
| | | } |
| | | $url_format = $url . $param_url . 'page='; |
| | | $pager['page_first'] = ($page - $_offset > 1 && $_pagenum < $page_count) ? $url_format . 1 : ''; |
| | | $pager['page_prev'] = ($page > 1) ? $url_format . $page_prev : ''; |
| | | $pager['page_next'] = ($page < $page_count) ? $url_format . $page_next : ''; |
| | | $pager['page_last'] = ($_to < $page_count) ? $url_format . $page_count : ''; |
| | | $pager['page_kbd'] = ($_pagenum < $page_count) ? true : false; |
| | | $pager['page_number'] = array(); |
| | | for ($i=$_from;$i<=$_to;++$i) |
| | | { |
| | | $pager['page_number'][$i] = $url_format . $i; |
| | | } |
| | | } |
| | | $pager['search'] = $param; |
| | | |
| | | return $pager; |
| | | } |
| | | |
| | | /** |
| | | * 调用调查内容 |
| | | * |
| | | * @access public |
| | | * @param integer $id 调查的编号 |
| | | * @return array |
| | | */ |
| | | function get_vote($id = '') |
| | | { |
| | | /* 随机取得一个调查的主题 */ |
| | | if (empty($id)) |
| | | { |
| | | $time = gmtime(); |
| | | $sql = 'SELECT vote_id, vote_name, can_multi, vote_count, RAND() AS rnd' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('vote') . |
| | | " WHERE start_time <= '$time' AND end_time >= '$time' ". |
| | | ' ORDER BY rnd LIMIT 1'; |
| | | } |
| | | else |
| | | { |
| | | $sql = 'SELECT vote_id, vote_name, can_multi, vote_count' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('vote'). |
| | | " WHERE vote_id = '$id'"; |
| | | } |
| | | |
| | | $vote_arr = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if ($vote_arr !== false && !empty($vote_arr)) |
| | | { |
| | | /* 通过调查的ID,查询调查选项 */ |
| | | $sql_option = 'SELECT v.*, o.option_id, o.vote_id, o.option_name, o.option_count ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('vote') . ' AS v, ' . |
| | | $GLOBALS['ecs']->table('vote_option') . ' AS o ' . |
| | | "WHERE o.vote_id = v.vote_id AND o.vote_id = '$vote_arr[vote_id]' ORDER BY o.option_order ASC, o.option_id DESC"; |
| | | $res = $GLOBALS['db']->getAll($sql_option); |
| | | |
| | | /* 总票数 */ |
| | | $sql = 'SELECT SUM(option_count) AS all_option FROM ' . $GLOBALS['ecs']->table('vote_option') . |
| | | " WHERE vote_id = '" . $vote_arr['vote_id'] . "' GROUP BY vote_id"; |
| | | $option_num = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $arr = array(); |
| | | $count = 100; |
| | | foreach ($res AS $idx => $row) |
| | | { |
| | | if ($option_num > 0 && $idx == count($res) - 1) |
| | | { |
| | | $percent = $count; |
| | | } |
| | | else |
| | | { |
| | | $percent = ($row['vote_count'] > 0 && $option_num > 0) ? round(($row['option_count'] / $option_num) * 100) : 0; |
| | | |
| | | $count -= $percent; |
| | | } |
| | | $arr[$row['vote_id']]['options'][$row['option_id']]['percent'] = $percent; |
| | | |
| | | $arr[$row['vote_id']]['vote_id'] = $row['vote_id']; |
| | | $arr[$row['vote_id']]['vote_name'] = $row['vote_name']; |
| | | $arr[$row['vote_id']]['can_multi'] = $row['can_multi']; |
| | | $arr[$row['vote_id']]['vote_count'] = $row['vote_count']; |
| | | |
| | | $arr[$row['vote_id']]['options'][$row['option_id']]['option_id'] = $row['option_id']; |
| | | $arr[$row['vote_id']]['options'][$row['option_id']]['option_name'] = $row['option_name']; |
| | | $arr[$row['vote_id']]['options'][$row['option_id']]['option_count'] = $row['option_count']; |
| | | } |
| | | |
| | | $vote_arr['vote_id'] = (!empty($vote_arr['vote_id'])) ? $vote_arr['vote_id'] : ''; |
| | | |
| | | $vote = array('id' => $vote_arr['vote_id'], 'content' => $arr); |
| | | |
| | | return $vote; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得浏览器名称和版本 |
| | | * |
| | | * @access public |
| | | * @return string |
| | | */ |
| | | function get_user_browser() |
| | | { |
| | | if (empty($_SERVER['HTTP_USER_AGENT'])) |
| | | { |
| | | return ''; |
| | | } |
| | | |
| | | $agent = $_SERVER['HTTP_USER_AGENT']; |
| | | $browser = ''; |
| | | $browser_ver = ''; |
| | | |
| | | if (preg_match('/MSIE\s([^\s|;]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = 'Internet Explorer'; |
| | | $browser_ver = $regs[1]; |
| | | } |
| | | elseif (preg_match('/FireFox\/([^\s]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = 'FireFox'; |
| | | $browser_ver = $regs[1]; |
| | | } |
| | | elseif (preg_match('/Maxthon/i', $agent, $regs)) |
| | | { |
| | | $browser = '(Internet Explorer ' .$browser_ver. ') Maxthon'; |
| | | $browser_ver = ''; |
| | | } |
| | | elseif (preg_match('/Opera[\s|\/]([^\s]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = 'Opera'; |
| | | $browser_ver = $regs[1]; |
| | | } |
| | | elseif (preg_match('/OmniWeb\/(v*)([^\s|;]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = 'OmniWeb'; |
| | | $browser_ver = $regs[2]; |
| | | } |
| | | elseif (preg_match('/Netscape([\d]*)\/([^\s]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = 'Netscape'; |
| | | $browser_ver = $regs[2]; |
| | | } |
| | | elseif (preg_match('/safari\/([^\s]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = 'Safari'; |
| | | $browser_ver = $regs[1]; |
| | | } |
| | | elseif (preg_match('/NetCaptor\s([^\s|;]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = '(Internet Explorer ' .$browser_ver. ') NetCaptor'; |
| | | $browser_ver = $regs[1]; |
| | | } |
| | | elseif (preg_match('/Lynx\/([^\s]+)/i', $agent, $regs)) |
| | | { |
| | | $browser = 'Lynx'; |
| | | $browser_ver = $regs[1]; |
| | | } |
| | | |
| | | if (!empty($browser)) |
| | | { |
| | | return addslashes($browser . ' ' . $browser_ver); |
| | | } |
| | | else |
| | | { |
| | | return 'Unknow browser'; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 判断是否为搜索引擎蜘蛛 |
| | | * |
| | | * @access public |
| | | * @return string |
| | | */ |
| | | function is_spider($record = true) |
| | | { |
| | | static $spider = NULL; |
| | | |
| | | if ($spider !== NULL) |
| | | { |
| | | return $spider; |
| | | } |
| | | |
| | | if (empty($_SERVER['HTTP_USER_AGENT'])) |
| | | { |
| | | $spider = ''; |
| | | |
| | | return ''; |
| | | } |
| | | |
| | | $searchengine_bot = array( |
| | | 'googlebot', |
| | | 'mediapartners-google', |
| | | 'baiduspider+', |
| | | 'msnbot', |
| | | 'yodaobot', |
| | | 'yahoo! slurp;', |
| | | 'yahoo! slurp china;', |
| | | 'iaskspider', |
| | | 'sogou web spider', |
| | | 'sogou push spider' |
| | | ); |
| | | |
| | | $searchengine_name = array( |
| | | 'GOOGLE', |
| | | 'GOOGLE ADSENSE', |
| | | 'BAIDU', |
| | | 'MSN', |
| | | 'YODAO', |
| | | 'YAHOO', |
| | | 'Yahoo China', |
| | | 'IASK', |
| | | 'SOGOU', |
| | | 'SOGOU' |
| | | ); |
| | | |
| | | $spider = strtolower($_SERVER['HTTP_USER_AGENT']); |
| | | |
| | | foreach ($searchengine_bot AS $key => $value) |
| | | { |
| | | if (strpos($spider, $value) !== false) |
| | | { |
| | | $spider = $searchengine_name[$key]; |
| | | |
| | | if ($record === true) |
| | | { |
| | | $GLOBALS['db']->autoReplace($GLOBALS['ecs']->table('searchengine'), array('date' => local_date('Y-m-d'), 'searchengine' => $spider, 'count' => 1), array('count' => 1)); |
| | | } |
| | | |
| | | return $spider; |
| | | } |
| | | } |
| | | |
| | | $spider = ''; |
| | | |
| | | return ''; |
| | | } |
| | | |
| | | /** |
| | | * 获得客户端的操作系统 |
| | | * |
| | | * @access private |
| | | * @return void |
| | | */ |
| | | function get_os() |
| | | { |
| | | if (empty($_SERVER['HTTP_USER_AGENT'])) |
| | | { |
| | | return 'Unknown'; |
| | | } |
| | | |
| | | $agent = strtolower($_SERVER['HTTP_USER_AGENT']); |
| | | $os = ''; |
| | | |
| | | if (strpos($agent, 'win') !== false) |
| | | { |
| | | if (strpos($agent, 'nt 5.1') !== false) |
| | | { |
| | | $os = 'Windows XP'; |
| | | } |
| | | elseif (strpos($agent, 'nt 5.2') !== false) |
| | | { |
| | | $os = 'Windows 2003'; |
| | | } |
| | | elseif (strpos($agent, 'nt 5.0') !== false) |
| | | { |
| | | $os = 'Windows 2000'; |
| | | } |
| | | elseif (strpos($agent, 'nt 6.0') !== false) |
| | | { |
| | | $os = 'Windows Vista'; |
| | | } |
| | | elseif (strpos($agent, 'nt') !== false) |
| | | { |
| | | $os = 'Windows NT'; |
| | | } |
| | | elseif (strpos($agent, 'win 9x') !== false && strpos($agent, '4.90') !== false) |
| | | { |
| | | $os = 'Windows ME'; |
| | | } |
| | | elseif (strpos($agent, '98') !== false) |
| | | { |
| | | $os = 'Windows 98'; |
| | | } |
| | | elseif (strpos($agent, '95') !== false) |
| | | { |
| | | $os = 'Windows 95'; |
| | | } |
| | | elseif (strpos($agent, '32') !== false) |
| | | { |
| | | $os = 'Windows 32'; |
| | | } |
| | | elseif (strpos($agent, 'ce') !== false) |
| | | { |
| | | $os = 'Windows CE'; |
| | | } |
| | | } |
| | | elseif (strpos($agent, 'linux') !== false) |
| | | { |
| | | $os = 'Linux'; |
| | | } |
| | | elseif (strpos($agent, 'unix') !== false) |
| | | { |
| | | $os = 'Unix'; |
| | | } |
| | | elseif (strpos($agent, 'sun') !== false && strpos($agent, 'os') !== false) |
| | | { |
| | | $os = 'SunOS'; |
| | | } |
| | | elseif (strpos($agent, 'ibm') !== false && strpos($agent, 'os') !== false) |
| | | { |
| | | $os = 'IBM OS/2'; |
| | | } |
| | | elseif (strpos($agent, 'mac') !== false && strpos($agent, 'pc') !== false) |
| | | { |
| | | $os = 'Macintosh'; |
| | | } |
| | | elseif (strpos($agent, 'powerpc') !== false) |
| | | { |
| | | $os = 'PowerPC'; |
| | | } |
| | | elseif (strpos($agent, 'aix') !== false) |
| | | { |
| | | $os = 'AIX'; |
| | | } |
| | | elseif (strpos($agent, 'hpux') !== false) |
| | | { |
| | | $os = 'HPUX'; |
| | | } |
| | | elseif (strpos($agent, 'netbsd') !== false) |
| | | { |
| | | $os = 'NetBSD'; |
| | | } |
| | | elseif (strpos($agent, 'bsd') !== false) |
| | | { |
| | | $os = 'BSD'; |
| | | } |
| | | elseif (strpos($agent, 'osf1') !== false) |
| | | { |
| | | $os = 'OSF1'; |
| | | } |
| | | elseif (strpos($agent, 'irix') !== false) |
| | | { |
| | | $os = 'IRIX'; |
| | | } |
| | | elseif (strpos($agent, 'freebsd') !== false) |
| | | { |
| | | $os = 'FreeBSD'; |
| | | } |
| | | elseif (strpos($agent, 'teleport') !== false) |
| | | { |
| | | $os = 'teleport'; |
| | | } |
| | | elseif (strpos($agent, 'flashget') !== false) |
| | | { |
| | | $os = 'flashget'; |
| | | } |
| | | elseif (strpos($agent, 'webzip') !== false) |
| | | { |
| | | $os = 'webzip'; |
| | | } |
| | | elseif (strpos($agent, 'offline') !== false) |
| | | { |
| | | $os = 'offline'; |
| | | } |
| | | else |
| | | { |
| | | $os = 'Unknown'; |
| | | } |
| | | |
| | | return $os; |
| | | } |
| | | |
| | | /** |
| | | * 统计访问信息 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function visit_stats() |
| | | { |
| | | if (isset($GLOBALS['_CFG']['visit_stats']) && $GLOBALS['_CFG']['visit_stats'] == 'off') |
| | | { |
| | | return; |
| | | } |
| | | $time = gmtime(); |
| | | /* 检查客户端是否存在访问统计的cookie */ |
| | | $visit_times = (!empty($_COOKIE['ECS']['visit_times'])) ? intval($_COOKIE['ECS']['visit_times']) + 1 : 1; |
| | | setcookie('ECS[visit_times]', $visit_times, $time + 86400 * 365, '/'); |
| | | |
| | | $browser = get_user_browser(); |
| | | $os = get_os(); |
| | | $ip = real_ip(); |
| | | $area = ecs_geoip($ip); |
| | | |
| | | /* 语言 */ |
| | | if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) |
| | | { |
| | | $pos = strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';'); |
| | | $lang = addslashes(($pos !== false) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, $pos) : $_SERVER['HTTP_ACCEPT_LANGUAGE']); |
| | | } |
| | | else |
| | | { |
| | | $lang = ''; |
| | | } |
| | | |
| | | /* 来源 */ |
| | | if (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 9) |
| | | { |
| | | $pos = strpos($_SERVER['HTTP_REFERER'], '/', 9); |
| | | if ($pos !== false) |
| | | { |
| | | $domain = substr($_SERVER['HTTP_REFERER'], 0, $pos); |
| | | $path = substr($_SERVER['HTTP_REFERER'], $pos); |
| | | |
| | | /* 来源关键字 */ |
| | | if (!empty($domain) && !empty($path)) |
| | | { |
| | | save_searchengine_keyword($domain, $path); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $domain = $path = ''; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $domain = $path = ''; |
| | | } |
| | | |
| | | $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('stats') . ' ( ' . |
| | | 'ip_address, visit_times, browser, system, language, area, ' . |
| | | 'referer_domain, referer_path, access_url, access_time' . |
| | | ') VALUES (' . |
| | | "'$ip', '$visit_times', '$browser', '$os', '$lang', '$area', ". |
| | | "'" . addslashes($domain) ."', '" . addslashes($path) ."', '" . addslashes(PHP_SELF) ."', '" . $time . "')"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 保存搜索引擎关键字 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function save_searchengine_keyword($domain, $path) |
| | | { |
| | | if (strpos($domain, 'google.com.tw') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'GOOGLE TAIWAN'; |
| | | $keywords = urldecode($regs[1]); // google taiwan |
| | | } |
| | | if (strpos($domain, 'google.cn') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'GOOGLE CHINA'; |
| | | $keywords = urldecode($regs[1]); // google china |
| | | } |
| | | if (strpos($domain, 'google.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'GOOGLE'; |
| | | $keywords = urldecode($regs[1]); // google |
| | | } |
| | | elseif (strpos($domain, 'baidu.') !== false && preg_match('/wd=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'BAIDU'; |
| | | $keywords = urldecode($regs[1]); // baidu |
| | | } |
| | | elseif (strpos($domain, 'baidu.') !== false && preg_match('/word=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'BAIDU'; |
| | | $keywords = urldecode($regs[1]); // baidu |
| | | } |
| | | elseif (strpos($domain, '114.vnet.cn') !== false && preg_match('/kw=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'CT114'; |
| | | $keywords = urldecode($regs[1]); // ct114 |
| | | } |
| | | elseif (strpos($domain, 'iask.com') !== false && preg_match('/k=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'IASK'; |
| | | $keywords = urldecode($regs[1]); // iask |
| | | } |
| | | elseif (strpos($domain, 'soso.com') !== false && preg_match('/w=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'SOSO'; |
| | | $keywords = urldecode($regs[1]); // soso |
| | | } |
| | | elseif (strpos($domain, 'sogou.com') !== false && preg_match('/query=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'SOGOU'; |
| | | $keywords = urldecode($regs[1]); // sogou |
| | | } |
| | | elseif (strpos($domain, 'so.163.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'NETEASE'; |
| | | $keywords = urldecode($regs[1]); // netease |
| | | } |
| | | elseif (strpos($domain, 'yodao.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'YODAO'; |
| | | $keywords = urldecode($regs[1]); // yodao |
| | | } |
| | | elseif (strpos($domain, 'zhongsou.com') !== false && preg_match('/word=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'ZHONGSOU'; |
| | | $keywords = urldecode($regs[1]); // zhongsou |
| | | } |
| | | elseif (strpos($domain, 'search.tom.com') !== false && preg_match('/w=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'TOM'; |
| | | $keywords = urldecode($regs[1]); // tom |
| | | } |
| | | elseif (strpos($domain, 'live.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'MSLIVE'; |
| | | $keywords = urldecode($regs[1]); // MSLIVE |
| | | } |
| | | elseif (strpos($domain, 'tw.search.yahoo.com') !== false && preg_match('/p=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'YAHOO TAIWAN'; |
| | | $keywords = urldecode($regs[1]); // yahoo taiwan |
| | | } |
| | | elseif (strpos($domain, 'cn.yahoo.') !== false && preg_match('/p=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'YAHOO CHINA'; |
| | | $keywords = urldecode($regs[1]); // yahoo china |
| | | } |
| | | elseif (strpos($domain, 'yahoo.') !== false && preg_match('/p=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'YAHOO'; |
| | | $keywords = urldecode($regs[1]); // yahoo |
| | | } |
| | | elseif (strpos($domain, 'msn.com.tw') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'MSN TAIWAN'; |
| | | $keywords = urldecode($regs[1]); // msn taiwan |
| | | } |
| | | elseif (strpos($domain, 'msn.com.cn') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'MSN CHINA'; |
| | | $keywords = urldecode($regs[1]); // msn china |
| | | } |
| | | elseif (strpos($domain, 'msn.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) |
| | | { |
| | | $searchengine = 'MSN'; |
| | | $keywords = urldecode($regs[1]); // msn |
| | | } |
| | | |
| | | if (!empty($keywords)) |
| | | { |
| | | $gb_search = array('YAHOO CHINA', 'TOM', 'ZHONGSOU', 'NETEASE', 'SOGOU', 'SOSO', 'IASK', 'CT114', 'BAIDU'); |
| | | if (EC_CHARSET == 'utf-8' && in_array($searchengine, $gb_search)) |
| | | { |
| | | $keywords = ecs_iconv('GBK', 'UTF8', $keywords); |
| | | } |
| | | if (EC_CHARSET == 'gbk' && !in_array($searchengine, $gb_search)) |
| | | { |
| | | $keywords = ecs_iconv('UTF8', 'GBK', $keywords); |
| | | } |
| | | |
| | | $GLOBALS['db']->autoReplace($GLOBALS['ecs']->table('keywords'), array('date' => local_date('Y-m-d'), 'searchengine' => $searchengine, 'keyword' => addslashes($keywords), 'count' => 1), array('count' => 1)); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得指定用户、商品的所有标记 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id |
| | | * @param integer $user_id |
| | | * @return array |
| | | */ |
| | | function get_tags($goods_id = 0, $user_id = 0) |
| | | { |
| | | $where = ''; |
| | | if ($goods_id > 0) |
| | | { |
| | | $where .= " goods_id = '$goods_id'"; |
| | | } |
| | | |
| | | if ($user_id > 0) |
| | | { |
| | | if ($goods_id > 0) |
| | | { |
| | | $where .= " AND"; |
| | | } |
| | | $where .= " user_id = '$user_id'"; |
| | | } |
| | | |
| | | if ($where > '') |
| | | { |
| | | $where = ' WHERE' . $where; |
| | | } |
| | | |
| | | $sql = 'SELECT tag_id, user_id, tag_words, COUNT(tag_id) AS tag_count' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('tag') . |
| | | "$where GROUP BY tag_words"; |
| | | $arr = $GLOBALS['db']->getAll($sql); |
| | | |
| | | return $arr; |
| | | } |
| | | |
| | | /** |
| | | * 获取指定主题某个模板的主题的动态模块 |
| | | * |
| | | * @access public |
| | | * @param string $theme 模板主题 |
| | | * @param string $tmp 模板名称 |
| | | * |
| | | * @return array() |
| | | */ |
| | | function get_dyna_libs($theme, $tmp) |
| | | { |
| | | /* 代码修改_start By */ |
| | | $tmp_arr_www_ecshop68_com = explode('.', $tmp); |
| | | $ext = end($tmp_arr_www_ecshop68_com); |
| | | /* 代码修改_end By */ |
| | | |
| | | $tmp = basename($tmp,".$ext"); |
| | | $sql = 'SELECT region, library, sort_order, id, number, type' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('template') . |
| | | " WHERE theme = '$theme' AND filename = '" . $tmp . "' AND type > 0 AND remarks=''". |
| | | ' ORDER BY region, library, sort_order'; |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | $dyna_libs = array(); |
| | | foreach ($res AS $row) |
| | | { |
| | | $dyna_libs[$row['region']][$row['library']][] = array( |
| | | 'id' => $row['id'], |
| | | 'number' => $row['number'], |
| | | 'type' => $row['type'] |
| | | ); |
| | | } |
| | | |
| | | return $dyna_libs; |
| | | } |
| | | |
| | | /** |
| | | * 替换动态模块 |
| | | * |
| | | * @access public |
| | | * @param string $matches 匹配内容 |
| | | * |
| | | * @return string 结果 |
| | | */ |
| | | function dyna_libs_replace($matches) |
| | | { |
| | | $key = '/' . $matches[1]; |
| | | |
| | | if ($row = array_shift($GLOBALS['libs'][$key])) |
| | | { |
| | | $str = ''; |
| | | switch($row['type']) |
| | | { |
| | | case 1: |
| | | // 分类的商品 |
| | | $str = '{assign var="cat_goods" value=$cat_goods_' .$row['id']. '}{assign var="goods_cat" value=$goods_cat_' .$row['id']. '}'; |
| | | break; |
| | | case 2: |
| | | // 品牌的商品 |
| | | $str = '{assign var="brand_goods" value=$brand_goods_' .$row['id']. '}{assign var="goods_brand" value=$goods_brand_' .$row['id']. '}'; |
| | | break; |
| | | case 3: |
| | | // 文章列表 |
| | | $str = '{assign var="articles" value=$articles_' .$row['id']. '}{assign var="articles_cat" value=$articles_cat_' .$row['id']. '}'; |
| | | break; |
| | | case 4: |
| | | //广告位 |
| | | $str = '{assign var="ads_id" value=' . $row['id'] . '}{assign var="ads_num" value=' . $row['number'] . '}'; |
| | | break; |
| | | } |
| | | return $str . $matches[0]; |
| | | } |
| | | else |
| | | { |
| | | return $matches[0]; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 处理上传文件,并返回上传图片名(上传失败时返回图片名为空) |
| | | * |
| | | * @access public |
| | | * @param array $upload $_FILES 数组 |
| | | * @param array $type 图片所属类别,即data目录下的文件夹名 |
| | | * |
| | | * @return string 上传图片名 |
| | | */ |
| | | function upload_file($upload, $type) |
| | | { |
| | | if (!empty($upload['tmp_name'])) |
| | | { |
| | | $ftype = check_file_type($upload['tmp_name'], $upload['name'], '|png|jpg|jpeg|gif|doc|xls|txt|zip|ppt|pdf|rar|docx|xlsx|pptx|'); |
| | | if (!empty($ftype)) |
| | | { |
| | | $name = date('Ymd'); |
| | | for ($i = 0; $i < 6; $i++) |
| | | { |
| | | $name .= chr(mt_rand(97, 122)); |
| | | } |
| | | |
| | | $name = $_SESSION['user_id'] . '_' . $name . '.' . $ftype; |
| | | |
| | | $target = ROOT_PATH . DATA_DIR . '/' . $type . '/' . $name; |
| | | if (!move_upload_file($upload['tmp_name'], $target)) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_error'], 1); |
| | | |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return $name; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_type'], 1); |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_error']); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 显示一个提示信息 |
| | | * |
| | | * @access public |
| | | * @param string $content |
| | | * @param string $link |
| | | * @param string $href |
| | | * @param string $type 信息类型:warning, error, info |
| | | * @param string $auto_redirect 是否自动跳转 |
| | | * @return void |
| | | */ |
| | | function show_message($content, $links = '', $hrefs = '', $type = 'info', $auto_redirect = true) |
| | | { |
| | | assign_template(); |
| | | |
| | | $msg['content'] = $content; |
| | | if (is_array($links) && is_array($hrefs)) |
| | | { |
| | | if (!empty($links) && count($links) == count($hrefs)) |
| | | { |
| | | foreach($links as $key =>$val) |
| | | { |
| | | $msg['url_info'][$val] = $hrefs[$key]; |
| | | } |
| | | $msg['back_url'] = $hrefs['0']; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $link = empty($links) ? $GLOBALS['_LANG']['back_up_page'] : $links; |
| | | $href = empty($hrefs) ? 'javascript:history.back()' : $hrefs; |
| | | $msg['url_info'][$link] = $href; |
| | | $msg['back_url'] = $href; |
| | | } |
| | | |
| | | $msg['type'] = $type; |
| | | $position = assign_ur_here(0, $GLOBALS['_LANG']['sys_msg']); |
| | | $GLOBALS['smarty']->assign('page_title', $position['title']); // 页面标题 |
| | | $GLOBALS['smarty']->assign('ur_here', $position['ur_here']); // 当前位置 |
| | | |
| | | if (is_null($GLOBALS['smarty']->get_template_vars('helps'))) |
| | | { |
| | | $GLOBALS['smarty']->assign('helps', get_shop_help()); // 网店帮助 |
| | | } |
| | | |
| | | $GLOBALS['smarty']->assign('auto_redirect', $auto_redirect); |
| | | $GLOBALS['smarty']->assign('message', $msg); |
| | | $GLOBALS['smarty']->display('message.dwt'); |
| | | |
| | | exit; |
| | | } |
| | | |
| | | /** |
| | | * 将一个形如+10, 10, -10, 10%的字串转换为相应数字,并返回操作符号 |
| | | * |
| | | * @access public |
| | | * @param string str 要格式化的数据 |
| | | * @param char operate 操作符号,只能返回‘+’或‘*’; |
| | | * @return float value 浮点数 |
| | | */ |
| | | function parse_rate_value($str, &$operate) |
| | | { |
| | | $operate = '+'; |
| | | $is_rate = false; |
| | | |
| | | $str = trim($str); |
| | | if (empty($str)) |
| | | { |
| | | return 0; |
| | | } |
| | | if ($str[strlen($str) - 1] == '%') |
| | | { |
| | | $value = floatval($str); |
| | | if ($value > 0) |
| | | { |
| | | $operate = '*'; |
| | | |
| | | return $value / 100; |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return floatval($str); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 重新计算购物车中的商品价格:目的是当用户登录时享受会员价格,当用户退出登录时不享受会员价格 |
| | | * 如果商品有促销,价格不变 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function recalculate_price() |
| | | { |
| | | /* 取得有可能改变价格的商品:除配件和赠品之外的商品 */ |
| | | $sql = 'SELECT c.rec_id, c.goods_id, c.goods_attr_id, g.promote_price, g.promote_start_date, c.goods_number,'. |
| | | "g.promote_end_date, IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS member_price ". |
| | | 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c '. |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = c.goods_id '. |
| | | "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". |
| | | "ON mp.goods_id = g.goods_id AND mp.user_rank = '" . $_SESSION['user_rank'] . "' ". |
| | | "WHERE session_id = '" .SESS_ID. "' AND c.parent_id = 0 AND c.is_gift = 0 AND c.goods_id > 0 " . |
| | | "AND c.rec_type = '" . CART_GENERAL_GOODS . "' AND c.extension_code <> 'package_buy'"; |
| | | |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | foreach ($res AS $row) |
| | | { |
| | | $attr_id = empty($row['goods_attr_id']) ? array() : explode(',', $row['goods_attr_id']); |
| | | |
| | | |
| | | $goods_price = get_final_price($row['goods_id'], $row['goods_number'], true, $attr_id); |
| | | |
| | | |
| | | $goods_sql = "UPDATE " .$GLOBALS['ecs']->table('cart'). " SET goods_price = '$goods_price' ". |
| | | "WHERE goods_id = '" . $row['goods_id'] . "' AND session_id = '" . SESS_ID . "' AND rec_id = '" . $row['rec_id'] . "'"; |
| | | |
| | | $GLOBALS['db']->query($goods_sql); |
| | | } |
| | | |
| | | /* 代码增加_start By */ |
| | | $time1=local_strtotime('today'); |
| | | $time2=local_strtotime('today') + 86400; |
| | | $sql = "select rec_id,goods_id,goods_attr,goods_number ". |
| | | " from ".$GLOBALS['ecs']->table('cart') ." where user_id=0 ". |
| | | " AND session_id = '" .SESS_ID. "' AND parent_id = 0 ". |
| | | " AND is_gift = 0 AND goods_id > 0 " . |
| | | "AND rec_type = '" . CART_GENERAL_GOODS . "' AND extension_code <> 'package_buy' "; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $sql = "select rec_id from ".$GLOBALS['ecs']->table('cart')." where user_id='". $_SESSION['user_id'] ."' ". |
| | | " AND add_time >='$time1' and add_time<'$time2' ". |
| | | " AND goods_id='$row[goods_id]' and goods_attr= '$row[goods_attr]' "; |
| | | $rec_id = $GLOBALS['db']->getOne($sql); |
| | | if($rec_id) |
| | | { |
| | | $sql = "update ".$GLOBALS['ecs']->table('cart')." set goods_number= goods_number + ".$row['goods_number']. |
| | | " where rec_id='$rec_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | $sql="delete from ".$GLOBALS['ecs']->table('cart')." where rec_id='".$row['rec_id']."'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $sql = "update ".$GLOBALS['ecs']->table('cart')." set user_id='$_SESSION[user_id]' ". |
| | | " where rec_id='".$row['rec_id']."'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | } |
| | | /* 代码增加_end By */ |
| | | |
| | | /* 删除赠品,重新选择 */ |
| | | $GLOBALS['db']->query('DELETE FROM ' . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "' AND is_gift > 0"); |
| | | } |
| | | |
| | | /** |
| | | * 将 assign_comment 函数整个替换掉 By * 查询评论内容 |
| | | * |
| | | * @access public |
| | | * @params integer $id |
| | | * @params integer $type |
| | | * @params integer $page |
| | | * @return array |
| | | */ |
| | | function assign_comment($id, $type, $page = 1,$comment_level=0) |
| | | { |
| | | /* 取得评论列表 */ |
| | | if ($comment_level == '1') |
| | | { |
| | | $sql_comment=" AND comment_rank in ('4', '5') "; |
| | | } |
| | | elseif ($comment_level == '2') |
| | | { |
| | | $sql_comment=" AND comment_rank in ('3', '2') "; |
| | | } |
| | | elseif ($comment_level == '3') |
| | | { |
| | | $sql_comment=" AND comment_rank in ('1') "; |
| | | }else{ |
| | | $sql_comment=" "; |
| | | } |
| | | |
| | | $count = $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('comment'). |
| | | " WHERE id_value = '$id' AND comment_type = '$type' AND status = 1 AND parent_id = 0 $sql_comment "); |
| | | $size = !empty($GLOBALS['_CFG']['comments_number']) ? $GLOBALS['_CFG']['comments_number'] : 5; |
| | | |
| | | $page_count = ($count > 0) ? intval(ceil($count / $size)) : 1; |
| | | |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('comment') . |
| | | " WHERE id_value = '$id' AND comment_type = '$type' AND status = 1 AND parent_id = 0 $sql_comment ". |
| | | ' ORDER BY comment_id DESC'; |
| | | $res = $GLOBALS['db']->selectLimit($sql, $size, ($page-1) * $size); |
| | | |
| | | $arr = array(); |
| | | $ids = ''; |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $ids .= $ids ? ",$row[comment_id]" : $row['comment_id']; |
| | | $arr[$row['comment_id']]['id'] = $row['comment_id']; |
| | | $arr[$row['comment_id']]['email'] = $row['email']; |
| | | $arr[$row['comment_id']]['username'] = $row['user_name']; |
| | | $arr[$row['comment_id']]['title'] = $row['title']; |
| | | $arr[$row['comment_id']]['content'] = str_replace('\r\n', '<br />', htmlspecialchars($row['content'])); |
| | | $arr[$row['comment_id']]['content'] = nl2br(str_replace('\n', '<br />', $arr[$row['comment_id']]['content'])); |
| | | $arr[$row['comment_id']]['rank'] = $row['comment_rank']; |
| | | $arr[$row['comment_id']]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); |
| | | |
| | | /* 会员级别 */ |
| | | $sql_ur = "select user_rank from " . $GLOBALS['ecs']->table('users') . " where user_id = '$row[user_id]' "; |
| | | $userrankid = $GLOBALS['db']->getOne($sql_ur); |
| | | $arr[$row['comment_id']]['userrankid'] = $userrankid ? $userrankid : 0; |
| | | } |
| | | /* 取得已有回复的评论 */ |
| | | if ($ids) |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('comment') . |
| | | " WHERE parent_id IN( $ids )"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetch_array($res)) |
| | | { |
| | | $arr[$row['parent_id']]['re_content'] = nl2br(str_replace('\n', '<br />', htmlspecialchars($row['content']))); |
| | | $arr[$row['parent_id']]['re_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); |
| | | $arr[$row['parent_id']]['re_email'] = $row['email']; |
| | | $arr[$row['parent_id']]['re_username'] = $row['user_name']; |
| | | } |
| | | } |
| | | /* 分页样式 */ |
| | | //$pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0; |
| | | $pager['page'] = $page; |
| | | $pager['size'] = $size; |
| | | $pager['record_count'] = $count; |
| | | $pager['page_count'] = $page_count; |
| | | $pager['page_first'] = "javascript:gotoPage(1,$id,$type,$comment_level)"; |
| | | $pager['page_prev'] = $page > 1 ? "javascript:gotoPage(" .($page-1). ",$id,$type,$comment_level)" : 'javascript:;'; |
| | | $pager['page_next'] = $page < $page_count ? 'javascript:gotoPage(' .($page + 1) . ",$id,$type,$comment_level)" : 'javascript:;'; |
| | | $pager['page_last'] = $page < $page_count ? 'javascript:gotoPage(' .$page_count. ",$id,$type,$comment_level)" : 'javascript:;'; |
| | | |
| | | $cmt = array('comments' => $arr, 'pager' => $pager); |
| | | |
| | | return $cmt; |
| | | } |
| | | |
| | | function assign_template($ctype = '', $catlist = array()) |
| | | { |
| | | global $smarty; |
| | | |
| | | $smarty->assign('image_width', $GLOBALS['_CFG']['image_width']); |
| | | $smarty->assign('image_height', $GLOBALS['_CFG']['image_height']); |
| | | $smarty->assign('points_name', $GLOBALS['_CFG']['integral_name']); |
| | | $smarty->assign('qq', explode(',', $GLOBALS['_CFG']['qq'])); |
| | | $smarty->assign('ww', explode(',', $GLOBALS['_CFG']['ww'])); |
| | | $smarty->assign('ym', explode(',', $GLOBALS['_CFG']['ym'])); |
| | | $smarty->assign('msn', explode(',', $GLOBALS['_CFG']['msn'])); |
| | | $smarty->assign('skype', explode(',', $GLOBALS['_CFG']['skype'])); |
| | | $smarty->assign('stats_code', $GLOBALS['_CFG']['stats_code']); |
| | | $smarty->assign('copyright', sprintf($GLOBALS['_LANG']['copyright'], date('Y'), $GLOBALS['_CFG']['shop_name'])); |
| | | $smarty->assign('shop_name', $GLOBALS['_CFG']['shop_name']); |
| | | $smarty->assign('service_email', $GLOBALS['_CFG']['service_email']); |
| | | $smarty->assign('service_phone', $GLOBALS['_CFG']['service_phone']); |
| | | $smarty->assign('shop_address', $GLOBALS['_CFG']['shop_address']); |
| | | $smarty->assign('licensed', license_info()); |
| | | $smarty->assign('ecs_version', VERSION); |
| | | $smarty->assign('icp_number', $GLOBALS['_CFG']['icp_number']); |
| | | $smarty->assign('username', !empty($_SESSION['user_name']) ? $_SESSION['user_name'] : ''); |
| | | $smarty->assign('category_list', cat_list(0, 0, true, 2, false)); |
| | | $smarty->assign('catalog_list', cat_list(0, 0, false, 1, false)); |
| | | $smarty->assign('navigator_list', get_navigator($ctype, $catlist)); //自定义导航栏 |
| | | |
| | | if (!empty($GLOBALS['_CFG']['search_keywords'])) |
| | | { |
| | | $searchkeywords = explode(',', trim($GLOBALS['_CFG']['search_keywords'])); |
| | | } |
| | | else |
| | | { |
| | | $searchkeywords = array(); |
| | | } |
| | | $smarty->assign('searchkeywords', $searchkeywords); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 将一个本地时间戳转成GMT时间戳 |
| | | * |
| | | * @access public |
| | | * @param int $time |
| | | * |
| | | * @return int $gmt_time; |
| | | */ |
| | | function time2gmt($time) |
| | | { |
| | | return strtotime(gmdate('Y-m-d H:i:s', $time)); |
| | | } |
| | | |
| | | /** |
| | | * 查询会员的红包金额 |
| | | * |
| | | * @access public |
| | | * @param integer $user_id |
| | | * @return void |
| | | */ |
| | | function get_user_bonus($user_id = 0) |
| | | { |
| | | if ($user_id == 0) |
| | | { |
| | | $user_id = $_SESSION['user_id']; |
| | | } |
| | | |
| | | $sql = "SELECT SUM(bt.type_money) AS bonus_value, COUNT(*) AS bonus_count ". |
| | | "FROM " .$GLOBALS['ecs']->table('user_bonus'). " AS ub, ". |
| | | $GLOBALS['ecs']->table('bonus_type') . " AS bt ". |
| | | "WHERE ub.user_id = '$user_id' AND ub.bonus_type_id = bt.type_id AND ub.order_id = 0"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 保存推荐uid |
| | | * |
| | | * @access public |
| | | * @param void |
| | | * |
| | | * @return void |
| | | * @author xuanyan |
| | | **/ |
| | | function set_affiliate() |
| | | { |
| | | $config = unserialize($GLOBALS['_CFG']['affiliate']); |
| | | if (!empty($_GET['u']) && $config['on'] == 1) |
| | | { |
| | | if(!empty($config['config']['expire'])) |
| | | { |
| | | if($config['config']['expire_unit'] == 'hour') |
| | | { |
| | | $c = 1; |
| | | } |
| | | elseif($config['config']['expire_unit'] == 'day') |
| | | { |
| | | $c = 24; |
| | | } |
| | | elseif($config['config']['expire_unit'] == 'week') |
| | | { |
| | | $c = 24 * 7; |
| | | } |
| | | else |
| | | { |
| | | $c = 1; |
| | | } |
| | | setcookie('ecshop_affiliate_uid', intval($_GET['u']), gmtime() + 3600 * $config['config']['expire'] * $c); |
| | | } |
| | | else |
| | | { |
| | | setcookie('ecshop_affiliate_uid', intval($_GET['u']), gmtime() + 3600 * 24); // 过期时间为 1 天 |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取推荐uid |
| | | * |
| | | * @access public |
| | | * @param void |
| | | * |
| | | * @return int |
| | | * @author xuanyan |
| | | **/ |
| | | function get_affiliate() |
| | | { |
| | | if (!empty($_COOKIE['ecshop_affiliate_uid'])) |
| | | { |
| | | $uid = intval($_COOKIE['ecshop_affiliate_uid']); |
| | | if ($GLOBALS['db']->getOne('SELECT user_id FROM ' . $GLOBALS['ecs']->table('users') . "WHERE user_id = '$uid'")) |
| | | { |
| | | return $uid; |
| | | } |
| | | else |
| | | { |
| | | setcookie('ecshop_affiliate_uid', '', 1); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定分类同级的所有分类以及该分类下的子分类 |
| | | * |
| | | * @access public |
| | | * @param integer $cat_id 分类编号 |
| | | * @return array |
| | | */ |
| | | function article_categories_tree($cat_id = 0) |
| | | { |
| | | if ($cat_id > 0) |
| | | { |
| | | $sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('article_cat') . " WHERE cat_id = '$cat_id'"; |
| | | $parent_id = $GLOBALS['db']->getOne($sql); |
| | | } |
| | | else |
| | | { |
| | | $parent_id = 0; |
| | | } |
| | | |
| | | /* |
| | | 判断当前分类中全是是否是底级分类, |
| | | 如果是取出底级分类上级分类, |
| | | 如果不是取当前分类及其下的子分类 |
| | | */ |
| | | $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('article_cat') . " WHERE parent_id = '$parent_id'"; |
| | | if ($GLOBALS['db']->getOne($sql)) |
| | | { |
| | | /* 获取当前分类及其子分类 */ |
| | | $sql = 'SELECT a.cat_id, a.cat_name, a.sort_order AS parent_order, a.cat_id, ' . |
| | | 'b.cat_id AS child_id, b.cat_name AS child_name, b.sort_order AS child_order ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('article_cat') . ' AS a ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS b ON b.parent_id = a.cat_id ' . |
| | | "WHERE a.parent_id = '$parent_id' AND a.cat_type=1 And a.keywords<>'-1' ORDER BY parent_order ASC, a.cat_id ASC, child_order ASC"; |
| | | } |
| | | else |
| | | { |
| | | /* 获取当前分类及其父分类 */ |
| | | $sql = 'SELECT a.cat_id, a.cat_name, b.cat_id AS child_id, b.cat_name AS child_name, b.sort_order ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('article_cat') . ' AS a ' . |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS b ON b.parent_id = a.cat_id ' . |
| | | "WHERE b.parent_id = '$parent_id' AND b.cat_type = 1 ORDER BY sort_order ASC"; |
| | | } |
| | | $res = $GLOBALS['db']->getAll($sql); |
| | | |
| | | $cat_arr = array(); |
| | | foreach ($res AS $row) |
| | | { |
| | | $cat_arr[$row['cat_id']]['id'] = $row['cat_id']; |
| | | $cat_arr[$row['cat_id']]['name'] = $row['cat_name']; |
| | | $cat_arr[$row['cat_id']]['url'] = build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']); |
| | | |
| | | if ($row['child_id'] != NULL) |
| | | { |
| | | $cat_arr[$row['cat_id']]['children'][$row['child_id']]['id'] = $row['child_id']; |
| | | $cat_arr[$row['cat_id']]['children'][$row['child_id']]['name'] = $row['child_name']; |
| | | $cat_arr[$row['cat_id']]['children'][$row['child_id']]['url'] = build_uri('article_cat', array('acid' => $row['child_id']), $row['child_name']); |
| | | } |
| | | } |
| | | |
| | | return $cat_arr; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定文章分类的所有上级分类 |
| | | * |
| | | * @access public |
| | | * @param integer $cat 分类编号 |
| | | * @return array |
| | | */ |
| | | function get_article_parent_cats($cat) |
| | | { |
| | | if ($cat == 0) |
| | | { |
| | | return array(); |
| | | } |
| | | |
| | | $arr = $GLOBALS['db']->GetAll('SELECT cat_id, cat_name, parent_id FROM ' . $GLOBALS['ecs']->table('article_cat')); |
| | | |
| | | if (empty($arr)) |
| | | { |
| | | return array(); |
| | | } |
| | | |
| | | $index = 0; |
| | | $cats = array(); |
| | | |
| | | while (1) |
| | | { |
| | | foreach ($arr AS $row) |
| | | { |
| | | if ($cat == $row['cat_id']) |
| | | { |
| | | $cat = $row['parent_id']; |
| | | |
| | | $cats[$index]['cat_id'] = $row['cat_id']; |
| | | $cats[$index]['cat_name'] = $row['cat_name']; |
| | | |
| | | $index++; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if ($index == 0 || $cat == 0) |
| | | { |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return $cats; |
| | | } |
| | | |
| | | /** |
| | | * 取得某模板某库设置的数量 |
| | | * @param string $template 模板名,如index |
| | | * @param string $library 库名,如recommend_best |
| | | * @param int $def_num 默认数量:如果没有设置模板,显示的数量 |
| | | * @return int 数量 |
| | | */ |
| | | function get_library_number($library, $template = null) |
| | | { |
| | | global $page_libs; |
| | | |
| | | if (empty($template)) |
| | | { |
| | | $template = basename(PHP_SELF); |
| | | $template = substr($template, 0, strrpos($template, '.')); |
| | | } |
| | | $template = addslashes($template); |
| | | |
| | | static $lib_list = array(); |
| | | |
| | | /* 如果没有该模板的信息,取得该模板的信息 */ |
| | | if (!isset($lib_list[$template])) |
| | | { |
| | | $lib_list[$template] = array(); |
| | | $sql = "SELECT library, number FROM " . $GLOBALS['ecs']->table('template') . |
| | | " WHERE theme = '" . $GLOBALS['_CFG']['template'] . "'" . |
| | | " AND filename = '$template' AND remarks='' "; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $lib = basename(strtolower(substr($row['library'], 0, strpos($row['library'], '.')))); |
| | | $lib_list[$template][$lib] = $row['number']; |
| | | } |
| | | } |
| | | |
| | | $num = 0; |
| | | if (isset($lib_list[$template][$library])) |
| | | { |
| | | $num = intval($lib_list[$template][$library]); |
| | | } |
| | | else |
| | | { |
| | | /* 模板设置文件查找默认值 */ |
| | | include_once(ROOT_PATH . ADMIN_PATH . '/includes/lib_template.php'); |
| | | static $static_page_libs = null; |
| | | if ($static_page_libs == null) |
| | | { |
| | | $static_page_libs = $page_libs; |
| | | } |
| | | $lib = '/library/' . $library . '.lbi'; |
| | | |
| | | $num = isset($static_page_libs[$template][$lib]) ? $static_page_libs[$template][$lib] : 3; |
| | | } |
| | | |
| | | return $num; |
| | | } |
| | | |
| | | /** |
| | | * 取得自定义导航栏列表 |
| | | * @param string $type 位置,如top、bottom、middle |
| | | * @return array 列表 |
| | | */ |
| | | function get_navigator($ctype = '', $catlist = array()) |
| | | { |
| | | $sql = 'SELECT * FROM '. $GLOBALS['ecs']->table('nav') . ' |
| | | WHERE ifshow = \'1\' ORDER BY type, vieworder'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $cur_url = substr(strrchr($_SERVER['REQUEST_URI'],'/'),1); |
| | | |
| | | if (intval($GLOBALS['_CFG']['rewrite'])) |
| | | { |
| | | if(strpos($cur_url, '-')) |
| | | { |
| | | preg_match('/([a-z]*)-([0-9]*)/',$cur_url,$matches); |
| | | $cur_url = $matches[1].'.php?id='.$matches[2]; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $cur_url = substr(strrchr($_SERVER['REQUEST_URI'],'/'),1); |
| | | } |
| | | |
| | | $noindex = false; |
| | | $active = 0; |
| | | $navlist = array( |
| | | 'top' => array(), |
| | | 'middle' => array(), |
| | | 'bottom' => array() |
| | | ); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $navlist[$row['type']][] = array( |
| | | 'name' => $row['name'], |
| | | 'opennew' => $row['opennew'], |
| | | 'url' => $row['url'], |
| | | 'ctype' => $row['ctype'], |
| | | 'cid' => $row['cid'], |
| | | ); |
| | | } |
| | | |
| | | /*遍历自定义是否存在currentPage*/ |
| | | foreach($navlist['middle'] as $k=>$v) |
| | | { |
| | | $condition = empty($ctype) ? (strpos($cur_url, $v['url']) === 0) : (strpos($cur_url, $v['url']) === 0 && strlen($cur_url) == strlen($v['url'])); |
| | | if ($condition) |
| | | { |
| | | $navlist['middle'][$k]['active'] = 1; |
| | | $noindex = true; |
| | | $active += 1; |
| | | } |
| | | } |
| | | |
| | | if(!empty($ctype) && $active < 1) |
| | | { |
| | | foreach($catlist as $key => $val) |
| | | { |
| | | foreach($navlist['middle'] as $k=>$v) |
| | | { |
| | | if(!empty($v['ctype']) && $v['ctype'] == $ctype && $v['cid'] == $val && $active < 1) |
| | | { |
| | | $navlist['middle'][$k]['active'] = 1; |
| | | $noindex = true; |
| | | $active += 1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ($noindex == false) { |
| | | $navlist['config']['index'] = 1; |
| | | } |
| | | |
| | | return $navlist; |
| | | } |
| | | |
| | | /** |
| | | * 授权信息内容 |
| | | * |
| | | * @return str |
| | | */ |
| | | function license_info() |
| | | { |
| | | if($GLOBALS['_CFG']['licensed'] > 0) |
| | | { |
| | | /* 获取HOST */ |
| | | if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) |
| | | { |
| | | $host = $_SERVER['HTTP_X_FORWARDED_HOST']; |
| | | } |
| | | elseif (isset($_SERVER['HTTP_HOST'])) |
| | | { |
| | | $host = $_SERVER['HTTP_HOST']; |
| | | } |
| | | $url_domain=url_domain(); |
| | | $host = 'http://' . $host .$url_domain ; |
| | | $license = '<a href="/license.php?product=ecshop_b2c&url=' . urlencode($host) . '" target="_blank" |
| | | > Licensed</a>'; |
| | | return $license; |
| | | } |
| | | else |
| | | { |
| | | return ''; |
| | | } |
| | | } |
| | | function url_domain() |
| | | { |
| | | $curr = strpos(PHP_SELF, ADMIN_PATH . '/') !== false ? |
| | | preg_replace('/(.*)(' . ADMIN_PATH . ')(\/?)(.)*/i', '\1', dirname(PHP_SELF)) : |
| | | dirname(PHP_SELF); |
| | | |
| | | $root = str_replace('\\', '/', $curr); |
| | | |
| | | if (substr($root, -1) != '/') |
| | | { |
| | | $root .= '/'; |
| | | } |
| | | |
| | | return $root; |
| | | } |
| | | |
| | | |
| | | /* 代码增加_start By */ |
| | | /** |
| | | * 查询咨询内容 |
| | | * |
| | | * @access public |
| | | * @params integer $id |
| | | * @params integer $page |
| | | * @return array |
| | | */ |
| | | function assign_question($id, $page = 1, $question_type = 0) |
| | | { |
| | | /* 取得咨询列表 */ |
| | | $count = $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('question'). |
| | | " WHERE id_value = '$id' AND status = 1 AND parent_id = 0 and question_type = '$question_type' "); |
| | | $size = !empty($GLOBALS['_CFG']['comments_number']) ? $GLOBALS['_CFG']['comments_number'] : 5; |
| | | |
| | | $page_count = ($count > 0) ? intval(ceil($count / $size)) : 1; |
| | | |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('question') . |
| | | " WHERE id_value = '$id' AND status = 1 AND parent_id = 0 AND question_type= '$question_type' ". |
| | | ' ORDER BY question_id DESC'; |
| | | $res = $GLOBALS['db']->selectLimit($sql, $size, ($page-1) * $size); |
| | | |
| | | $arr = array(); |
| | | $ids = ''; |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $ids .= $ids ? ",$row[question_id]" : $row['question_id']; |
| | | $arr[$row['question_id']]['id'] = $row['question_id']; |
| | | $arr[$row['question_id']]['email'] = $row['email']; |
| | | $arr[$row['question_id']]['username'] = $row['user_name']; |
| | | $arr[$row['question_id']]['content'] = str_replace('\r\n', '<br />', htmlspecialchars($row['content'])); |
| | | $arr[$row['question_id']]['content'] = nl2br(str_replace('\n', '<br />', $arr[$row['question_id']]['content'])); |
| | | $arr[$row['question_id']]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); |
| | | } |
| | | /* 取得已有回复的咨询 */ |
| | | if ($ids) |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('question') . |
| | | " WHERE parent_id IN( $ids )"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetch_array($res)) |
| | | { |
| | | $arr[$row['parent_id']]['re_content'] = nl2br(str_replace('\n', '<br />', htmlspecialchars($row['content']))); |
| | | $arr[$row['parent_id']]['re_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); |
| | | $arr[$row['parent_id']]['re_email'] = $row['email']; |
| | | $arr[$row['parent_id']]['re_username'] = $row['user_name']; |
| | | } |
| | | } |
| | | /* 分页样式 */ |
| | | //$pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0; |
| | | $pager['page'] = $page; |
| | | $pager['size'] = $size; |
| | | $pager['record_count'] = $count; |
| | | $pager['page_count'] = $page_count; |
| | | $pager['page_first'] = "javascript:gotoPage_question(1,$id, $question_type)"; |
| | | $pager['page_prev'] = $page > 1 ? "javascript:gotoPage_question(" .($page-1). ",$id, $question_type)" : 'javascript:;'; |
| | | $pager['page_next'] = $page < $page_count ? 'javascript:gotoPage_question(' .($page + 1) . ",$id, $question_type)" : 'javascript:;'; |
| | | $pager['page_last'] = $page < $page_count ? 'javascript:gotoPage_question(' .$page_count. ",$id, $question_type)" : 'javascript:;'; |
| | | |
| | | $cmt = array('comments' => $arr, 'pager' => $pager); |
| | | |
| | | return $cmt; |
| | | } |
| | | |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 管理中心公用函数库 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: lib_main.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | /** |
| | | * 获得所有模块的名称以及链接地址 |
| | | * |
| | | * @access public |
| | | * @param string $directory 插件存放的目录 |
| | | * @return array |
| | | */ |
| | | function read_modules($directory = '.') |
| | | { |
| | | global $_LANG; |
| | | |
| | | $dir = @opendir($directory); |
| | | $set_modules = true; |
| | | $modules = array(); |
| | | |
| | | while (false !== ($file = @readdir($dir))) |
| | | { |
| | | if (preg_match("/^.*?\.php$/", $file)) |
| | | { |
| | | include_once($directory. '/' .$file); |
| | | } |
| | | } |
| | | @closedir($dir); |
| | | unset($set_modules); |
| | | |
| | | foreach ($modules AS $key => $value) |
| | | { |
| | | ksort($modules[$key]); |
| | | } |
| | | ksort($modules); |
| | | |
| | | return $modules; |
| | | } |
| | | |
| | | /** |
| | | * 系统提示信息 |
| | | * |
| | | * @access public |
| | | * @param string msg_detail 消息内容 |
| | | * @param int msg_type 消息类型, 0消息,1错误,2询问 |
| | | * @param array links 可选的链接 |
| | | * @param boolen $auto_redirect 是否需要自动跳转 |
| | | * @return void |
| | | */ |
| | | function sys_msg($msg_detail, $msg_type = 0, $links = array(), $auto_redirect = true) |
| | | { |
| | | if (count($links) == 0) |
| | | { |
| | | $links[0]['text'] = $GLOBALS['_LANG']['go_back']; |
| | | $links[0]['href'] = 'javascript:history.go(-1)'; |
| | | } |
| | | |
| | | assign_query_info(); |
| | | |
| | | $GLOBALS['smarty']->assign('ur_here', $GLOBALS['_LANG']['system_message']); |
| | | $GLOBALS['smarty']->assign('msg_detail', $msg_detail); |
| | | $GLOBALS['smarty']->assign('msg_type', $msg_type); |
| | | $GLOBALS['smarty']->assign('links', $links); |
| | | $GLOBALS['smarty']->assign('default_url', $links[0]['href']); |
| | | $GLOBALS['smarty']->assign('auto_redirect', $auto_redirect); |
| | | |
| | | $GLOBALS['smarty']->display('message.htm'); |
| | | |
| | | exit; |
| | | } |
| | | |
| | | /** |
| | | * 记录管理员的操作内容 |
| | | * |
| | | * @access public |
| | | * @param string $sn 数据的唯一值 |
| | | * @param string $action 操作的类型 |
| | | * @param string $content 操作的内容 |
| | | * @return void |
| | | */ |
| | | function admin_log($sn = '', $action, $content) |
| | | { |
| | | $log_info = $GLOBALS['_LANG']['log_action'][$action] . $GLOBALS['_LANG']['log_action'][$content] .': '. addslashes($sn); |
| | | |
| | | $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('admin_log') . ' (log_time, user_id, log_info, ip_address) ' . |
| | | " VALUES ('" . gmtime() . "', $_SESSION[admin_id], '" . stripslashes($log_info) . "', '" . real_ip() . "')"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 将通过表单提交过来的年月日变量合成为"2004-05-10"的格式。 |
| | | * |
| | | * 此函数适用于通过smarty函数html_select_date生成的下拉日期。 |
| | | * |
| | | * @param string $prefix 年月日变量的共同的前缀。 |
| | | * @return date 日期变量。 |
| | | */ |
| | | function sys_joindate($prefix) |
| | | { |
| | | /* 返回年-月-日的日期格式 */ |
| | | $year = empty($_POST[$prefix . 'Year']) ? '0' : $_POST[$prefix . 'Year']; |
| | | $month = empty($_POST[$prefix . 'Month']) ? '0' : $_POST[$prefix . 'Month']; |
| | | $day = empty($_POST[$prefix . 'Day']) ? '0' : $_POST[$prefix . 'Day']; |
| | | |
| | | return $year . '-' . $month . '-' . $day; |
| | | } |
| | | |
| | | /** |
| | | * 设置管理员的session内容 |
| | | * |
| | | * @access public |
| | | * @param integer $user_id 管理员编号 |
| | | * @param string $username 管理员姓名 |
| | | * @param string $action_list 权限列表 |
| | | * @param string $last_time 最后登录时间 |
| | | * @return void |
| | | */ |
| | | function set_admin_session($user_id, $username, $action_list, $last_time) |
| | | { |
| | | $_SESSION['admin_id'] = $user_id; |
| | | $_SESSION['admin_name'] = $username; |
| | | $_SESSION['action_list'] = $action_list; |
| | | $_SESSION['last_check'] = $last_time; // 用于保存最后一次检查订单的时间 |
| | | } |
| | | |
| | | /** |
| | | * 插入一个配置信息 |
| | | * |
| | | * @access public |
| | | * @param string $parent 分组的code |
| | | * @param string $code 该配置信息的唯一标识 |
| | | * @param string $value 该配置信息值 |
| | | * @return void |
| | | */ |
| | | function insert_config($parent, $code, $value) |
| | | { |
| | | global $ecs, $db, $_LANG; |
| | | |
| | | $sql = 'SELECT id FROM ' . $ecs->table('shop_config') . " WHERE code = '$parent' AND type = 1"; |
| | | $parent_id = $db->getOne($sql); |
| | | |
| | | $sql = 'INSERT INTO ' . $ecs->table('shop_config') . ' (parent_id, code, value) ' . |
| | | "VALUES('$parent_id', '$code', '$value')"; |
| | | $db->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 判断管理员对某一个操作是否有权限。 |
| | | * |
| | | * 根据当前对应的action_code,然后再和用户session里面的action_list做匹配,以此来决定是否可以继续执行。 |
| | | * @param string $priv_str 操作对应的priv_str |
| | | * @param string $msg_type 返回的类型 |
| | | * @return true/false |
| | | */ |
| | | function admin_priv($priv_str, $msg_type = '' , $msg_output = true) |
| | | { |
| | | global $_LANG; |
| | | |
| | | if ($_SESSION['action_list'] == 'all') |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (strpos(',' . $_SESSION['action_list'] . ',', ',' . $priv_str . ',') === false) |
| | | { |
| | | $link[] = array('text' => $_LANG['go_back'], 'href' => 'javascript:history.back(-1)'); |
| | | if ( $msg_output) |
| | | { |
| | | sys_msg($_LANG['priv_error'], 0, $link); |
| | | } |
| | | return false; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 检查管理员权限 |
| | | * |
| | | * @access public |
| | | * @param string $authz |
| | | * @return boolean |
| | | */ |
| | | function check_authz($authz) |
| | | { |
| | | return (preg_match('/,*'.$authz.',*/', $_SESSION['action_list']) || $_SESSION['action_list'] == 'all'); |
| | | } |
| | | |
| | | /** |
| | | * 检查管理员权限,返回JSON格式数剧 |
| | | * |
| | | * @access public |
| | | * @param string $authz |
| | | * @return void |
| | | */ |
| | | function check_authz_json($authz) |
| | | { |
| | | if (!check_authz($authz)) |
| | | { |
| | | make_json_error($GLOBALS['_LANG']['priv_error']); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得红包类型数组(用于生成下拉列表) |
| | | * |
| | | * @return array 分类数组 bonus_typeid => bonus_type_name |
| | | */ |
| | | function get_bonus_type() |
| | | { |
| | | $bonus = array(); |
| | | $sql = 'SELECT type_id, type_name, type_money FROM ' . $GLOBALS['ecs']->table('bonus_type') . |
| | | ' WHERE send_type = 3'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $bonus[$row['type_id']] = $row['type_name'].' [' .sprintf($GLOBALS['_CFG']['currency_format'], $row['type_money']).']'; |
| | | } |
| | | |
| | | return $bonus; |
| | | } |
| | | |
| | | /** |
| | | * 取得用户等级数组,按用户级别排序 |
| | | * @param bool $is_special 是否只显示特殊会员组 |
| | | * @return array rank_id=>rank_name |
| | | */ |
| | | function get_rank_list($is_special = false) |
| | | { |
| | | $rank_list = array(); |
| | | $sql = 'SELECT rank_id, rank_name, min_points FROM ' . $GLOBALS['ecs']->table('user_rank'); |
| | | if ($is_special) |
| | | { |
| | | $sql .= ' WHERE special_rank = 1'; |
| | | } |
| | | $sql .= ' ORDER BY min_points'; |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $rank_list[$row['rank_id']] = $row['rank_name']; |
| | | } |
| | | |
| | | return $rank_list; |
| | | } |
| | | |
| | | /** |
| | | * 按等级取得用户列表(用于生成下拉列表) |
| | | * |
| | | * @return array 分类数组 user_id => user_name |
| | | */ |
| | | function get_user_rank($rankid, $where) |
| | | { |
| | | $user_list = array(); |
| | | $sql = 'SELECT user_id, user_name FROM ' . $GLOBALS['ecs']->table('users') . $where. |
| | | ' ORDER BY user_id DESC'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $user_list[$row['user_id']] = $row['user_name']; |
| | | } |
| | | |
| | | return $user_list; |
| | | } |
| | | |
| | | /** |
| | | * 取得广告位置数组(用于生成下拉列表) |
| | | * |
| | | * @return array 分类数组 position_id => position_name |
| | | */ |
| | | function get_position_list() |
| | | { |
| | | $position_list = array(); |
| | | $sql = 'SELECT position_id, position_name, ad_width, ad_height '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('ad_position'); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $position_list[$row['position_id']] = addslashes($row['position_name']). ' [' .$row['ad_width']. 'x' .$row['ad_height']. ']'; |
| | | } |
| | | |
| | | return $position_list; |
| | | } |
| | | |
| | | /** |
| | | * 生成编辑器 |
| | | * @param string input_name 输入框名称 |
| | | * @param string input_value 输入框值 |
| | | */ |
| | | function create_html_editor($input_name, $input_value = '') |
| | | { |
| | | global $smarty; |
| | | |
| | | $editor = new FCKeditor($input_name); |
| | | $editor->BasePath = '../includes/fckeditor/'; |
| | | $editor->ToolbarSet = 'Normal'; |
| | | $editor->Width = '100%'; |
| | | $editor->Height = '320'; |
| | | $editor->Value = $input_value; |
| | | $FCKeditor = $editor->CreateHtml(); |
| | | $smarty->assign('FCKeditor', $FCKeditor); |
| | | } |
| | | |
| | | /** |
| | | * 取得商品列表:用于把商品添加到组合、关联类、赠品类 |
| | | * @param object $filters 过滤条件 |
| | | */ |
| | | function get_goods_list($filter) |
| | | { |
| | | $filter->keyword = json_str_iconv($filter->keyword); |
| | | $where = get_where_sql($filter); // 取得过滤条件 |
| | | |
| | | /* 取得数据 */ |
| | | $sql = 'SELECT goods_id, goods_name, shop_price '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . $where . |
| | | 'LIMIT 50'; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 取得文章列表:用于商品关联文章 |
| | | * @param object $filters 过滤条件 |
| | | */ |
| | | function get_article_list($filter) |
| | | { |
| | | /* 创建数据容器对象 */ |
| | | $ol = new OptionList(); |
| | | |
| | | /* 取得过滤条件 */ |
| | | $where = ' WHERE a.cat_id = c.cat_id AND c.cat_type = 1 '; |
| | | $where .= isset($filter->title) ? " AND a.title LIKE '%" . mysql_like_quote($filter->title) . "%'" : ''; |
| | | |
| | | /* 取得数据 */ |
| | | $sql = 'SELECT a.article_id, a.title '. |
| | | 'FROM ' .$GLOBALS['ecs']->table('article'). ' AS a, ' .$GLOBALS['ecs']->table('article_cat'). ' AS c ' . $where; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $ol->add_option($row['article_id'], $row['title']); |
| | | } |
| | | |
| | | /* 生成列表 */ |
| | | $ol->build_select(); |
| | | } |
| | | |
| | | /** |
| | | * 返回是否 |
| | | * @param int $var 变量 1, 0 |
| | | */ |
| | | function get_yes_no($var) |
| | | { |
| | | return empty($var) ? '<img src="images/no.gif" border="0" />' : '<img src="images/yes.gif" border="0" />'; |
| | | } |
| | | |
| | | /** |
| | | * 生成过滤条件:用于 get_goodslist 和 get_goods_list |
| | | * @param object $filter |
| | | * @return string |
| | | */ |
| | | function get_where_sql($filter) |
| | | { |
| | | $time = date('Y-m-d'); |
| | | |
| | | $where = isset($filter->is_delete) && $filter->is_delete == '1' ? |
| | | ' WHERE is_delete = 1 ' : ' WHERE is_delete = 0 '; |
| | | $where .= (isset($filter->real_goods) && ($filter->real_goods > -1)) ? ' AND is_real = ' . intval($filter->real_goods) : ''; |
| | | $where .= isset($filter->cat_id) && $filter->cat_id > 0 ? ' AND ' . get_children($filter->cat_id) : ''; |
| | | $where .= isset($filter->brand_id) && $filter->brand_id > 0 ? " AND brand_id = '" . $filter->brand_id . "'" : ''; |
| | | $where .= isset($filter->intro_type) && $filter->intro_type != '0' ? ' AND ' . $filter->intro_type . " = '1'" : ''; |
| | | $where .= isset($filter->intro_type) && $filter->intro_type == 'is_promote' ? |
| | | " AND promote_start_date <= '$time' AND promote_end_date >= '$time' " : ''; |
| | | $where .= isset($filter->keyword) && trim($filter->keyword) != '' ? |
| | | " AND (goods_name LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR goods_sn LIKE '%" . mysql_like_quote($filter->keyword) . "%' OR goods_id LIKE '%" . mysql_like_quote($filter->keyword) . "%') " : ''; |
| | | $where .= isset($filter->suppliers_id) && trim($filter->suppliers_id) != '' ? |
| | | " AND (suppliers_id = '" . $filter->suppliers_id . "') " : ''; |
| | | |
| | | $where .= isset($filter->in_ids) ? ' AND goods_id ' . db_create_in($filter->in_ids) : ''; |
| | | $where .= isset($filter->exclude) ? ' AND goods_id NOT ' . db_create_in($filter->exclude) : ''; |
| | | $where .= isset($filter->stock_warning) ? ' AND goods_number <= warn_number' : ''; |
| | | |
| | | return $where; |
| | | } |
| | | |
| | | /** |
| | | * 获取地区列表的函数。 |
| | | * |
| | | * @access public |
| | | * @param int $region_id 上级地区id |
| | | * @return void |
| | | */ |
| | | function area_list($region_id) |
| | | { |
| | | $area_arr = array(); |
| | | |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('region'). |
| | | " WHERE parent_id = '$region_id' ORDER BY region_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $row['type'] = ($row['region_type'] == 0) ? $GLOBALS['_LANG']['country'] : ''; |
| | | $row['type'] .= ($row['region_type'] == 1) ? $GLOBALS['_LANG']['province'] : ''; |
| | | $row['type'] .= ($row['region_type'] == 2) ? $GLOBALS['_LANG']['city'] : ''; |
| | | $row['type'] .= ($row['region_type'] == 3) ? $GLOBALS['_LANG']['cantonal'] : ''; |
| | | |
| | | $area_arr[] = $row; |
| | | } |
| | | |
| | | return $area_arr; |
| | | } |
| | | |
| | | /** |
| | | * 取得图表颜色 |
| | | * |
| | | * @access public |
| | | * @param integer $n 颜色顺序 |
| | | * @return void |
| | | */ |
| | | function chart_color($n) |
| | | { |
| | | /* 随机显示颜色代码 */ |
| | | $arr = array('33FF66', 'FF6600', '3399FF', '009966', 'CC3399', 'FFCC33', '6699CC', 'CC3366', '33FF66', 'FF6600', '3399FF'); |
| | | |
| | | if ($n > 8) |
| | | { |
| | | $n = $n % 8; |
| | | } |
| | | |
| | | return $arr[$n]; |
| | | } |
| | | |
| | | /** |
| | | * 获得商品类型的列表 |
| | | * |
| | | * @access public |
| | | * @param integer $selected 选定的类型编号 |
| | | * @return string |
| | | */ |
| | | function goods_type_list($selected) |
| | | { |
| | | $sql = 'SELECT cat_id, cat_name FROM ' . $GLOBALS['ecs']->table('goods_type') . ' WHERE enabled = 1'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $lst = ''; |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $lst .= "<option value='$row[cat_id]'"; |
| | | $lst .= ($selected == $row['cat_id']) ? ' selected="true"' : ''; |
| | | $lst .= '>' . htmlspecialchars($row['cat_name']). '</option>'; |
| | | } |
| | | |
| | | return $lst; |
| | | } |
| | | |
| | | /** |
| | | * 取得货到付款和非货到付款的支付方式 |
| | | * @return array('is_cod' => '', 'is_not_cod' => '') |
| | | */ |
| | | function get_pay_ids() |
| | | { |
| | | $ids = array('is_cod' => '0', 'is_not_cod' => '0'); |
| | | $sql = 'SELECT pay_id, is_cod FROM ' .$GLOBALS['ecs']->table('payment'). ' WHERE enabled = 1'; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['is_cod']) |
| | | { |
| | | $ids['is_cod'] .= ',' . $row['pay_id']; |
| | | } |
| | | else |
| | | { |
| | | $ids['is_not_cod'] .= ',' . $row['pay_id']; |
| | | } |
| | | } |
| | | |
| | | return $ids; |
| | | } |
| | | |
| | | /** |
| | | * 清空表数据 |
| | | * @param string $table_name 表名称 |
| | | */ |
| | | function truncate_table($table_name) |
| | | { |
| | | $sql = 'TRUNCATE TABLE ' .$GLOBALS['ecs']->table($table_name); |
| | | |
| | | return $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 返回字符集列表数组 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return void |
| | | */ |
| | | function get_charset_list() |
| | | { |
| | | return array( |
| | | 'UTF8' => 'UTF-8', |
| | | 'GB2312' => 'GB2312/GBK', |
| | | 'BIG5' => 'BIG5', |
| | | ); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 创建一个JSON格式的数据 |
| | | * |
| | | * @access public |
| | | * @param string $content |
| | | * @param integer $error |
| | | * @param string $message |
| | | * @param array $append |
| | | * @return void |
| | | */ |
| | | function make_json_response($content='', $error="0", $message='', $append=array()) |
| | | { |
| | | include_once(ROOT_PATH . 'includes/cls_json.php'); |
| | | |
| | | $json = new JSON; |
| | | |
| | | $res = array('error' => $error, 'message' => $message, 'content' => $content); |
| | | |
| | | if (!empty($append)) |
| | | { |
| | | foreach ($append AS $key => $val) |
| | | { |
| | | $res[$key] = $val; |
| | | } |
| | | } |
| | | |
| | | $val = $json->encode($res); |
| | | |
| | | exit($val); |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * |
| | | * @access public |
| | | * @param |
| | | * @return void |
| | | */ |
| | | function make_json_result($content, $message='', $append=array()) |
| | | { |
| | | make_json_response($content, 0, $message, $append); |
| | | } |
| | | |
| | | /** |
| | | * 创建一个JSON格式的错误信息 |
| | | * |
| | | * @access public |
| | | * @param string $msg |
| | | * @return void |
| | | */ |
| | | function make_json_error($msg) |
| | | { |
| | | make_json_response('', 1, $msg); |
| | | } |
| | | |
| | | /** |
| | | * 根据过滤条件获得排序的标记 |
| | | * |
| | | * @access public |
| | | * @param array $filter |
| | | * @return array |
| | | */ |
| | | function sort_flag($filter) |
| | | { |
| | | $flag['tag'] = 'sort_' . preg_replace('/^.*\./', '', $filter['sort_by']); |
| | | $flag['img'] = '<img src="images/' . ($filter['sort_order'] == "DESC" ? 'sort_desc.gif' : 'sort_asc.gif') . '"/>'; |
| | | |
| | | return $flag; |
| | | } |
| | | |
| | | /** |
| | | * 分页的信息加入条件的数组 |
| | | * |
| | | * @access public |
| | | * @return array |
| | | */ |
| | | function page_and_size($filter) |
| | | { |
| | | if (isset($_REQUEST['page_size']) && intval($_REQUEST['page_size']) > 0) |
| | | { |
| | | $filter['page_size'] = intval($_REQUEST['page_size']); |
| | | } |
| | | elseif (isset($_COOKIE['ECSCP']['page_size']) && intval($_COOKIE['ECSCP']['page_size']) > 0) |
| | | { |
| | | $filter['page_size'] = intval($_COOKIE['ECSCP']['page_size']); |
| | | } |
| | | else |
| | | { |
| | | $filter['page_size'] = 15; |
| | | } |
| | | |
| | | /* 每页显示 */ |
| | | $filter['page'] = (empty($_REQUEST['page']) || intval($_REQUEST['page']) <= 0) ? 1 : intval($_REQUEST['page']); |
| | | |
| | | /* page 总数 */ |
| | | $filter['page_count'] = (!empty($filter['record_count']) && $filter['record_count'] > 0) ? ceil($filter['record_count'] / $filter['page_size']) : 1; |
| | | |
| | | /* 边界处理 */ |
| | | if ($filter['page'] > $filter['page_count']) |
| | | { |
| | | $filter['page'] = $filter['page_count']; |
| | | } |
| | | |
| | | $filter['start'] = ($filter['page'] - 1) * $filter['page_size']; |
| | | |
| | | return $filter; |
| | | } |
| | | |
| | | /** |
| | | * 将含有单位的数字转成字节 |
| | | * |
| | | * @access public |
| | | * @param string $val 带单位的数字 |
| | | * |
| | | * @return int $val |
| | | */ |
| | | function return_bytes($val) |
| | | { |
| | | $val = trim($val); |
| | | $last = strtolower($val{strlen($val)-1}); |
| | | switch($last) |
| | | { |
| | | case 'g': |
| | | $val *= 1024; |
| | | case 'm': |
| | | $val *= 1024; |
| | | case 'k': |
| | | $val *= 1024; |
| | | } |
| | | |
| | | return $val; |
| | | } |
| | | |
| | | /** |
| | | * 获得指定的商品类型下所有的属性分组 |
| | | * |
| | | * @param integer $cat_id 商品类型ID |
| | | * |
| | | * @return array |
| | | */ |
| | | function get_attr_groups($cat_id) |
| | | { |
| | | $sql = "SELECT attr_group FROM " . $GLOBALS['ecs']->table('goods_type') . " WHERE cat_id='$cat_id'"; |
| | | $grp = str_replace("\r", '', $GLOBALS['db']->getOne($sql)); |
| | | |
| | | if ($grp) |
| | | { |
| | | return explode("\n", $grp); |
| | | } |
| | | else |
| | | { |
| | | return array(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成链接后缀 |
| | | */ |
| | | function list_link_postfix() |
| | | { |
| | | return 'uselastfilter=1'; |
| | | } |
| | | |
| | | /** |
| | | * 保存过滤条件 |
| | | * @param array $filter 过滤条件 |
| | | * @param string $sql 查询语句 |
| | | * @param string $param_str 参数字符串,由list函数的参数组成 |
| | | */ |
| | | function set_filter($filter, $sql, $param_str = '') |
| | | { |
| | | $filterfile = basename(PHP_SELF, '.php'); |
| | | if ($param_str) |
| | | { |
| | | $filterfile .= $param_str; |
| | | } |
| | | setcookie('ECSCP[lastfilterfile]', sprintf('%X', crc32($filterfile)), time() + 600); |
| | | setcookie('ECSCP[lastfilter]', urlencode(serialize($filter)), time() + 600); |
| | | setcookie('ECSCP[lastfiltersql]', base64_encode($sql), time() + 600); |
| | | } |
| | | |
| | | /** |
| | | * 取得上次的过滤条件 |
| | | * @param string $param_str 参数字符串,由list函数的参数组成 |
| | | * @return 如果有,返回array('filter' => $filter, 'sql' => $sql);否则返回false |
| | | */ |
| | | function get_filter($param_str = '') |
| | | { |
| | | $filterfile = basename(PHP_SELF, '.php'); |
| | | if ($param_str) |
| | | { |
| | | $filterfile .= $param_str; |
| | | } |
| | | if (isset($_GET['uselastfilter']) && isset($_COOKIE['ECSCP']['lastfilterfile']) |
| | | && $_COOKIE['ECSCP']['lastfilterfile'] == sprintf('%X', crc32($filterfile))) |
| | | { |
| | | return array( |
| | | 'filter' => unserialize(urldecode($_COOKIE['ECSCP']['lastfilter'])), |
| | | 'sql' => base64_decode($_COOKIE['ECSCP']['lastfiltersql']) |
| | | ); |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * URL过滤 |
| | | * @param string $url 参数字符串,一个urld地址,对url地址进行校正 |
| | | * @return 返回校正过的url; |
| | | */ |
| | | function sanitize_url($url , $check = 'http://') |
| | | { |
| | | if (strpos( $url, $check ) === false) |
| | | { |
| | | $url = $check . $url; |
| | | } |
| | | return $url; |
| | | } |
| | | |
| | | /** |
| | | * 检查分类是否已经存在 |
| | | * |
| | | * @param string $cat_name 分类名称 |
| | | * @param integer $parent_cat 上级分类 |
| | | * @param integer $exclude 排除的分类ID |
| | | * |
| | | * @return boolean |
| | | */ |
| | | function cat_exists($cat_name, $parent_cat, $exclude = 0) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('category'). |
| | | " WHERE parent_id = '$parent_cat' AND cat_name = '$cat_name' AND cat_id<>'$exclude'"; |
| | | return ($GLOBALS['db']->getOne($sql) > 0) ? true : false; |
| | | } |
| | | |
| | | function brand_exists($brand_name) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('brand'). |
| | | " WHERE brand_name = '" . $brand_name . "'"; |
| | | return ($GLOBALS['db']->getOne($sql) > 0) ? true : false; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前管理员信息 |
| | | * |
| | | * @access public |
| | | * @param |
| | | * |
| | | * @return Array |
| | | */ |
| | | function admin_info() |
| | | { |
| | | $sql = "SELECT * FROM ". $GLOBALS['ecs']->table('admin_user')." |
| | | WHERE user_id = '$_SESSION[admin_id]' |
| | | LIMIT 0, 1"; |
| | | $admin_info = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (empty($admin_info)) |
| | | { |
| | | return $admin_info = array(); |
| | | } |
| | | |
| | | return $admin_info; |
| | | } |
| | | |
| | | /** |
| | | * 供货商列表信息 |
| | | * |
| | | * @param string $conditions |
| | | * @return array |
| | | */ |
| | | function suppliers_list_info($conditions = '') |
| | | { |
| | | $where = ''; |
| | | if (!empty($conditions)) |
| | | { |
| | | $where .= 'WHERE '; |
| | | $where .= $conditions; |
| | | } |
| | | |
| | | /* 查询 */ |
| | | $sql = "SELECT suppliers_id, suppliers_name, suppliers_desc |
| | | FROM " . $GLOBALS['ecs']->table("suppliers") . " |
| | | $where"; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 供货商名 |
| | | * |
| | | * @return array |
| | | */ |
| | | function suppliers_list_name() |
| | | { |
| | | /* 查询 */ |
| | | $suppliers_list = suppliers_list_info(' is_check = 1 '); |
| | | |
| | | /* 供货商名字 */ |
| | | $suppliers_name = array(); |
| | | if (count($suppliers_list) > 0) |
| | | { |
| | | foreach ($suppliers_list as $suppliers) |
| | | { |
| | | $suppliers_name[$suppliers['suppliers_id']] = $suppliers['suppliers_name']; |
| | | } |
| | | } |
| | | |
| | | return $suppliers_name; |
| | | } |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 购物流程函数库 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: lib_order.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | /** |
| | | * 处理序列化的支付、配送的配置参数 |
| | | * 返回一个以name为索引的数组 |
| | | * |
| | | * @access public |
| | | * @param string $cfg |
| | | * @return void |
| | | */ |
| | | function unserialize_config($cfg) |
| | | { |
| | | if (is_string($cfg) && ($arr = unserialize($cfg)) !== false) |
| | | { |
| | | $config = array(); |
| | | |
| | | foreach ($arr AS $key => $val) |
| | | { |
| | | $config[$val['name']] = $val['value']; |
| | | } |
| | | |
| | | return $config; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | /** |
| | | * 取得已安装的配送方式 |
| | | * @return array 已安装的配送方式 |
| | | */ |
| | | function shipping_list() |
| | | { |
| | | $sql = 'SELECT shipping_id, shipping_name ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('shipping') . |
| | | ' WHERE enabled = 1'; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得配送方式信息 |
| | | * @param int $shipping_id 配送方式id |
| | | * @return array 配送方式信息 |
| | | */ |
| | | function shipping_info($shipping_id) |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('shipping') . |
| | | " WHERE shipping_id = '$shipping_id' " . |
| | | 'AND enabled = 1'; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得可用的配送方式列表 |
| | | * @param array $region_id_list 收货人地区id数组(包括国家、省、市、区) |
| | | * @return array 配送方式数组 |
| | | */ |
| | | function available_shipping_list($region_id_list) |
| | | { |
| | | $sql = 'SELECT s.shipping_id, s.shipping_code, s.shipping_name, ' . |
| | | 's.shipping_desc, s.insure, s.support_cod, a.configure , s.support_pickup ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('shipping') . ' AS s, ' . |
| | | $GLOBALS['ecs']->table('shipping_area') . ' AS a, ' . |
| | | $GLOBALS['ecs']->table('area_region') . ' AS r ' . |
| | | 'WHERE r.region_id ' . db_create_in($region_id_list) . |
| | | ' AND r.shipping_area_id = a.shipping_area_id AND a.shipping_id = s.shipping_id AND s.enabled = 1 ORDER BY s.shipping_order'; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得某配送方式对应于某收货地址的区域信息 |
| | | * @param int $shipping_id 配送方式id |
| | | * @param array $region_id_list 收货人地区id数组 |
| | | * @return array 配送区域信息(config 对应着反序列化的 configure) |
| | | */ |
| | | function shipping_area_info($shipping_id, $region_id_list) |
| | | { |
| | | $sql = 'SELECT s.shipping_code, s.shipping_name, ' . |
| | | 's.shipping_desc, s.insure, s.support_cod, a.configure ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('shipping') . ' AS s, ' . |
| | | $GLOBALS['ecs']->table('shipping_area') . ' AS a, ' . |
| | | $GLOBALS['ecs']->table('area_region') . ' AS r ' . |
| | | "WHERE s.shipping_id = '$shipping_id' " . |
| | | 'AND r.region_id ' . db_create_in($region_id_list) . |
| | | ' AND r.shipping_area_id = a.shipping_area_id AND a.shipping_id = s.shipping_id AND s.enabled = 1'; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (!empty($row)) |
| | | { |
| | | $shipping_config = unserialize_config($row['configure']); |
| | | if (isset($shipping_config['pay_fee'])) |
| | | { |
| | | if (strpos($shipping_config['pay_fee'], '%') !== false) |
| | | { |
| | | $row['pay_fee'] = floatval($shipping_config['pay_fee']) . '%'; |
| | | } |
| | | else |
| | | { |
| | | $row['pay_fee'] = floatval($shipping_config['pay_fee']); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $row['pay_fee'] = 0.00; |
| | | } |
| | | } |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 计算运费 |
| | | * @param string $shipping_code 配送方式代码 |
| | | * @param mix $shipping_config 配送方式配置信息 |
| | | * @param float $goods_weight 商品重量 |
| | | * @param float $goods_amount 商品金额 |
| | | * @param float $goods_number 商品数量 |
| | | * @return float 运费 |
| | | */ |
| | | function shipping_fee($shipping_code, $shipping_config, $goods_weight, $goods_amount, $goods_number='') |
| | | { |
| | | if (!is_array($shipping_config)) |
| | | { |
| | | $shipping_config = unserialize($shipping_config); |
| | | } |
| | | |
| | | $filename = ROOT_PATH . 'includes/modules/shipping/' . $shipping_code . '.php'; |
| | | if (file_exists($filename)) |
| | | { |
| | | include_once($filename); |
| | | |
| | | $obj = new $shipping_code($shipping_config); |
| | | |
| | | return $obj->calculate($goods_weight, $goods_amount, $goods_number); |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取指定配送的保价费用 |
| | | * |
| | | * @access public |
| | | * @param string $shipping_code 配送方式的code |
| | | * @param float $goods_amount 保价金额 |
| | | * @param mix $insure 保价比例 |
| | | * @return float |
| | | */ |
| | | function shipping_insure_fee($shipping_code, $goods_amount, $insure) |
| | | { |
| | | if (strpos($insure, '%') === false) |
| | | { |
| | | /* 如果保价费用不是百分比则直接返回该数值 */ |
| | | return floatval($insure); |
| | | } |
| | | else |
| | | { |
| | | $path = ROOT_PATH . 'includes/modules/shipping/' . $shipping_code . '.php'; |
| | | |
| | | if (file_exists($path)) |
| | | { |
| | | include_once($path); |
| | | |
| | | $shipping = new $shipping_code; |
| | | $insure = floatval($insure) / 100; |
| | | |
| | | if (method_exists($shipping, 'calculate_insure')) |
| | | { |
| | | return $shipping->calculate_insure($goods_amount, $insure); |
| | | } |
| | | else |
| | | { |
| | | return ceil($goods_amount * $insure); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得已安装的支付方式列表 |
| | | * @return array 已安装的配送方式列表 |
| | | */ |
| | | function payment_list() |
| | | { |
| | | $sql = 'SELECT pay_id, pay_name ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('payment') . |
| | | ' WHERE enabled = 1'; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得支付方式信息 |
| | | * @param int $pay_id 支付方式id |
| | | * @return array 支付方式信息 |
| | | */ |
| | | function payment_info($pay_id) |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('payment') . |
| | | " WHERE pay_id = '$pay_id' AND enabled = 1"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 获得订单需要支付的支付费用 |
| | | * |
| | | * @access public |
| | | * @param integer $payment_id |
| | | * @param float $order_amount |
| | | * @param mix $cod_fee |
| | | * @return float |
| | | */ |
| | | function pay_fee($payment_id, $order_amount, $cod_fee=null) |
| | | { |
| | | $pay_fee = 0; |
| | | $payment = payment_info($payment_id); |
| | | $rate = ($payment['is_cod'] && !is_null($cod_fee)) ? $cod_fee : $payment['pay_fee']; |
| | | |
| | | if (strpos($rate, '%') !== false) |
| | | { |
| | | /* 支付费用是一个比例 */ |
| | | $val = floatval($rate) / 100; |
| | | $pay_fee = $val > 0 ? $order_amount * $val /(1- $val) : 0; |
| | | } |
| | | else |
| | | { |
| | | $pay_fee = floatval($rate); |
| | | } |
| | | |
| | | return round($pay_fee, 2); |
| | | } |
| | | |
| | | /** |
| | | * 取得可用的支付方式列表 |
| | | * @param bool $support_cod 配送方式是否支持货到付款 |
| | | * @param int $cod_fee 货到付款手续费(当配送方式支持货到付款时才传此参数) |
| | | * @param int $is_online 是否支持在线支付 |
| | | * @return array 配送方式数组 |
| | | */ |
| | | function available_payment_list($support_cod, $cod_fee = 0, $is_online = false) |
| | | { |
| | | $sql = 'SELECT pay_id, pay_code, pay_name, pay_fee, pay_desc, pay_config, is_cod' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('payment') . |
| | | ' WHERE enabled = 1 '; |
| | | if (!$support_cod) |
| | | { |
| | | $sql .= 'AND is_cod = 0 '; // 如果不支持货到付款 |
| | | } |
| | | if ($is_online) |
| | | { |
| | | $sql .= "AND is_online = '1' "; |
| | | } |
| | | $sql .= 'ORDER BY pay_order'; // 排序 |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $pay_list = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['is_cod'] == '1') |
| | | { |
| | | $row['pay_fee'] = $cod_fee; |
| | | } |
| | | |
| | | $row['format_pay_fee'] = strpos($row['pay_fee'], '%') !== false ? $row['pay_fee'] : |
| | | price_format($row['pay_fee'], false); |
| | | $modules[] = $row; |
| | | } |
| | | |
| | | //include_once(ROOT_PATH.'includes/lib_compositor.php'); |
| | | |
| | | if(isset($modules)) |
| | | { |
| | | return $modules; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得包装列表 |
| | | * @return array 包装列表 |
| | | */ |
| | | function pack_list() |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('pack'); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $list = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $row['format_pack_fee'] = price_format($row['pack_fee'], false); |
| | | $row['format_free_money'] = price_format($row['free_money'], false); |
| | | $list[] = $row; |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 取得包装信息 |
| | | * @param int $pack_id 包装id |
| | | * @return array 包装信息 |
| | | */ |
| | | function pack_info($pack_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('pack') . |
| | | " WHERE pack_id = '$pack_id'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单中的商品总额来获得包装的费用 |
| | | * |
| | | * @access public |
| | | * @param integer $pack_id |
| | | * @param float $goods_amount |
| | | * @return float |
| | | */ |
| | | function pack_fee($pack_id, $goods_amount) |
| | | { |
| | | $pack = pack_info($pack_id); |
| | | |
| | | $val = (floatval($pack['free_money']) <= $goods_amount && $pack['free_money'] > 0) ? 0 : floatval($pack['pack_fee']); |
| | | |
| | | return $val; |
| | | } |
| | | |
| | | /** |
| | | * 取得贺卡列表 |
| | | * @return array 贺卡列表 |
| | | */ |
| | | function card_list() |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('card'); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $list = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $row['format_card_fee'] = price_format($row['card_fee'], false); |
| | | $row['format_free_money'] = price_format($row['free_money'], false); |
| | | $list[] = $row; |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 取得贺卡信息 |
| | | * @param int $card_id 贺卡id |
| | | * @return array 贺卡信息 |
| | | */ |
| | | function card_info($card_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('card') . |
| | | " WHERE card_id = '$card_id'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单中商品总额获得需要支付的贺卡费用 |
| | | * |
| | | * @access public |
| | | * @param integer $card_id |
| | | * @param float $goods_amount |
| | | * @return float |
| | | */ |
| | | function card_fee($card_id, $goods_amount) |
| | | { |
| | | $card = card_info($card_id); |
| | | |
| | | return ($card['free_money'] <= $goods_amount && $card['free_money'] > 0) ? 0 : $card['card_fee']; |
| | | } |
| | | |
| | | /** |
| | | * 取得订单信息 |
| | | * @param int $order_id 订单id(如果order_id > 0 就按id查,否则按sn查) |
| | | * @param string $order_sn 订单号 |
| | | * @return array 订单信息(金额都有相应格式化的字段,前缀是formated_) |
| | | */ |
| | | function order_info($order_id, $order_sn = '') |
| | | { |
| | | /* 计算订单各种费用之和的语句 */ |
| | | $total_fee = " (goods_amount - discount + tax + shipping_fee + insure_fee + pay_fee + pack_fee + card_fee) AS total_fee "; |
| | | $order_id = intval($order_id); |
| | | if ($order_id > 0) |
| | | { |
| | | $sql = "SELECT *, " . $total_fee . " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_id = '$order_id'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT *, " . $total_fee . " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_sn = '$order_sn'"; |
| | | } |
| | | $order = $GLOBALS['db']->getRow($sql); |
| | | |
| | | /* 格式化金额字段 */ |
| | | if ($order) |
| | | { |
| | | $order['formated_goods_amount'] = price_format($order['goods_amount'], false); |
| | | $order['formated_discount'] = price_format($order['discount'], false); |
| | | $order['formated_tax'] = price_format($order['tax'], false); |
| | | $order['formated_shipping_fee'] = price_format($order['shipping_fee'], false); |
| | | $order['formated_insure_fee'] = price_format($order['insure_fee'], false); |
| | | $order['formated_pay_fee'] = price_format($order['pay_fee'], false); |
| | | $order['formated_pack_fee'] = price_format($order['pack_fee'], false); |
| | | $order['formated_card_fee'] = price_format($order['card_fee'], false); |
| | | $order['formated_total_fee'] = price_format($order['total_fee'], false); |
| | | $order['formated_money_paid'] = price_format($order['money_paid'], false); |
| | | $order['formated_bonus'] = price_format($order['bonus'], false); |
| | | $order['formated_integral_money'] = price_format($order['integral_money'], false); |
| | | $order['formated_surplus'] = price_format($order['surplus'], false); |
| | | $order['formated_order_amount'] = price_format(abs($order['order_amount']), false); |
| | | $order['formated_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $order['add_time']); |
| | | } |
| | | |
| | | return $order; |
| | | } |
| | | |
| | | /** |
| | | * 判断订单是否已完成 |
| | | * @param array $order 订单信息 |
| | | * @return bool |
| | | */ |
| | | function order_finished($order) |
| | | { |
| | | return $order['order_status'] == OS_CONFIRMED && |
| | | ($order['shipping_status'] == SS_SHIPPED || $order['shipping_status'] == SS_RECEIVED) && |
| | | ($order['pay_status'] == PS_PAYED || $order['pay_status'] == PS_PAYING); |
| | | } |
| | | |
| | | /** |
| | | * 取得订单商品 |
| | | * @param int $order_id 订单id |
| | | * @return array 订单商品数组 |
| | | */ |
| | | function order_goods($order_id) |
| | | { |
| | | $sql = "SELECT rec_id, og.goods_id, og.goods_name, g.goods_thumb, og.goods_sn, og.market_price, og.goods_number, " . |
| | | "og.goods_price, og.goods_attr, og.is_real, og.parent_id, og.is_gift, " . |
| | | "og.goods_price * og.goods_number AS subtotal, og.extension_code, package_attr_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . "as og right join" . $GLOBALS['ecs']->table('goods') . |
| | | "as g on og.goods_id = g.goods_id" . |
| | | " WHERE order_id = '$order_id'";// 修改 by 增加 package_attr_id 字段 |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['extension_code'] == 'package_buy') |
| | | { |
| | | $row['package_goods_list'] = get_package_goods($row['goods_id'], $row['package_attr_id']); // 修改 by |
| | | } |
| | | $goods_list[] = $row; |
| | | } |
| | | |
| | | //return $GLOBALS['db']->getAll($sql); |
| | | return $goods_list; |
| | | } |
| | | |
| | | /** |
| | | * 取得订单总金额 |
| | | * @param int $order_id 订单id |
| | | * @param bool $include_gift 是否包括赠品 |
| | | * @return float 订单总金额 |
| | | */ |
| | | function order_amount($order_id, $include_gift = true) |
| | | { |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id'"; |
| | | if (!$include_gift) |
| | | { |
| | | $sql .= " AND is_gift = 0"; |
| | | } |
| | | |
| | | return floatval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 取得某订单商品总重量和总金额(对应 cart_weight_price) |
| | | * @param int $order_id 订单id |
| | | * @return array ('weight' => **, 'amount' => **, 'formated_weight' => **) |
| | | */ |
| | | function order_weight_price($order_id) |
| | | { |
| | | $sql = "SELECT SUM(g.goods_weight * o.goods_number) AS weight, " . |
| | | "SUM(o.goods_price * o.goods_number) AS amount ," . |
| | | "SUM(o.goods_number) AS number " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS o, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE o.order_id = '$order_id' " . |
| | | "AND o.goods_id = g.goods_id"; |
| | | |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $row['weight'] = floatval($row['weight']); |
| | | $row['amount'] = floatval($row['amount']); |
| | | $row['number'] = intval($row['number']); |
| | | |
| | | /* 格式化重量 */ |
| | | $row['formated_weight'] = formated_weight($row['weight']); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 获得订单中的费用信息 |
| | | * |
| | | * @access public |
| | | * @param array $order |
| | | * @param array $goods |
| | | * @param array $consignee |
| | | * @param bool $is_gb_deposit 是否团购保证金(如果是,应付款金额只计算商品总额和支付费用,可以获得的积分取 $gift_integral) |
| | | * @return array |
| | | */ |
| | | function order_fee($order, $goods, $consignee) |
| | | { |
| | | /* 初始化订单的扩展code */ |
| | | if (!isset($order['extension_code'])) |
| | | { |
| | | $order['extension_code'] = ''; |
| | | } |
| | | |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $group_buy = group_buy_info($order['extension_id']); |
| | | } |
| | | |
| | | $total = array('real_goods_count' => 0, |
| | | 'gift_amount' => 0, |
| | | 'goods_price' => 0, |
| | | 'market_price' => 0, |
| | | 'discount' => 0, |
| | | 'pack_fee' => 0, |
| | | 'card_fee' => 0, |
| | | 'shipping_fee' => 0, |
| | | 'shipping_insure' => 0, |
| | | 'integral_money' => 0, |
| | | 'bonus' => 0, |
| | | 'surplus' => 0, |
| | | 'cod_fee' => 0, |
| | | 'pay_fee' => 0, |
| | | 'tax' => 0); |
| | | $weight = 0; |
| | | |
| | | /* 商品总价 */ |
| | | foreach ($goods AS $val) |
| | | { |
| | | /* 统计实体商品的个数 */ |
| | | if ($val['is_real']) |
| | | { |
| | | $total['real_goods_count']++; |
| | | } |
| | | |
| | | $total['goods_price'] += $val['goods_price'] * $val['goods_number']; |
| | | $total['market_price'] += $val['market_price'] * $val['goods_number']; |
| | | } |
| | | |
| | | $total['saving'] = $total['market_price'] - $total['goods_price']; |
| | | $total['save_rate'] = $total['market_price'] ? round($total['saving'] * 100 / $total['market_price']) . '%' : 0; |
| | | |
| | | $total['goods_price_formated'] = price_format($total['goods_price'], false); |
| | | $total['market_price_formated'] = price_format($total['market_price'], false); |
| | | $total['saving_formated'] = price_format($total['saving'], false); |
| | | |
| | | /* 折扣 */ |
| | | if ($order['extension_code'] != 'group_buy') |
| | | { |
| | | $discount = compute_discount(isset($order['supplier_id']) ? $order['supplier_id'] : -1); |
| | | $total['discount'] = $discount['discount']; |
| | | if ($total['discount'] > $total['goods_price']) |
| | | { |
| | | $total['discount'] = $total['goods_price']; |
| | | } |
| | | } |
| | | $total['discount_formated'] = price_format($total['discount'], false); |
| | | |
| | | /* 税额 */ |
| | | if (!empty($order['need_inv']) && $order['inv_type'] != '') |
| | | { |
| | | /* 查税率 */ |
| | | $rate = 0; |
| | | foreach ($GLOBALS['_CFG']['invoice_type']['type'] as $key => $type) |
| | | { |
| | | if ($type == $order['inv_type']) |
| | | { |
| | | $rate = floatval($GLOBALS['_CFG']['invoice_type']['rate'][$key]) / 100; |
| | | break; |
| | | } |
| | | } |
| | | if ($rate > 0) |
| | | { |
| | | $total['tax'] = $rate * $total['goods_price']; |
| | | } |
| | | } |
| | | $total['tax_formated'] = price_format($total['tax'], false); |
| | | |
| | | /* 包装费用 */ |
| | | if (!empty($order['pack_id'])) |
| | | { |
| | | $total['pack_fee'] = pack_fee($order['pack_id'], $total['goods_price']); |
| | | } |
| | | $total['pack_fee_formated'] = price_format($total['pack_fee'], false); |
| | | |
| | | /* 贺卡费用 */ |
| | | if (!empty($order['card_id'])) |
| | | { |
| | | $total['card_fee'] = card_fee($order['card_id'], $total['goods_price']); |
| | | } |
| | | $total['card_fee_formated'] = price_format($total['card_fee'], false); |
| | | |
| | | /* 红包 */ |
| | | $total['bonus'] = 0; |
| | | if (!empty($order['bonus_id'])) |
| | | { |
| | | $bonus = bonus_info($order['bonus_id']); |
| | | $total['bonus'] = $bonus['type_money']; |
| | | } |
| | | |
| | | |
| | | /* 线下红包 */ |
| | | if (!empty($order['bonus_sn'])) |
| | | { |
| | | $bonus = bonus_info(0,$order['bonus_sn']); |
| | | $total['bonus'] += $bonus['type_money']; |
| | | //$total['bonus_kill'] = $order['bonus_kill']; |
| | | //$total['bonus_kill_formated'] = price_format($total['bonus_kill'], false); |
| | | } |
| | | $total['bonus_formated'] = price_format($total['bonus'], false); |
| | | |
| | | |
| | | |
| | | /* 配送费用 */ |
| | | $shipping_cod_fee = NULL; |
| | | |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | |
| | | if ($order['shipping_id'] > 0 && $total['real_goods_count'] > 0) |
| | | { |
| | | $region['country'] = $consignee['country']; |
| | | $region['province'] = $consignee['province']; |
| | | $region['city'] = $consignee['city']; |
| | | $region['district'] = $consignee['district']; |
| | | $shipping_info = shipping_area_info($order['shipping_id'], $region); |
| | | |
| | | if (!empty($shipping_info)) |
| | | { |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $weight_price = cart_weight_price(CART_GROUP_BUY_GOODS); |
| | | } |
| | | else |
| | | { |
| | | $weight_price = cart_weight_price(); |
| | | } |
| | | |
| | | // 查看购物车中是否全为免运费商品,若是则把运费赋为零 |
| | | $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE $sql_where AND `extension_code` != 'package_buy' AND `is_shipping` = 0 "; //jx AND rec_id in (".$_SESSION['sel_cartgoods'].") |
| | | $shipping_count = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $total['shipping_fee'] = ($shipping_count == 0 AND $weight_price['free_shipping'] == 1) ?0 : shipping_fee($shipping_info['shipping_code'],$shipping_info['configure'], $weight_price['weight'], $total['goods_price'], $weight_price['number']); |
| | | |
| | | if (!empty($order['need_insure']) && $shipping_info['insure'] > 0) |
| | | { |
| | | $total['shipping_insure'] = shipping_insure_fee($shipping_info['shipping_code'], |
| | | $total['goods_price'], $shipping_info['insure']); |
| | | } |
| | | else |
| | | { |
| | | $total['shipping_insure'] = 0; |
| | | } |
| | | |
| | | if ($shipping_info['support_cod']) |
| | | { |
| | | $shipping_cod_fee = $shipping_info['pay_fee']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | $total['shipping_fee_formated'] = price_format($total['shipping_fee'], false); |
| | | $total['shipping_insure_formated'] = price_format($total['shipping_insure'], false); |
| | | |
| | | /* 代码增加_start By */ |
| | | foreach ($goods AS $val) |
| | | { |
| | | $sql_supp = "select g.supplier_id, IF(g.supplier_id='0', '本网站', s.supplier_name) AS supplier_name2 from ".$GLOBALS['ecs']->table('goods'). |
| | | " AS g left join ".$GLOBALS['ecs']->table('supplier')." AS s on g.supplier_id=s.supplier_id where g.goods_id='". $val['goods_id'] ."' "; |
| | | $row_supp = $GLOBALS['db']->getRow($sql_supp); |
| | | $row_supp['supplier_id'] = $row_supp['supplier_id'] ? intval($row_supp['supplier_id']) :0; |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['supplier_name'] =$row_supp['supplier_name2']; |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['goods_number'] += $val['goods_number']; |
| | | |
| | | $total['supplier_goodsnumber'][$row_supp['supplier_id']] += $val['goods_number']; |
| | | |
| | | $total['goods_price_supplier'][$row_supp['supplier_id']] += $val['goods_price'] * $val['goods_number']; |
| | | |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $weight_price2 = cart_weight_price2(CART_GROUP_BUY_GOODS, $row_supp['supplier_id']); |
| | | } |
| | | else |
| | | { |
| | | $weight_price2 = cart_weight_price2(CART_GENERAL_GOODS, $row_supp['supplier_id']); |
| | | } |
| | | |
| | | // 查看购物车中是否全为免运费商品,若是则把运费赋为零 |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('cart') . " AS c left join ". $GLOBALS['ecs']->table('goods') ." AS g on c.goods_id=g.goods_id WHERE g.supplier_id = '". $row_supp['supplier_id'] ."' AND $sql_where AND c.extension_code != 'package_buy' AND c.is_shipping = 0 "; //jx AND c.rec_id in (".$_SESSION['sel_cartgoods'].") |
| | | $shipping_count_supp = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['shipping_fee'] = ($shipping_count_supp == 0 AND $weight_price2['free_shipping'] == 1) ?0 : shipping_fee($shipping_info['shipping_code'],$shipping_info['configure'], $weight_price2['weight'], $total['goods_price_supplier'][$row_supp['supplier_id']], $weight_price2['number']); |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['formated_shipping_fee'] = price_format($total['supplier_shipping'][$row_supp['supplier_id']]['shipping_fee'], false); |
| | | |
| | | |
| | | } |
| | | krsort($total['supplier_shipping']); |
| | | $total['shipping_fee'] = 0; |
| | | foreach($total['supplier_shipping'] AS $supp_shipping) |
| | | { |
| | | $total['shipping_fee'] += $supp_shipping['shipping_fee']; |
| | | } |
| | | $total['shipping_fee_formated'] = price_format($total['shipping_fee'], false); |
| | | |
| | | /* 代码增加_end By */ |
| | | |
| | | // 购物车中的商品能享受红包支付的总额 |
| | | $bonus_amount = compute_discount_amount(); |
| | | // 红包和积分最多能支付的金额为商品总额 |
| | | $max_amount = $total['goods_price'] == 0 ? $total['goods_price'] : $total['goods_price'] - $bonus_amount; |
| | | |
| | | /* 计算订单总额 */ |
| | | if ($order['extension_code'] == 'group_buy' && $group_buy['deposit'] > 0) |
| | | { |
| | | $total['amount'] = $total['goods_price']; |
| | | } |
| | | else |
| | | { |
| | | $total['amount'] = $total['goods_price'] - $total['discount'] + $total['tax'] + $total['pack_fee'] + $total['card_fee'] + |
| | | $total['shipping_fee'] + $total['shipping_insure'] + $total['cod_fee']; |
| | | |
| | | // 减去红包金额 |
| | | $use_bonus = min($total['bonus'], $max_amount); // 实际减去的红包金额 |
| | | if(isset($total['bonus_kill'])) |
| | | { |
| | | $use_bonus_kill = min($total['bonus_kill'], $max_amount); |
| | | $total['amount'] -= $price = number_format($total['bonus_kill'], 2, '.', ''); // 还需要支付的订单金额 |
| | | } |
| | | |
| | | $total['bonus'] = $use_bonus; |
| | | $total['bonus_formated'] = price_format($total['bonus'], false); |
| | | |
| | | $total['amount'] -= $use_bonus; // 还需要支付的订单金额 |
| | | $max_amount -= $use_bonus; // 积分最多还能支付的金额 |
| | | |
| | | } |
| | | |
| | | /* 余额 */ |
| | | $order['surplus'] = $order['surplus'] > 0 ? $order['surplus'] : 0; |
| | | if ($total['amount'] > 0) |
| | | { |
| | | if (isset($order['surplus']) && $order['surplus'] > $total['amount']) |
| | | { |
| | | $order['surplus'] = $total['amount']; |
| | | $total['amount'] = 0; |
| | | } |
| | | else |
| | | { |
| | | $total['amount'] -= floatval($order['surplus']); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $order['surplus'] = 0; |
| | | $total['amount'] = 0; |
| | | } |
| | | $total['surplus'] = $order['surplus']; |
| | | $total['surplus_formated'] = price_format($order['surplus'], false); |
| | | |
| | | /* 积分 */ |
| | | $order['integral'] = $order['integral'] > 0 ? $order['integral'] : 0; |
| | | if ($total['amount'] > 0 && $max_amount > 0 && $order['integral'] > 0) |
| | | { |
| | | $integral_money = value_of_integral($order['integral']); |
| | | |
| | | // 使用积分支付 |
| | | $use_integral = min($total['amount'], $max_amount, $integral_money); // 实际使用积分支付的金额 |
| | | $total['amount'] -= $use_integral; |
| | | $total['integral_money'] = $use_integral; |
| | | $order['integral'] = integral_of_value($use_integral); |
| | | } |
| | | else |
| | | { |
| | | $total['integral_money'] = 0; |
| | | $order['integral'] = 0; |
| | | } |
| | | $total['integral'] = $order['integral']; |
| | | $total['integral_formated'] = price_format($total['integral_money'], false); |
| | | |
| | | /* 保存订单信息 */ |
| | | $_SESSION['flow_order'] = $order; |
| | | |
| | | $se_flow_type = isset($_SESSION['flow_type']) ? $_SESSION['flow_type'] : ''; |
| | | |
| | | /* 支付费用 */ |
| | | if (!empty($order['pay_id']) && ($total['real_goods_count'] > 0 || $se_flow_type != CART_EXCHANGE_GOODS)) |
| | | { |
| | | $total['pay_fee'] = pay_fee($order['pay_id'], $total['amount'], $shipping_cod_fee); |
| | | } |
| | | |
| | | $total['pay_fee_formated'] = price_format($total['pay_fee'], false); |
| | | |
| | | $total['amount'] += $total['pay_fee']; // 订单总额累加上支付费用 |
| | | $total['amount_formated'] = price_format($total['amount'], false); |
| | | |
| | | /* 取得可以得到的积分和红包 */ |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $total['will_get_integral'] = $group_buy['gift_integral']; |
| | | } |
| | | elseif ($order['extension_code'] == 'exchange_goods') |
| | | { |
| | | $total['will_get_integral'] = 0; |
| | | } |
| | | else |
| | | { |
| | | $total['will_get_integral'] = get_give_integral($goods); |
| | | } |
| | | $total['will_get_bonus'] = $order['extension_code'] == 'exchange_goods' ? 0 : price_format(get_total_bonus(), false); |
| | | $total['formated_goods_price'] = price_format($total['goods_price'], false); |
| | | $total['formated_market_price'] = price_format($total['market_price'], false); |
| | | $total['formated_saving'] = price_format($total['saving'], false); |
| | | |
| | | if ($order['extension_code'] == 'exchange_goods') |
| | | { |
| | | $sql_exchange = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = 'SELECT SUM(eg.exchange_integral) '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c,' . $GLOBALS['ecs']->table('exchange_goods') . 'AS eg '. |
| | | "WHERE c.goods_id = eg.goods_id AND " . $sql_exchange . |
| | | " AND c.rec_type = '" . CART_EXCHANGE_GOODS . "' " . |
| | | ' AND c.is_gift = 0 AND c.goods_id > 0 ' . |
| | | 'GROUP BY eg.goods_id'; |
| | | $exchange_integral = $GLOBALS['db']->getOne($sql); |
| | | $total['exchange_integral'] = $exchange_integral; |
| | | } |
| | | |
| | | return $total; |
| | | } |
| | | |
| | | /** |
| | | * 修改订单 |
| | | * @param int $order_id 订单id |
| | | * @param array $order key => value |
| | | * @return bool |
| | | */ |
| | | function update_order($order_id, $order) |
| | | { |
| | | return $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), |
| | | $order, 'UPDATE', "order_id = '$order_id'"); |
| | | } |
| | | |
| | | /** |
| | | * 得到新订单号 |
| | | * @return string |
| | | */ |
| | | function get_order_sn() |
| | | { |
| | | /* 选择一个随机的方案 */ |
| | | mt_srand((double) microtime() * 1000000); |
| | | |
| | | return date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车商品 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return array 购物车商品数组 |
| | | */ |
| | | function cart_goods($type = CART_GENERAL_GOODS) |
| | | { |
| | | /* 代码增加_start By */ |
| | | |
| | | $id_ext = ""; |
| | | if ($_SESSION['sel_cartgoods']) |
| | | { |
| | | $id_ext = " AND c.rec_id in (". $_SESSION['sel_cartgoods'] .") "; |
| | | } |
| | | /* 代码增加_end By */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT c.rec_id, c.user_id, c.goods_id, c.goods_name, c.goods_sn, c.goods_number, " . |
| | | "c.market_price, c.goods_price, c.goods_attr, c.is_real, c.extension_code, c.parent_id, c.is_gift, c.is_shipping, package_attr_id," . |
| | | "c.goods_price * c.goods_number AS subtotal,IFNULL(g.supplier_id,0) as supplier_id,IFNULL(s.supplier_name,'网站自营') as seller " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " as c LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " as g ON c.goods_id = g.goods_id LEFT JOIN ". $GLOBALS['ecs']->table('supplier') . |
| | | " as s ON s.supplier_id = g.supplier_id WHERE $sql_where " . |
| | | "AND c.rec_type = '$type'"; //代码修改 By 增加一个 $id_ext , package_attr_id $id_ext |
| | | |
| | | $arr = $GLOBALS['db']->getAll($sql); |
| | | |
| | | /* 格式化价格及礼包商品 */ |
| | | foreach ($arr as $key => $value) |
| | | { |
| | | $arr[$key]['formated_market_price'] = price_format($value['market_price'], false); |
| | | $arr[$key]['formated_goods_price'] = price_format($value['goods_price'], false); |
| | | $arr[$key]['formated_subtotal'] = price_format($value['subtotal'], false); |
| | | |
| | | /* 代码增加_start By */ |
| | | $arr[$key]['goods_thumb'] = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$value['goods_id']}'"); |
| | | $arr[$key]['goods_thumb'] = get_image_path($value['goods_id'], $arr[$key]['goods_thumb'], true); |
| | | /* 代码增加_end By */ |
| | | |
| | | if ($value['extension_code'] == 'package_buy') |
| | | { |
| | | $arr[$key]['package_goods_list'] = get_package_goods($value['goods_id'], $value['package_attr_id']); //修改 by |
| | | } |
| | | } |
| | | |
| | | return $arr; |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车总金额 |
| | | * @params boolean $include_gift 是否包括赠品 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return float 购物车总金额 |
| | | */ |
| | | function cart_amount($include_gift = true, $type = CART_GENERAL_GOODS) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | " FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_type = '$type' "; |
| | | |
| | | if (!$include_gift) |
| | | { |
| | | $sql .= ' AND is_gift = 0 AND goods_id > 0'; |
| | | } |
| | | |
| | | return floatval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车总金额根据购物车中的id |
| | | * @params array $cartids 购物车中的id数组 |
| | | * @params boolean $include_gift 是否包括赠品 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return float 购物车总金额 |
| | | */ |
| | | function cart_amount_new($cartids='', $include_gift = true, $type = CART_GENERAL_GOODS) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | " FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_type = '$type' "; |
| | | if (is_array($cartids)){ |
| | | $idinfo = array_filter($cartids); |
| | | if($idinfo){ |
| | | $sql .= ' AND rec_id in('.implode(',',$idinfo).')'; |
| | | } |
| | | } |
| | | if (!$include_gift) |
| | | { |
| | | $sql .= ' AND is_gift = 0 AND goods_id > 0'; |
| | | } |
| | | |
| | | return floatval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 检查某商品是否已经存在于购物车 |
| | | * |
| | | * @access public |
| | | * @param integer $id |
| | | * @param array $spec |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return boolean |
| | | */ |
| | | function cart_goods_exists($id, $spec, $type = CART_GENERAL_GOODS) |
| | | { |
| | | /* 检查该商品是否已经存在在购物车中 */ |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('cart'). |
| | | "WHERE session_id = '" .SESS_ID. "' AND goods_id = '$id' ". |
| | | "AND parent_id = 0 AND goods_attr = '" .get_goods_attr_info($spec). "' " . |
| | | "AND rec_type = '$type'"; |
| | | |
| | | return ($GLOBALS['db']->getOne($sql) > 0); |
| | | } |
| | | |
| | | /** |
| | | * 获得购物车中商品的总重量、总价格、总数量 |
| | | * |
| | | * @access public |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return array |
| | | */ |
| | | function cart_weight_price($type = CART_GENERAL_GOODS) |
| | | { |
| | | $package_row['weight'] = 0; |
| | | $package_row['amount'] = 0; |
| | | $package_row['number'] = 0; |
| | | |
| | | $packages_row['free_shipping'] = 1; |
| | | |
| | | /* 计算超值礼包内商品的相关配送参数 */ |
| | | $sql = 'SELECT goods_id, goods_number, goods_price FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE extension_code = 'package_buy' AND session_id = '" . SESS_ID . "'"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if ($row) |
| | | { |
| | | $packages_row['free_shipping'] = 0; |
| | | $free_shipping_count = 0; |
| | | |
| | | foreach ($row as $val) |
| | | { |
| | | // 如果商品全为免运费商品,设置一个标识变量 |
| | | $sql = 'SELECT count(*) FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | $shipping_count = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if ($shipping_count > 0) |
| | | { |
| | | // 循环计算每个超值礼包商品的重量和数量,注意一个礼包中可能包换若干个同一商品 |
| | | $sql = 'SELECT SUM(g.goods_weight * pg.goods_number) AS weight, ' . |
| | | 'SUM(pg.goods_number) AS number FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | |
| | | $goods_row = $GLOBALS['db']->getRow($sql); |
| | | $package_row['weight'] += floatval($goods_row['weight']) * $val['goods_number']; |
| | | $package_row['amount'] += floatval($val['goods_price']) * $val['goods_number']; |
| | | $package_row['number'] += intval($goods_row['number']) * $val['goods_number']; |
| | | } |
| | | else |
| | | { |
| | | $free_shipping_count++; |
| | | } |
| | | } |
| | | |
| | | $packages_row['free_shipping'] = $free_shipping_count == count($row) ? 1 : 0; |
| | | } |
| | | |
| | | /* 获得购物车中非超值礼包商品的总重量 */ |
| | | $sql = 'SELECT SUM(g.goods_weight * c.goods_number) AS weight, ' . |
| | | 'SUM(c.goods_price * c.goods_number) AS amount, ' . |
| | | 'SUM(c.goods_number) AS number '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c '. |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = c.goods_id '. |
| | | "WHERE c.session_id = '" . SESS_ID . "' " . |
| | | "AND rec_type = '$type' AND g.is_shipping = 0 AND c.extension_code != 'package_buy'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | $packages_row['weight'] = floatval($row['weight']) + $package_row['weight']; |
| | | $packages_row['amount'] = floatval($row['amount']) + $package_row['amount']; |
| | | $packages_row['number'] = intval($row['number']) + $package_row['number']; |
| | | /* 格式化重量 */ |
| | | $packages_row['formated_weight'] = formated_weight($packages_row['weight']); |
| | | |
| | | return $packages_row; |
| | | } |
| | | |
| | | /** |
| | | * 添加商品到购物车 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id 商品编号 |
| | | * @param integer $num 商品数量 |
| | | * @param array $spec 规格值对应的id数组 |
| | | * @param integer $parent 基本件 |
| | | * @return boolean |
| | | */ |
| | | function addto_cart($goods_id, $num = 1, $spec = array(), $parent = 0) |
| | | { |
| | | $GLOBALS['err']->clean(); |
| | | $_parent_id = $parent; |
| | | |
| | | /* 取得商品信息 */ |
| | | $sql = "SELECT g.goods_name, g.goods_sn, g.is_on_sale, g.is_real, ". |
| | | "g.market_price, g.shop_price AS org_price, g.promote_price, g.promote_start_date, ". |
| | | "g.promote_end_date, g.goods_weight, g.integral, g.extension_code, ". |
| | | "g.goods_number, g.is_alone_sale, g.is_shipping,". |
| | | "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price ". |
| | | " FROM " .$GLOBALS['ecs']->table('goods'). " AS g ". |
| | | " LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". |
| | | "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ". |
| | | " WHERE g.goods_id = '$goods_id'" . |
| | | " AND g.is_delete = 0"; |
| | | $goods = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (empty($goods)) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['goods_not_exists'], ERR_NOT_EXISTS); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 如果是作为配件添加到购物车的,需要先检查购物车里面是否已经有基本件 */ |
| | | if ($parent > 0) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE goods_id='$parent' AND session_id='" . SESS_ID . "' AND extension_code <> 'package_buy'"; |
| | | if ($GLOBALS['db']->getOne($sql) == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['no_basic_goods'], ERR_NO_BASIC_GOODS); |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /* 是否正在销售 */ |
| | | if ($goods['is_on_sale'] == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['not_on_sale'], ERR_NOT_ON_SALE); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 不是配件时检查是否允许单独销售 */ |
| | | if (empty($parent) && $goods['is_alone_sale'] == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['cannt_alone_sale'], ERR_CANNT_ALONE_SALE); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 如果商品有规格则取规格商品信息 配件除外 */ |
| | | $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('products'). " WHERE goods_id = '$goods_id' LIMIT 0, 1"; |
| | | $prod = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (is_spec($spec) && !empty($prod)) |
| | | { |
| | | $product_info = get_products_info($goods_id, $spec); |
| | | } |
| | | if (empty($product_info)) |
| | | { |
| | | $product_info = array('product_number' => '', 'product_id' => 0); |
| | | } |
| | | |
| | | /* 检查:库存 */ |
| | | if ($GLOBALS['_CFG']['use_storage'] == 1) |
| | | { |
| | | //检查:商品购买数量是否大于总库存 |
| | | if ($num > $goods['goods_number']) |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $goods['goods_number']), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | //商品存在规格 是货品 检查该货品库存 |
| | | if (is_spec($spec) && !empty($prod)) |
| | | { |
| | | if (!empty($spec)) |
| | | { |
| | | /* 取规格的货品库存 */ |
| | | if ($num > $product_info['product_number']) |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $product_info['product_number']), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* 计算商品的促销价格 */ |
| | | $spec_price = spec_price($spec); |
| | | $goods_price = get_final_price($goods_id, $num, true, $spec); |
| | | $goods['market_price'] += $spec_price; |
| | | $goods_attr = get_goods_attr_info($spec); |
| | | $goods_attr_id = join(',', $spec); |
| | | |
| | | /* 初始化要插入购物车的基本件数据 */ |
| | | $parent = array( |
| | | 'user_id' => $_SESSION['user_id'], |
| | | 'session_id' => SESS_ID, |
| | | 'goods_id' => $goods_id, |
| | | 'goods_sn' => addslashes($goods['goods_sn']), |
| | | 'product_id' => $product_info['product_id'], |
| | | 'goods_name' => addslashes($goods['goods_name']), |
| | | 'market_price' => $goods['market_price'], |
| | | 'goods_attr' => addslashes($goods_attr), |
| | | 'goods_attr_id' => $goods_attr_id, |
| | | 'is_real' => $goods['is_real'], |
| | | 'extension_code'=> $goods['extension_code'], |
| | | 'is_gift' => 0, |
| | | 'is_shipping' => $goods['is_shipping'], |
| | | 'add_time' => gmtime(), //代码增加 By |
| | | 'rec_type' => CART_GENERAL_GOODS |
| | | ); |
| | | |
| | | /* 如果该配件在添加为基本件的配件时,所设置的“配件价格”比原价低,即此配件在价格上提供了优惠, */ |
| | | /* 则按照该配件的优惠价格卖,但是每一个基本件只能购买一个优惠价格的“该配件”,多买的“该配件”不享 */ |
| | | /* 受此优惠 */ |
| | | $basic_list = array(); |
| | | $sql = "SELECT parent_id, goods_price " . |
| | | "FROM " . $GLOBALS['ecs']->table('group_goods') . |
| | | " WHERE goods_id = '$goods_id'" . |
| | | " AND goods_price < '$goods_price'" . |
| | | " AND parent_id = '$_parent_id'" . |
| | | " ORDER BY goods_price"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $basic_list[$row['parent_id']] = $row['goods_price']; |
| | | } |
| | | |
| | | /* 取得购物车中该商品每个基本件的数量 */ |
| | | $basic_count_list = array(); |
| | | if ($basic_list) |
| | | { |
| | | $sql = "SELECT goods_id, SUM(goods_number) AS count " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "'" . |
| | | " AND parent_id = 0" . |
| | | " AND extension_code <> 'package_buy' " . |
| | | " AND goods_id " . db_create_in(array_keys($basic_list)) . |
| | | " GROUP BY goods_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $basic_count_list[$row['goods_id']] = $row['count']; |
| | | } |
| | | } |
| | | |
| | | /* 取得购物车中该商品每个基本件已有该商品配件数量,计算出每个基本件还能有几个该商品配件 */ |
| | | /* 一个基本件对应一个该商品配件 */ |
| | | if ($basic_count_list) |
| | | { |
| | | $sql = "SELECT parent_id, SUM(goods_number) AS count " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "'" . |
| | | " AND goods_id = '$goods_id'" . |
| | | " AND extension_code <> 'package_buy' " . |
| | | " AND parent_id " . db_create_in(array_keys($basic_count_list)) . |
| | | " GROUP BY parent_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $basic_count_list[$row['parent_id']] -= $row['count']; |
| | | } |
| | | } |
| | | |
| | | /* 循环插入配件 如果是配件则用其添加数量依次为购物车中所有属于其的基本件添加足够数量的该配件 */ |
| | | foreach ($basic_list as $parent_id => $fitting_price) |
| | | { |
| | | /* 如果已全部插入,退出 */ |
| | | if ($num <= 0) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | /* 如果该基本件不再购物车中,执行下一个 */ |
| | | if (!isset($basic_count_list[$parent_id])) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | /* 如果该基本件的配件数量已满,执行下一个基本件 */ |
| | | if ($basic_count_list[$parent_id] <= 0) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | /* 作为该基本件的配件插入 */ |
| | | $parent['goods_price'] = max($fitting_price, 0) + $spec_price; //允许该配件优惠价格为0 |
| | | $parent['goods_number'] = min($num, $basic_count_list[$parent_id]); |
| | | $parent['parent_id'] = $parent_id; |
| | | |
| | | /* 添加 */ |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('cart'), $parent, 'INSERT'); |
| | | |
| | | /* 改变数量 */ |
| | | $num -= $parent['goods_number']; |
| | | } |
| | | |
| | | /* 如果数量不为0,作为基本件插入 */ |
| | | if ($num > 0) |
| | | { |
| | | /* 检查该商品是否已经存在在购物车中 */ |
| | | $sql = "SELECT goods_number FROM " .$GLOBALS['ecs']->table('cart'). |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '$goods_id' ". |
| | | " AND parent_id = 0 AND goods_attr = '" .get_goods_attr_info($spec). "' " . |
| | | " AND extension_code <> 'package_buy' " . |
| | | " AND user_id= '".$_SESSION['user_id']."'". //代码增加 By |
| | | " AND rec_type = 'CART_GENERAL_GOODS'"; |
| | | |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if($row) //如果购物车已经有此物品,则更新 |
| | | { |
| | | $num += $row['goods_number']; |
| | | if(is_spec($spec) && !empty($prod) ) |
| | | { |
| | | $goods_storage=$product_info['product_number']; |
| | | } |
| | | else |
| | | { |
| | | $goods_storage=$goods['goods_number']; |
| | | } |
| | | if ($GLOBALS['_CFG']['use_storage'] == 0 || $num <= $goods_storage) |
| | | { |
| | | $goods_price = get_final_price($goods_id, $num, true, $spec); |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '$num'" . |
| | | " , goods_price = '$goods_price'". |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '$goods_id' ". |
| | | " AND parent_id = 0 AND goods_attr = '" .get_goods_attr_info($spec). "' " . |
| | | " AND extension_code <> 'package_buy' " . |
| | | "AND rec_type = 'CART_GENERAL_GOODS'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $num), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | else //购物车没有此物品,则插入 |
| | | { |
| | | $goods_price = get_final_price($goods_id, $num, true, $spec); |
| | | $parent['goods_price'] = max($goods_price, 0); |
| | | $parent['goods_number'] = $num; |
| | | $parent['parent_id'] = 0; |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('cart'), $parent, 'INSERT'); |
| | | } |
| | | } |
| | | |
| | | /* 把赠品删除 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /* 重写方法_start By */ |
| | | /** |
| | | * 清空购物车 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @param string $other 需要扩展的条件字符串 |
| | | */ |
| | | function clear_cart($type = CART_GENERAL_GOODS) |
| | | { |
| | | |
| | | //$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | // " WHERE session_id = '" . SESS_ID . "' AND rec_type = '$type'"; |
| | | |
| | | |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' "; |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where AND rec_type = '$type'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | /* 代码增加_end By */ |
| | | |
| | | /** |
| | | * 获得指定的商品属性 |
| | | * |
| | | * @access public |
| | | * @param array $arr 规格、属性ID数组 |
| | | * @param type $type 设置返回结果类型:pice,显示价格,默认;no,不显示价格 |
| | | * |
| | | * @return string |
| | | */ |
| | | function get_goods_attr_info($arr, $type = 'pice') |
| | | { |
| | | $attr = ''; |
| | | |
| | | if (!empty($arr)) |
| | | { |
| | | $fmt = "%s:%s[%s] \n"; |
| | | |
| | | $sql = "SELECT a.attr_name, ga.attr_value, ga.attr_price ". |
| | | "FROM ".$GLOBALS['ecs']->table('goods_attr')." AS ga, ". |
| | | $GLOBALS['ecs']->table('attribute')." AS a ". |
| | | "WHERE " .db_create_in($arr, 'ga.goods_attr_id')." AND a.attr_id = ga.attr_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $attr_price = round(floatval($row['attr_price']), 2); |
| | | $attr .= sprintf($fmt, $row['attr_name'], $row['attr_value'], $attr_price); |
| | | } |
| | | |
| | | $attr = str_replace('[0]', '', $attr); |
| | | } |
| | | |
| | | return $attr; |
| | | } |
| | | |
| | | /** |
| | | * 取得用户信息 |
| | | * @param int $user_id 用户id |
| | | * @return array 用户信息 |
| | | */ |
| | | function user_info($user_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('users') . |
| | | " WHERE user_id = '$user_id'"; |
| | | $user = $GLOBALS['db']->getRow($sql); |
| | | |
| | | unset($user['question']); |
| | | unset($user['answer']); |
| | | |
| | | /* 格式化帐户余额 */ |
| | | if ($user) |
| | | { |
| | | // if ($user['user_money'] < 0) |
| | | // { |
| | | // $user['user_money'] = 0; |
| | | // } |
| | | $user['formated_user_money'] = price_format($user['user_money'], false); |
| | | $user['formated_frozen_money'] = price_format($user['frozen_money'], false); |
| | | } |
| | | |
| | | return $user; |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | * @param int $user_id 订单id |
| | | * @param array $user key => value |
| | | * @return bool |
| | | */ |
| | | function update_user($user_id, $user) |
| | | { |
| | | return $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), |
| | | $user, 'UPDATE', "user_id = '$user_id'"); |
| | | } |
| | | |
| | | /** |
| | | * 取得用户地址列表 |
| | | * @param int $user_id 用户id |
| | | * @return array |
| | | */ |
| | | function address_list($user_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_address') . |
| | | " WHERE user_id = '$user_id'"; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得用户地址信息 |
| | | * @param int $address_id 地址id |
| | | * @return array |
| | | */ |
| | | function address_info($address_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_address') . |
| | | " WHERE address_id = '$address_id'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得用户当前可用红包 |
| | | * @param int $user_id 用户id |
| | | * @param float $goods_amount 订单商品金额 |
| | | * @return array 红包数组 |
| | | */ |
| | | function user_bonus($user_id, $goods_amount = 0) |
| | | { |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | $sql = "SELECT t.type_id, t.type_name, t.type_money, b.bonus_id, t.supplier_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," . |
| | | $GLOBALS['ecs']->table('user_bonus') . " AS b " . |
| | | "WHERE t.type_id = b.bonus_type_id " . |
| | | "AND t.use_start_date <= '$today' " . |
| | | "AND t.use_end_date >= '$today' " . |
| | | "AND t.min_goods_amount <= '$goods_amount' " . |
| | | "AND b.user_id<>0 " . |
| | | "AND b.user_id = '$user_id' " . |
| | | "AND b.order_id = 0"; |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得红包信息 |
| | | * @param int $bonus_id 红包id |
| | | * @param string $bonus_sn 红包序列号 |
| | | * @param array 红包信息 |
| | | */ |
| | | function bonus_info($bonus_id, $bonus_sn = '') |
| | | { |
| | | $sql = "SELECT t.*, sum(t.type_money) as type_money, b.* " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," . |
| | | $GLOBALS['ecs']->table('user_bonus') . " AS b " . |
| | | "WHERE t.type_id = b.bonus_type_id "; |
| | | |
| | | if (!empty($bonus_id)) |
| | | { |
| | | $sql .= "AND b.bonus_id in(".$bonus_id.")"; |
| | | } |
| | | if(!empty($bonus_sn)) |
| | | { |
| | | $sql .= "AND b.bonus_sn in(".$bonus_sn.")"; |
| | | } |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 检查红包是否已使用 |
| | | * @param int $bonus_id 红包id |
| | | * @return bool |
| | | */ |
| | | function bonus_used($bonus_id) |
| | | { |
| | | $sql = "SELECT order_id FROM " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " WHERE bonus_id = '$bonus_id'"; |
| | | |
| | | return $GLOBALS['db']->getOne($sql) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 设置红包为已使用 |
| | | * @param int $bonus_id 红包id |
| | | * @param int $order_id 订单id |
| | | * @return bool |
| | | */ |
| | | function use_bonus($bonus_id, $order_id) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " SET order_id = '$order_id', used_time = '" . gmtime() . "' " . |
| | | "WHERE bonus_id = '$bonus_id' LIMIT 1"; |
| | | |
| | | return $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 设置红包为未使用 |
| | | * @param int $bonus_id 红包id |
| | | * @param int $order_id 订单id |
| | | * @return bool |
| | | */ |
| | | function unuse_bonus($bonus_id) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " SET order_id = 0, used_time = 0 " . |
| | | "WHERE bonus_id = '$bonus_id' LIMIT 1"; |
| | | |
| | | return $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 计算积分的价值(能抵多少钱) |
| | | * @param int $integral 积分 |
| | | * @return float 积分价值 |
| | | */ |
| | | function value_of_integral($integral) |
| | | { |
| | | $scale = floatval($GLOBALS['_CFG']['integral_scale']); |
| | | |
| | | return $scale > 0 ? round(($integral / 100) * $scale, 2) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 计算指定的金额需要多少积分 |
| | | * |
| | | * @access public |
| | | * @param integer $value 金额 |
| | | * @return void |
| | | */ |
| | | function integral_of_value($value) |
| | | { |
| | | $scale = floatval($GLOBALS['_CFG']['integral_scale']); |
| | | |
| | | return $scale > 0 ? round($value / $scale * 100) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 订单退款 |
| | | * @param array $order 订单 |
| | | * @param int $refund_type 退款方式 1 到帐户余额 2 到退款申请(先到余额,再申请提款) 3 不处理 |
| | | * @param string $refund_note 退款说明 |
| | | * @param float $refund_amount 退款金额(如果为0,取订单已付款金额) |
| | | * @return bool |
| | | */ |
| | | function order_refund($order, $refund_type, $refund_note, $refund_amount = 0) |
| | | { |
| | | /* 检查参数 */ |
| | | $user_id = $order['user_id']; |
| | | if ($user_id == 0 && $refund_type == 1) |
| | | { |
| | | die('anonymous, cannot return to account balance'); |
| | | } |
| | | |
| | | $amount = $refund_amount > 0 ? $refund_amount : $order['money_paid']; |
| | | if ($amount <= 0) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (!in_array($refund_type, array(1, 2, 3))) |
| | | { |
| | | die('invalid params'); |
| | | } |
| | | |
| | | /* 备注信息 */ |
| | | if ($refund_note) |
| | | { |
| | | $change_desc = $refund_note; |
| | | } |
| | | else |
| | | { |
| | | include_once(ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/admin/order.php'); |
| | | $change_desc = sprintf($GLOBALS['_LANG']['order_refund'], $order['order_sn']); |
| | | } |
| | | |
| | | /* 处理退款 */ |
| | | if (1 == $refund_type) |
| | | { |
| | | log_account_change($user_id, $amount, 0, 0, 0, $change_desc); |
| | | |
| | | return true; |
| | | } |
| | | elseif (2 == $refund_type) |
| | | { |
| | | /* 如果非匿名,退回余额 */ |
| | | if ($user_id > 0) |
| | | { |
| | | log_account_change($user_id, $amount, 0, 0, 0, $change_desc); |
| | | } |
| | | |
| | | /* user_account 表增加提款申请记录 */ |
| | | $account = array( |
| | | 'user_id' => $user_id, |
| | | 'amount' => (-1) * $amount, |
| | | 'add_time' => gmtime(), |
| | | 'user_note' => $refund_note, |
| | | 'process_type' => SURPLUS_RETURN, |
| | | 'admin_user' => $_SESSION['admin_name'], |
| | | 'admin_note' => sprintf($GLOBALS['_LANG']['order_refund'], $order['order_sn']), |
| | | 'is_paid' => 0 |
| | | ); |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('user_account'), $account, 'INSERT'); |
| | | |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /* 重构方法_start By */ |
| | | /** |
| | | * 获得购物车中的商品 |
| | | * |
| | | * @access public |
| | | * @return array |
| | | */ |
| | | function get_cart_goods($other='') |
| | | { |
| | | /* 初始化 */ |
| | | $goods_list = array(); |
| | | $total = array( |
| | | 'goods_price' => 0, // 本店售价合计(有格式) |
| | | 'market_price' => 0, // 市场售价合计(有格式) |
| | | 'saving' => 0, // 节省金额(有格式) |
| | | 'save_rate' => 0, // 节省百分比 |
| | | 'goods_amount' => 0, // 本店售价合计(无格式) |
| | | ); |
| | | |
| | | /* 循环、统计 */ |
| | | |
| | | /* 代码增加_start By */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT c.*, g.supplier_id, IF(c.parent_id, c.parent_id, c.goods_id) AS pid " . |
| | | " FROM " . $GLOBALS['ecs']->table('cart') . " AS c left join " .$GLOBALS['ecs']->table('goods')." AS g ". |
| | | " on c.goods_id=g.goods_id ". |
| | | " WHERE $sql_where AND c.rec_type = '" . CART_GENERAL_GOODS . "' $other " . |
| | | " ORDER BY pid, c.parent_id"; |
| | | /* 代码增加_end By */ |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | /* 用于统计购物车中实体商品和虚拟商品的个数 */ |
| | | $virtual_goods_count = 0; |
| | | $real_goods_count = 0; |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $total['goods_price'] += $row['goods_price'] * $row['goods_number']; |
| | | $total['market_price'] += $row['market_price'] * $row['goods_number']; |
| | | |
| | | $row['subtotal'] = price_format($row['goods_price'] * $row['goods_number'], false); |
| | | $row['goods_price'] = price_format($row['goods_price'], false); |
| | | $row['market_price'] = price_format($row['market_price'], false); |
| | | |
| | | /* 统计实体商品和虚拟商品的个数 */ |
| | | if ($row['is_real']) |
| | | { |
| | | $real_goods_count++; |
| | | } |
| | | else |
| | | { |
| | | $virtual_goods_count++; |
| | | } |
| | | |
| | | /* 查询规格 */ |
| | | if (trim($row['goods_attr']) != '') |
| | | { |
| | | $row['goods_attr']=addslashes($row['goods_attr']); |
| | | $sql = "SELECT attr_value FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_attr_id " . |
| | | db_create_in($row['goods_attr']); |
| | | $attr_list = $GLOBALS['db']->getCol($sql); |
| | | foreach ($attr_list AS $attr) |
| | | { |
| | | $row['goods_name'] .= ' [' . $attr . '] '; |
| | | } |
| | | } |
| | | /* 增加是否在购物车里显示商品图 */ |
| | | if (($GLOBALS['_CFG']['show_goods_in_cart'] == "2" || $GLOBALS['_CFG']['show_goods_in_cart'] == "3") && $row['extension_code'] != 'package_buy') |
| | | { |
| | | $goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'"); |
| | | $row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true); |
| | | } |
| | | if ($row['extension_code'] == 'package_buy') |
| | | { |
| | | $row['package_goods_list'] = get_package_goods($row['goods_id'], $row['package_attr_id'] ); //修改 by 增加一个变量 |
| | | } |
| | | |
| | | /* 代码增加_start By */ |
| | | $row['is_cansel'] = is_cansel($row['goods_id'], $row['product_id'], $row['package_buy']); |
| | | |
| | | if($row['supplier_id']) |
| | | { |
| | | $supplier_name = $GLOBALS['db']->getOne("select supplier_name from ". $GLOBALS['ecs']->table('supplier') ." where supplier_id='". $row['supplier_id']."' "); |
| | | $supplier_name = '供货商:'. $supplier_name; |
| | | } |
| | | else |
| | | { |
| | | $supplier_name = '网站自营'; |
| | | } |
| | | |
| | | $keyname = $row['supplier_id'] ? $row['supplier_id'] : '0' ; |
| | | $goods_list[$keyname]['goods_list'][] = $row; |
| | | $goods_list[$keyname]['supplier_name'] = $supplier_name; |
| | | ksort($goods_list); |
| | | |
| | | //$goods_list[] = $row; |
| | | |
| | | /* 代码修改_end By */ |
| | | } |
| | | $total['goods_amount'] = $total['goods_price']; |
| | | $total['saving'] = price_format($total['market_price'] - $total['goods_price'], false); |
| | | if ($total['market_price'] > 0) |
| | | { |
| | | $total['save_rate'] = $total['market_price'] ? round(($total['market_price'] - $total['goods_price']) * |
| | | 100 / $total['market_price']).'%' : 0; |
| | | } |
| | | $total['goods_price'] = price_format($total['goods_price'], false); |
| | | $total['market_price'] = price_format($total['market_price'], false); |
| | | $total['real_goods_count'] = $real_goods_count; |
| | | $total['virtual_goods_count'] = $virtual_goods_count; |
| | | |
| | | return array('goods_list' => $goods_list, 'total' => $total); |
| | | } |
| | | |
| | | /** |
| | | * 取得收货人信息 |
| | | * @param int $user_id 用户编号 |
| | | * @return array |
| | | */ |
| | | function get_consignee($user_id) |
| | | { |
| | | if (isset($_SESSION['flow_consignee'])) |
| | | { |
| | | //如果在用户中心首次新增地址,去结算时获得的session只有$_SESSION['flow_consignee']['country'] |
| | | if(!isset($_SESSION['flow_consignee']['province'])) |
| | | { |
| | | if ($user_id > 0) |
| | | { |
| | | /* 取默认地址 */ |
| | | $sql = "SELECT * FROM ".$GLOBALS['ecs']->table('user_address')." WHERE user_id='$user_id'"; |
| | | $arr = $GLOBALS['db']->getRow($sql); |
| | | return $arr; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | return $_SESSION['flow_consignee']; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | /* 如果不存在,则取得用户的默认收货人信息 */ |
| | | $arr = array(); |
| | | |
| | | if ($user_id > 0) |
| | | { |
| | | /* 取默认地址 */ |
| | | $sql = "SELECT ua.*". |
| | | " FROM " . $GLOBALS['ecs']->table('user_address') . "AS ua, ".$GLOBALS['ecs']->table('users').' AS u '. |
| | | " WHERE u.user_id='$user_id' AND ua.address_id = u.address_id"; |
| | | |
| | | $arr = $GLOBALS['db']->getRow($sql); |
| | | } |
| | | return $arr; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询购物车(订单id为0)或订单中是否有实体商品 |
| | | * @param int $order_id 订单id |
| | | * @param int $flow_type 购物流程类型 |
| | | * @return bool |
| | | */ |
| | | function exist_real_goods($order_id = 0, $flow_type = CART_GENERAL_GOODS) |
| | | { |
| | | if ($order_id <= 0) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "' AND is_real = 1 " . |
| | | "AND rec_type = '$flow_type'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id' AND is_real = 1"; |
| | | } |
| | | |
| | | return $GLOBALS['db']->getOne($sql) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 检查收货人信息是否完整 |
| | | * @param array $consignee 收货人信息 |
| | | * @param int $flow_type 购物流程类型 |
| | | * @return bool true 完整 false 不完整 |
| | | */ |
| | | |
| | | /* 代码修改_start By */ |
| | | function check_consignee_info($consignee, $flow_type) |
| | | { |
| | | if (exist_real_goods(0, $flow_type)) |
| | | { |
| | | /* 如果存在实体商品 */ |
| | | $res = !empty($consignee['consignee']) && |
| | | !empty($consignee['country']) ; |
| | | |
| | | if ($res) |
| | | { |
| | | if (empty($consignee['province'])) |
| | | { |
| | | /* 没有设置省份,检查当前国家下面有没有设置省份 */ |
| | | $pro = get_regions(1, $consignee['country']); |
| | | $res = empty($pro); |
| | | } |
| | | elseif (empty($consignee['city'])) |
| | | { |
| | | /* 没有设置城市,检查当前省下面有没有城市 */ |
| | | $city = get_regions(2, $consignee['province']); |
| | | $res = empty($city); |
| | | } |
| | | elseif (empty($consignee['district'])) |
| | | { |
| | | $dist = get_regions(3, $consignee['city']); |
| | | $res = empty($dist); |
| | | } |
| | | } |
| | | |
| | | return $res; |
| | | } |
| | | else |
| | | { |
| | | /* 如果不存在实体商品 */ |
| | | return !empty($consignee['consignee']) ; |
| | | } |
| | | } |
| | | /* 代码修改_end By */ |
| | | |
| | | /** |
| | | * 获得上一次用户采用的支付和配送方式 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function last_shipping_and_payment() |
| | | { |
| | | $sql = "SELECT shipping_id, pay_id " . |
| | | " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE user_id = '$_SESSION[user_id]' " . |
| | | " ORDER BY order_id DESC LIMIT 1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (empty($row)) |
| | | { |
| | | /* 如果获得是一个空数组,则返回默认值 */ |
| | | $row = array('shipping_id' => 0, 'pay_id' => 0); |
| | | } |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 取得当前用户应该得到的红包总额 |
| | | */ |
| | | function get_total_bonus() |
| | | { |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | /* 按商品发的红包 */ |
| | | $sql = "SELECT SUM(c.goods_number * t.type_money)" . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " |
| | | . $GLOBALS['ecs']->table('bonus_type') . " AS t, " |
| | | . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.session_id = '" . SESS_ID . "' " . |
| | | "AND c.is_gift = 0 " . |
| | | "AND c.goods_id = g.goods_id " . |
| | | "AND g.bonus_type_id = t.type_id " . |
| | | "AND t.send_type = '" . SEND_BY_GOODS . "' " . |
| | | "AND t.send_start_date <= '$today' " . |
| | | "AND t.send_end_date >= '$today' " . |
| | | "AND c.rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $goods_total = floatval($GLOBALS['db']->getOne($sql)); |
| | | |
| | | /* 取得购物车中非赠品总金额 */ |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "' " . |
| | | " AND is_gift = 0 " . |
| | | " AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $amount = floatval($GLOBALS['db']->getOne($sql)); |
| | | |
| | | /* 按订单发的红包 */ |
| | | $sql = "SELECT FLOOR('$amount' / min_amount) * type_money " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . |
| | | " WHERE send_type = '" . SEND_BY_ORDER . "' " . |
| | | " AND send_start_date <= '$today' " . |
| | | "AND send_end_date >= '$today' " . |
| | | "AND min_amount > 0 "; |
| | | $order_total = floatval($GLOBALS['db']->getOne($sql)); |
| | | |
| | | return $goods_total + $order_total; |
| | | } |
| | | |
| | | /** |
| | | * 处理红包(下订单时设为使用,取消(无效,退货)订单时设为未使用 |
| | | * @param int $bonus_id 红包编号 |
| | | * @param int $order_id 订单号 |
| | | * @param int $is_used 是否使用了 |
| | | */ |
| | | function change_user_bonus($bonus_id, $order_id, $is_used = true) |
| | | { |
| | | if ($is_used) |
| | | { |
| | | $sql = 'UPDATE ' . $GLOBALS['ecs']->table('user_bonus') . ' SET ' . |
| | | 'used_time = ' . gmtime() . ', ' . |
| | | "order_id = '$order_id' " . |
| | | "WHERE bonus_id = '$bonus_id'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = 'UPDATE ' . $GLOBALS['ecs']->table('user_bonus') . ' SET ' . |
| | | 'used_time = 0, ' . |
| | | 'order_id = 0 ' . |
| | | "WHERE bonus_id = '$bonus_id'"; |
| | | } |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 获得订单信息 |
| | | * |
| | | * @access private |
| | | * @return array |
| | | */ |
| | | function flow_order_info() |
| | | { |
| | | $order = isset($_SESSION['flow_order']) ? $_SESSION['flow_order'] : array(); |
| | | |
| | | /* 初始化配送和支付方式 */ |
| | | if (!isset($order['shipping_id']) || !isset($order['pay_id'])) |
| | | { |
| | | /* 如果还没有设置配送和支付 */ |
| | | if ($_SESSION['user_id'] > 0) |
| | | { |
| | | /* 用户已经登录了,则获得上次使用的配送和支付 */ |
| | | $arr = last_shipping_and_payment(); |
| | | |
| | | if (!isset($order['shipping_id'])) |
| | | { |
| | | $order['shipping_id'] = $arr['shipping_id']; |
| | | } |
| | | if (!isset($order['pay_id'])) |
| | | { |
| | | $order['pay_id'] = $arr['pay_id']; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!isset($order['shipping_id'])) |
| | | { |
| | | $order['shipping_id'] = 0; |
| | | } |
| | | if (!isset($order['pay_id'])) |
| | | { |
| | | $order['pay_id'] = 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!isset($order['pack_id'])) |
| | | { |
| | | $order['pack_id'] = 0; // 初始化包装 |
| | | } |
| | | if (!isset($order['card_id'])) |
| | | { |
| | | $order['card_id'] = 0; // 初始化贺卡 |
| | | } |
| | | if (!isset($order['bonus'])) |
| | | { |
| | | $order['bonus'] = 0; // 初始化红包 |
| | | } |
| | | if (!isset($order['integral'])) |
| | | { |
| | | $order['integral'] = 0; // 初始化积分 |
| | | } |
| | | if (!isset($order['surplus'])) |
| | | { |
| | | $order['surplus'] = 0; // 初始化余额 |
| | | } |
| | | |
| | | /* 扩展信息 */ |
| | | if (isset($_SESSION['flow_type']) && intval($_SESSION['flow_type']) != CART_GENERAL_GOODS) |
| | | { |
| | | $order['extension_code'] = $_SESSION['extension_code']; |
| | | $order['extension_id'] = $_SESSION['extension_id']; |
| | | } |
| | | |
| | | return $order; |
| | | } |
| | | |
| | | /** |
| | | * 合并订单 |
| | | * @param string $from_order_sn 从订单号 |
| | | * @param string $to_order_sn 主订单号 |
| | | * @return 成功返回true,失败返回错误信息 |
| | | */ |
| | | function merge_order($from_order_sn, $to_order_sn) |
| | | { |
| | | /* 订单号不能为空 */ |
| | | if (trim($from_order_sn) == '' || trim($to_order_sn) == '') |
| | | { |
| | | return $GLOBALS['_LANG']['order_sn_not_null']; |
| | | } |
| | | |
| | | /* 订单号不能相同 */ |
| | | if ($from_order_sn == $to_order_sn) |
| | | { |
| | | return $GLOBALS['_LANG']['two_order_sn_same']; |
| | | } |
| | | |
| | | /* 取得订单信息 */ |
| | | $from_order = order_info(0, $from_order_sn); |
| | | $to_order = order_info(0, $to_order_sn); |
| | | |
| | | /* 检查订单是否存在 */ |
| | | if (!$from_order) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['order_not_exist'], $from_order_sn); |
| | | } |
| | | elseif (!$to_order) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['order_not_exist'], $to_order_sn); |
| | | } |
| | | |
| | | /* 检查合并的订单是否为普通订单,非普通订单不允许合并 */ |
| | | if ($from_order['extension_code'] != '' || $to_order['extension_code'] != 0) |
| | | { |
| | | return $GLOBALS['_LANG']['merge_invalid_order']; |
| | | } |
| | | |
| | | /* 检查订单状态是否是已确认或未确认、未付款、未发货 */ |
| | | if ($from_order['order_status'] != OS_UNCONFIRMED && $from_order['order_status'] != OS_CONFIRMED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $from_order_sn); |
| | | } |
| | | elseif ($from_order['pay_status'] != PS_UNPAYED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $from_order_sn); |
| | | } |
| | | elseif ($from_order['shipping_status'] != SS_UNSHIPPED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $from_order_sn); |
| | | } |
| | | |
| | | if ($to_order['order_status'] != OS_UNCONFIRMED && $to_order['order_status'] != OS_CONFIRMED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $to_order_sn); |
| | | } |
| | | elseif ($to_order['pay_status'] != PS_UNPAYED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $to_order_sn); |
| | | } |
| | | elseif ($to_order['shipping_status'] != SS_UNSHIPPED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $to_order_sn); |
| | | } |
| | | |
| | | /* 检查订单用户是否相同 */ |
| | | if ($from_order['user_id'] != $to_order['user_id']) |
| | | { |
| | | return $GLOBALS['_LANG']['order_user_not_same']; |
| | | } |
| | | |
| | | /* 合并订单 */ |
| | | $order = $to_order; |
| | | $order['order_id'] = ''; |
| | | $order['add_time'] = gmtime(); |
| | | |
| | | // 合并商品总额 |
| | | $order['goods_amount'] += $from_order['goods_amount']; |
| | | |
| | | // 合并折扣 |
| | | $order['discount'] += $from_order['discount']; |
| | | |
| | | if ($order['shipping_id'] > 0) |
| | | { |
| | | // 重新计算配送费用 |
| | | $weight_price = order_weight_price($to_order['order_id']); |
| | | $from_weight_price = order_weight_price($from_order['order_id']); |
| | | $weight_price['weight'] += $from_weight_price['weight']; |
| | | $weight_price['amount'] += $from_weight_price['amount']; |
| | | $weight_price['number'] += $from_weight_price['number']; |
| | | |
| | | $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']); |
| | | $shipping_area = shipping_area_info($order['shipping_id'], $region_id_list); |
| | | |
| | | $order['shipping_fee'] = shipping_fee($shipping_area['shipping_code'], |
| | | unserialize($shipping_area['configure']), $weight_price['weight'], $weight_price['amount'], $weight_price['number']); |
| | | |
| | | // 如果保价了,重新计算保价费 |
| | | if ($order['insure_fee'] > 0) |
| | | { |
| | | $order['insure_fee'] = shipping_insure_fee($shipping_area['shipping_code'], $order['goods_amount'], $shipping_area['insure']); |
| | | } |
| | | } |
| | | |
| | | // 重新计算包装费、贺卡费 |
| | | if ($order['pack_id'] > 0) |
| | | { |
| | | $pack = pack_info($order['pack_id']); |
| | | $order['pack_fee'] = $pack['free_money'] > $order['goods_amount'] ? $pack['pack_fee'] : 0; |
| | | } |
| | | if ($order['card_id'] > 0) |
| | | { |
| | | $card = card_info($order['card_id']); |
| | | $order['card_fee'] = $card['free_money'] > $order['goods_amount'] ? $card['card_fee'] : 0; |
| | | } |
| | | |
| | | // 红包不变,合并积分、余额、已付款金额 |
| | | $order['integral'] += $from_order['integral']; |
| | | $order['integral_money'] = value_of_integral($order['integral']); |
| | | $order['surplus'] += $from_order['surplus']; |
| | | $order['money_paid'] += $from_order['money_paid']; |
| | | |
| | | // 计算应付款金额(不包括支付费用) |
| | | $order['order_amount'] = $order['goods_amount'] - $order['discount'] |
| | | + $order['shipping_fee'] |
| | | + $order['insure_fee'] |
| | | + $order['pack_fee'] |
| | | + $order['card_fee'] |
| | | - $order['bonus'] |
| | | - $order['integral_money'] |
| | | - $order['surplus'] |
| | | - $order['money_paid']; |
| | | |
| | | // 重新计算支付费 |
| | | if ($order['pay_id'] > 0) |
| | | { |
| | | // 货到付款手续费 |
| | | $cod_fee = $shipping_area ? $shipping_area['pay_fee'] : 0; |
| | | $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee); |
| | | |
| | | // 应付款金额加上支付费 |
| | | $order['order_amount'] += $order['pay_fee']; |
| | | } |
| | | |
| | | /* 插入订单表 */ |
| | | do |
| | | { |
| | | $order['order_sn'] = get_order_sn(); |
| | | if ($GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), addslashes_deep($order), 'INSERT')) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | if ($GLOBALS['db']->errno() != 1062) |
| | | { |
| | | die($GLOBALS['db']->errorMsg()); |
| | | } |
| | | } |
| | | } |
| | | while (true); // 防止订单号重复 |
| | | |
| | | /* 订单号 */ |
| | | $order_id = $GLOBALS['db']->insert_id(); |
| | | |
| | | /* 更新订单商品 */ |
| | | $sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_goods') . |
| | | " SET order_id = '$order_id' " . |
| | | "WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id'])); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | include_once(ROOT_PATH . 'includes/lib_clips.php'); |
| | | /* 插入支付日志 */ |
| | | insert_pay_log($order_id, $order['order_amount'], PAY_ORDER); |
| | | |
| | | /* 删除原订单 */ |
| | | $sql = 'DELETE FROM ' . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id'])); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 删除原订单支付日志 */ |
| | | $sql = 'DELETE FROM ' . $GLOBALS['ecs']->table('pay_log') . |
| | | " WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id'])); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 返还 from_order 的红包,因为只使用 to_order 的红包 */ |
| | | if ($from_order['bonus_id'] > 0) |
| | | { |
| | | unuse_bonus($from_order['bonus_id']); |
| | | } |
| | | |
| | | /* 返回成功 */ |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 查询配送区域属于哪个办事处管辖 |
| | | * @param array $regions 配送区域(1、2、3、4级按顺序) |
| | | * @return int 办事处id,可能为0 |
| | | */ |
| | | function get_agency_by_regions($regions) |
| | | { |
| | | if (!is_array($regions) || empty($regions)) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | $arr = array(); |
| | | $sql = "SELECT region_id, agency_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('region') . |
| | | " WHERE region_id " . db_create_in($regions) . |
| | | " AND region_id > 0 AND agency_id > 0"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $arr[$row['region_id']] = $row['agency_id']; |
| | | } |
| | | if (empty($arr)) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | $agency_id = 0; |
| | | for ($i = count($regions) - 1; $i >= 0; $i--) |
| | | { |
| | | if (isset($arr[$regions[$i]])) |
| | | { |
| | | return $arr[$regions[$i]]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取配送插件的实例 |
| | | * @param int $shipping_id 配送插件ID |
| | | * @return object 配送插件对象实例 |
| | | */ |
| | | function &get_shipping_object($shipping_id) |
| | | { |
| | | $shipping = shipping_info($shipping_id); |
| | | if (!$shipping) |
| | | { |
| | | $object = new stdClass(); |
| | | return $object; |
| | | } |
| | | |
| | | $file_path = ROOT_PATH.'includes/modules/shipping/' . $shipping['shipping_code'] . '.php'; |
| | | |
| | | include_once($file_path); |
| | | |
| | | $object = new $shipping['shipping_code']; |
| | | return $object; |
| | | } |
| | | |
| | | /** |
| | | * 改变订单中商品库存 |
| | | * @param int $order_id 订单号 |
| | | * @param bool $is_dec 是否减少库存 |
| | | * @param bool $storage 减库存的时机,1,下订单时;0,发货时; |
| | | */ |
| | | function change_order_goods_storage($order_id, $is_dec = true, $storage = 0) |
| | | { |
| | | /* 查询订单商品信息 */ |
| | | switch ($storage) |
| | | { |
| | | case 0 : |
| | | $sql = "SELECT goods_id, SUM(send_number) AS num, MAX(extension_code) AS extension_code, product_id FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id' AND is_real = 1 GROUP BY goods_id, product_id"; |
| | | break; |
| | | |
| | | case 1 : |
| | | $sql = "SELECT goods_id, SUM(goods_number) AS num, MAX(extension_code) AS extension_code, product_id FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id' AND is_real = 1 GROUP BY goods_id, product_id"; |
| | | break; |
| | | } |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['extension_code'] != "package_buy") |
| | | { |
| | | if ($is_dec) |
| | | { |
| | | change_goods_storage($row['goods_id'], $row['product_id'], - $row['num']); |
| | | } |
| | | else |
| | | { |
| | | change_goods_storage($row['goods_id'], $row['product_id'], $row['num']); |
| | | } |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT goods_id, goods_number" . |
| | | " FROM " . $GLOBALS['ecs']->table('package_goods') . |
| | | " WHERE package_id = '" . $row['goods_id'] . "'"; |
| | | $res_goods = $GLOBALS['db']->query($sql); |
| | | while ($row_goods = $GLOBALS['db']->fetchRow($res_goods)) |
| | | { |
| | | $sql = "SELECT is_real" . |
| | | " FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id = '" . $row_goods['goods_id'] . "'"; |
| | | $real_goods = $GLOBALS['db']->query($sql); |
| | | $is_goods = $GLOBALS['db']->fetchRow($real_goods); |
| | | |
| | | if ($is_dec) |
| | | { |
| | | change_goods_storage($row_goods['goods_id'], $row['product_id'], - ($row['num'] * $row_goods['goods_number'])); |
| | | } |
| | | elseif ($is_goods['is_real']) |
| | | { |
| | | change_goods_storage($row_goods['goods_id'], $row['product_id'], ($row['num'] * $row_goods['goods_number'])); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 商品库存增与减 货品库存增与减 |
| | | * |
| | | * @param int $good_id 商品ID |
| | | * @param int $product_id 货品ID |
| | | * @param int $number 增减数量,默认0; |
| | | * |
| | | * @return bool true,成功;false,失败; |
| | | */ |
| | | function change_goods_storage($good_id, $product_id, $number = 0) |
| | | { |
| | | if ($number == 0) |
| | | { |
| | | return true; // 值为0即不做、增减操作,返回true |
| | | } |
| | | |
| | | if (empty($good_id) || empty($number)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | $number = ($number > 0) ? '+ ' . $number : $number; |
| | | |
| | | /* 处理货品库存 */ |
| | | $products_query = true; |
| | | if (!empty($product_id)) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('products') ." |
| | | SET product_number = product_number $number |
| | | WHERE goods_id = '$good_id' |
| | | AND product_id = '$product_id' |
| | | LIMIT 1"; |
| | | $products_query = $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /* 处理商品库存 */ |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('goods') ." |
| | | SET goods_number = goods_number $number |
| | | WHERE goods_id = '$good_id' |
| | | LIMIT 1"; |
| | | $query = $GLOBALS['db']->query($sql); |
| | | |
| | | if ($query && $products_query) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得支付方式id列表 |
| | | * @param bool $is_cod 是否货到付款 |
| | | * @return array |
| | | */ |
| | | function payment_id_list($is_cod) |
| | | { |
| | | $sql = "SELECT pay_id FROM " . $GLOBALS['ecs']->table('payment'); |
| | | if ($is_cod) |
| | | { |
| | | $sql .= " WHERE is_cod = 1"; |
| | | } |
| | | else |
| | | { |
| | | $sql .= " WHERE is_cod = 0"; |
| | | } |
| | | |
| | | return $GLOBALS['db']->getCol($sql); |
| | | } |
| | | |
| | | /** |
| | | * 生成查询订单的sql |
| | | * @param string $type 类型 |
| | | * @param string $alias order表的别名(包括.例如 o.) |
| | | * @return string |
| | | */ |
| | | function order_query_sql($type = 'finished', $alias = '') |
| | | { |
| | | /* 已完成订单 */ |
| | | if ($type == 'finished') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) . |
| | | " AND {$alias}shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . |
| | | " AND {$alias}pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " "; |
| | | } |
| | | /* 待发货订单 */ |
| | | elseif ($type == 'await_ship') |
| | | { |
| | | return " AND {$alias}order_status " . |
| | | db_create_in(array(OS_CONFIRMED, OS_SPLITED, OS_SPLITING_PART)) . |
| | | " AND {$alias}shipping_status " . |
| | | db_create_in(array(SS_UNSHIPPED, SS_PREPARING, SS_SHIPPED_ING)) . |
| | | " AND ( {$alias}pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " OR {$alias}pay_id " . db_create_in(payment_id_list(true)) . ") "; |
| | | } |
| | | /* 待付款订单 */ |
| | | elseif ($type == 'await_pay') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) . |
| | | " AND {$alias}pay_status = '" . PS_UNPAYED . "'" . |
| | | " AND ( {$alias}shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " OR {$alias}pay_id " . db_create_in(payment_id_list(false)) . ") "; |
| | | } |
| | | /* 未确认订单 */ |
| | | elseif ($type == 'unconfirmed') |
| | | { |
| | | return " AND {$alias}order_status = '" . OS_UNCONFIRMED . "' "; |
| | | } |
| | | /* 未处理订单:用户可操作 */ |
| | | elseif ($type == 'unprocessed') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_UNCONFIRMED, OS_CONFIRMED)) . |
| | | " AND {$alias}shipping_status = '" . SS_UNSHIPPED . "'" . |
| | | " AND {$alias}pay_status = '" . PS_UNPAYED . "' "; |
| | | } |
| | | /* 未付款未发货订单:管理员可操作 */ |
| | | elseif ($type == 'unpay_unship') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_UNCONFIRMED, OS_CONFIRMED)) . |
| | | " AND {$alias}shipping_status " . db_create_in(array(SS_UNSHIPPED, SS_PREPARING)) . |
| | | " AND {$alias}pay_status = '" . PS_UNPAYED . "' "; |
| | | } |
| | | /* 已发货订单:不论是否付款 */ |
| | | elseif ($type == 'shipped') |
| | | { |
| | | return " AND {$alias}order_status = '" . OS_CONFIRMED . "'" . |
| | | " AND {$alias}shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " "; |
| | | } |
| | | else |
| | | { |
| | | die('函数 order_query_sql 参数错误'); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成查询订单总金额的字段 |
| | | * @param string $alias order表的别名(包括.例如 o.) |
| | | * @return string |
| | | */ |
| | | function order_amount_field($alias = '') |
| | | { |
| | | return " {$alias}goods_amount + {$alias}tax + {$alias}shipping_fee" . |
| | | " + {$alias}insure_fee + {$alias}pay_fee + {$alias}pack_fee" . |
| | | " + {$alias}card_fee "; |
| | | } |
| | | |
| | | /** |
| | | * 生成计算应付款金额的字段 |
| | | * @param string $alias order表的别名(包括.例如 o.) |
| | | * @return string |
| | | */ |
| | | function order_due_field($alias = '') |
| | | { |
| | | return order_amount_field($alias) . |
| | | " - {$alias}money_paid - {$alias}surplus - {$alias}integral_money" . |
| | | " - {$alias}bonus - {$alias}discount "; |
| | | } |
| | | |
| | | /** |
| | | * 计算折扣:根据购物车和优惠活动 |
| | | * @param int $supplierid 店铺id |
| | | * @return float 折扣 |
| | | */ |
| | | function compute_discount($supplierid=-1) |
| | | { |
| | | /* 查询优惠活动 */ |
| | | $now = gmtime(); |
| | | //jx 查询用户等级 |
| | | $user_id = $_SESSION['user_id']; |
| | | $sql = "SELECT rank_points FROM ".$GLOBALS['ecs']->table('users')." WHERE `user_id`='$user_id'"; |
| | | $rank_points = $GLOBALS['db']->getOne($sql); |
| | | $sql = "SELECT rank_id FROM " . $GLOBALS['ecs']->table('user_rank') . " WHERE max_points > '$rank_points' ORDER BY max_points ASC LIMIT 1"; |
| | | $user_rank = $GLOBALS['db']->getOne($sql); |
| | | /// 结束 jx |
| | | ///$user_rank = ',' . $_SESSION['user_rank'] . ','; |
| | | $sql = "SELECT *" . |
| | | "FROM " . $GLOBALS['ecs']->table('favourable_activity') . |
| | | " WHERE start_time <= '$now'" . |
| | | " AND end_time >= '$now'" . |
| | | " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'" . |
| | | " AND act_type " . db_create_in(array(FAT_DISCOUNT, FAT_PRICE)); |
| | | $sql .= ($supplierid>=0) ? " AND supplier_id=".$supplierid : ""; |
| | | $favourable_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$favourable_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 查询购物车商品 */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT c.goods_id, c.goods_price * c.goods_number AS subtotal, g.cat_id, g.brand_id, g.supplier_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND " .$sql_where. |
| | | "AND c.parent_id = 0 " . |
| | | "AND c.is_gift = 0 " . |
| | | "AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $sql .= (isset($_SESSION['sel_cartgoods']) && !empty($_SESSION['sel_cartgoods'])) ? " AND c.rec_id in (". $_SESSION['sel_cartgoods'] .") " : ""; |
| | | $sql .= ($supplierid>=0) ? " AND g.supplier_id=".$supplierid : ""; |
| | | $goods_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$goods_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 初始化折扣 */ |
| | | $discount = 0; |
| | | $favourable_name = array(); |
| | | |
| | | /* 循环计算每个优惠活动的折扣 */ |
| | | foreach ($favourable_list as $favourable) |
| | | { |
| | | $total_amount = 0; |
| | | if ($favourable['act_range'] == FAR_ALL) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if($favourable['supplier_id'] == $goods['supplier_id']){ |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | /* 找出分类id的子分类id */ |
| | | $id_list = array(); |
| | | $raw_id_list = explode(',', $favourable['act_range_ext']); |
| | | foreach ($raw_id_list as $id) |
| | | { |
| | | $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false))); |
| | | } |
| | | $ids = join(',', array_unique($id_list)); |
| | | |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $ids . ',', ',' . $goods['cat_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['brand_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_GOODS) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['goods_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | /* 如果金额满足条件,累计折扣 */ |
| | | if ($total_amount > 0 && $total_amount >= $favourable['min_amount'] && ($total_amount <= $favourable['max_amount'] || $favourable['max_amount'] == 0)) |
| | | { |
| | | if ($favourable['act_type'] == FAT_DISCOUNT) |
| | | { |
| | | $discount += $total_amount * (1 - $favourable['act_type_ext'] / 100); |
| | | |
| | | $favourable_name[] = $favourable['act_name']; |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_PRICE) |
| | | { |
| | | $discount += $favourable['act_type_ext']; |
| | | |
| | | $favourable_name[] = $favourable['act_name']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return array('discount' => $discount, 'name' => $favourable_name); |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车该赠送的积分数 |
| | | * @return int 积分数 |
| | | */ |
| | | function get_give_integral() |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | if($_SESSION['sel_cartgoods']){ |
| | | $sql_plus = " AND c.rec_id in (".$_SESSION['sel_cartgoods'].") "; |
| | | } |
| | | |
| | | $sql = "SELECT SUM(c.goods_number * IF(g.give_integral > -1, g.give_integral, c.goods_price))" . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND $sql_where " . |
| | | $sql_plus . |
| | | "AND c.goods_id > 0 " . |
| | | "AND c.parent_id = 0 " . |
| | | "AND c.rec_type = 0 " . |
| | | "AND c.is_gift = 0"; |
| | | |
| | | return intval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 取得某订单应该赠送的积分数 |
| | | * @param array $order 订单 |
| | | * @return int 积分数 |
| | | */ |
| | | function integral_to_give($order) |
| | | { |
| | | /* 判断是否团购 */ |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | include_once(ROOT_PATH . 'includes/lib_goods.php'); |
| | | $group_buy = group_buy_info(intval($order['extension_id'])); |
| | | |
| | | return array('custom_points' => $group_buy['gift_integral'], 'rank_points' => $order['goods_amount']); |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT SUM(og.goods_number * IF(g.give_integral > -1, g.give_integral, og.goods_price)) AS custom_points, SUM(og.goods_number * IF(g.rank_integral > -1, g.rank_integral, og.goods_price)) AS rank_points " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE og.goods_id = g.goods_id " . |
| | | "AND og.order_id = '$order[order_id]' " . |
| | | "AND og.goods_id > 0 " . |
| | | "AND og.parent_id = 0 " . |
| | | "AND og.is_gift = 0 AND og.extension_code != 'package_buy'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发红包:发货时发红包 |
| | | * @param int $order_id 订单号 |
| | | * @return bool |
| | | */ |
| | | function send_order_bonus($order_id) |
| | | { |
| | | /* 取得订单应该发放的红包 */ |
| | | $bonus_list = order_bonus($order_id); |
| | | |
| | | /* 如果有红包,统计并发送 */ |
| | | if ($bonus_list) |
| | | { |
| | | /* 用户信息 */ |
| | | $sql = "SELECT u.user_id, u.user_name, u.email " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_info') . " AS o, " . |
| | | $GLOBALS['ecs']->table('users') . " AS u " . |
| | | "WHERE o.order_id = '$order_id' " . |
| | | "AND o.user_id = u.user_id "; |
| | | $user = $GLOBALS['db']->getRow($sql); |
| | | |
| | | /* 统计 */ |
| | | $count = 0; |
| | | $money = ''; |
| | | foreach ($bonus_list AS $bonus) |
| | | { |
| | | $count += $bonus['number']; |
| | | $money .= price_format($bonus['type_money']) . ' [' . $bonus['number'] . '], '; |
| | | |
| | | /* 修改用户红包 */ |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('user_bonus') . " (bonus_type_id, user_id) " . |
| | | "VALUES('$bonus[type_id]', '$user[user_id]')"; |
| | | for ($i = 0; $i < $bonus['number']; $i++) |
| | | { |
| | | if (!$GLOBALS['db']->query($sql)) |
| | | { |
| | | return $GLOBALS['db']->errorMsg(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* 如果有红包,发送邮件 */ |
| | | if ($count > 0) |
| | | { |
| | | $tpl = get_mail_template('send_bonus'); |
| | | $GLOBALS['smarty']->assign('user_name', $user['user_name']); |
| | | $GLOBALS['smarty']->assign('count', $count); |
| | | $GLOBALS['smarty']->assign('money', $money); |
| | | $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']); |
| | | $GLOBALS['smarty']->assign('send_date', local_date($GLOBALS['_CFG']['date_format'])); |
| | | $GLOBALS['smarty']->assign('sent_date', local_date($GLOBALS['_CFG']['date_format'])); |
| | | $content = $GLOBALS['smarty']->fetch('str:' . $tpl['template_content']); |
| | | send_mail($user['user_name'], $user['email'], $tpl['template_subject'], $content, $tpl['is_html']); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 返回订单发放的红包 |
| | | * @param int $order_id 订单id |
| | | */ |
| | | function return_order_bonus($order_id) |
| | | { |
| | | /* 取得订单应该发放的红包 */ |
| | | $bonus_list = order_bonus($order_id); |
| | | |
| | | /* 删除 */ |
| | | if ($bonus_list) |
| | | { |
| | | /* 取得订单信息 */ |
| | | $order = order_info($order_id); |
| | | $user_id = $order['user_id']; |
| | | |
| | | foreach ($bonus_list AS $bonus) |
| | | { |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " WHERE bonus_type_id = '$bonus[type_id]' " . |
| | | "AND user_id = '$user_id' " . |
| | | "AND order_id = '0' LIMIT " . $bonus['number']; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得订单应该发放的红包 |
| | | * @param int $order_id 订单id |
| | | * @return array |
| | | */ |
| | | function order_bonus($order_id) |
| | | { |
| | | /* 查询按商品发的红包 */ |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | $sql = "SELECT b.type_id, b.type_money, SUM(o.goods_number) AS number " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS o, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g, " . |
| | | $GLOBALS['ecs']->table('bonus_type') . " AS b " . |
| | | " WHERE o.order_id = '$order_id' " . |
| | | " AND o.is_gift = 0 " . |
| | | " AND o.goods_id = g.goods_id " . |
| | | " AND g.bonus_type_id = b.type_id " . |
| | | " AND b.send_type = '" . SEND_BY_GOODS . "' " . |
| | | " AND b.send_start_date <= '$today' " . |
| | | " AND b.send_end_date >= '$today' " . |
| | | " GROUP BY b.type_id "; |
| | | $list = $GLOBALS['db']->getAll($sql); |
| | | |
| | | /* 查询定单中非赠品总金额 */ |
| | | $amount = order_amount($order_id, false); |
| | | |
| | | /* 查询订单日期 */ |
| | | $sql = "SELECT add_time " . |
| | | " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_id = '$order_id' LIMIT 1"; |
| | | $order_time = $GLOBALS['db']->getOne($sql); |
| | | |
| | | /* 查询按订单发的红包 */ |
| | | $sql = "SELECT type_id, type_money, IFNULL(FLOOR('$amount' / min_amount), 1) AS number " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . |
| | | "WHERE send_type = '" . SEND_BY_ORDER . "' " . |
| | | "AND send_start_date <= '$order_time' " . |
| | | "AND send_end_date >= '$order_time' "; |
| | | $list = array_merge($list, $GLOBALS['db']->getAll($sql)); |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 计算购物车中的商品能享受红包支付的总额 |
| | | * @param int $suppid 店铺id |
| | | * @return float 享受红包支付的总额 |
| | | */ |
| | | function compute_discount_amount($suppid=-1) |
| | | { |
| | | /* 查询优惠活动 */ |
| | | $now = gmtime(); |
| | | $user_rank = ',' . $_SESSION['user_rank'] . ','; |
| | | $where_suppid = ''; |
| | | if($suppid>-1){ |
| | | $where_suppid = " AND supplier_id=".$suppid; |
| | | } |
| | | $sql = "SELECT *" . |
| | | "FROM " . $GLOBALS['ecs']->table('favourable_activity') . |
| | | " WHERE start_time <= '$now'" . |
| | | " AND end_time >= '$now'" .$where_suppid. |
| | | " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'" . |
| | | " AND act_type " . db_create_in(array(FAT_DISCOUNT, FAT_PRICE)); |
| | | $favourable_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$favourable_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 查询购物车商品 */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | if($suppid>-1){ |
| | | $where_suppid = " AND g.supplier_id=".$suppid." "; |
| | | } |
| | | $sql = "SELECT c.goods_id, c.goods_price * c.goods_number AS subtotal, g.cat_id, g.brand_id, g.supplier_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND $sql_where " .$where_suppid. |
| | | "AND c.parent_id = 0 " . |
| | | "AND c.is_gift = 0 " . |
| | | "AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $goods_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$goods_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 初始化折扣 */ |
| | | $discount = 0; |
| | | $favourable_name = array(); |
| | | |
| | | /* 循环计算每个优惠活动的折扣 */ |
| | | foreach ($favourable_list as $favourable) |
| | | { |
| | | $total_amount = 0; |
| | | if ($favourable['act_range'] == FAR_ALL) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if($favourable['supplier_id'] == $goods['supplier_id']){ |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | /* 找出分类id的子分类id */ |
| | | $id_list = array(); |
| | | $raw_id_list = explode(',', $favourable['act_range_ext']); |
| | | foreach ($raw_id_list as $id) |
| | | { |
| | | $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false))); |
| | | } |
| | | $ids = join(',', array_unique($id_list)); |
| | | |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $ids . ',', ',' . $goods['cat_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['brand_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_GOODS) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['goods_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | if ($total_amount > 0 && $total_amount >= $favourable['min_amount'] && ($total_amount <= $favourable['max_amount'] || $favourable['max_amount'] == 0)) |
| | | { |
| | | if ($favourable['act_type'] == FAT_DISCOUNT) |
| | | { |
| | | $discount += $total_amount * (1 - $favourable['act_type_ext'] / 100); |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_PRICE) |
| | | { |
| | | $discount += $favourable['act_type_ext']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return $discount; |
| | | } |
| | | |
| | | /** |
| | | * 添加礼包到购物车 |
| | | * |
| | | * @access public |
| | | * @param integer $package_id 礼包编号 |
| | | * @param integer $num 礼包数量 |
| | | * @return boolean |
| | | */ |
| | | /* 代码修改_start By 提示:增加了两个参数 */ |
| | | function add_package_to_cart($package_id, $num = 1, $package_attr_id='', $package_prices='') |
| | | { |
| | | $GLOBALS['err']->clean(); |
| | | |
| | | //增加 By |
| | | if($package_prices) |
| | | { |
| | | $package_pricea=explode("-", $package_prices); |
| | | } |
| | | |
| | | /* 取得礼包信息 */ |
| | | $package = get_package_info($package_id); |
| | | |
| | | if (empty($package)) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['goods_not_exists'], ERR_NOT_EXISTS); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 是否正在销售 */ |
| | | if ($package['is_on_sale'] == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['not_on_sale'], ERR_NOT_ON_SALE); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 现有库存是否还能凑齐一个礼包 */ |
| | | if ($GLOBALS['_CFG']['use_storage'] == '1' && judge_package_stock($package_id)) |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], 1), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 检查库存 */ |
| | | // if ($GLOBALS['_CFG']['use_storage'] == 1 && $num > $package['goods_number']) |
| | | // { |
| | | // $num = $goods['goods_number']; |
| | | // $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $num), ERR_OUT_OF_STOCK); |
| | | // |
| | | // return false; |
| | | // } |
| | | |
| | | /* 初始化要插入购物车的基本件数据 */ |
| | | $parent = array( |
| | | 'user_id' => $_SESSION['user_id'], |
| | | 'session_id' => SESS_ID, |
| | | 'goods_id' => $package_id, |
| | | 'goods_sn' => '', |
| | | 'goods_name' => addslashes($package['package_name']), |
| | | 'market_price' => $package_pricea[0] ? $package_pricea[0] : $package['market_package'], //修改 by |
| | | 'goods_price' => $package_pricea[1] ? $package_pricea[1] : $package['package_price'], //修改 by |
| | | 'package_attr_id' =>$package_attr_id, //增加 by |
| | | 'goods_number' => $num, |
| | | 'goods_attr' => '', |
| | | 'goods_attr_id' => '', |
| | | 'is_real' => $package['is_real'], |
| | | 'extension_code'=> 'package_buy', |
| | | 'is_gift' => 0, |
| | | 'rec_type' => CART_GENERAL_GOODS |
| | | ); |
| | | |
| | | /* 如果数量不为0,作为基本件插入 */ |
| | | if ($num > 0) |
| | | { |
| | | /* 检查该商品是否已经存在在购物车中 */ |
| | | $sql = "SELECT goods_number FROM " .$GLOBALS['ecs']->table('cart'). |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '" . $package_id . "' ". |
| | | " AND parent_id = 0 AND extension_code = 'package_buy' " . |
| | | " AND package_attr_id = '$package_attr_id' AND rec_type = '" . CART_GENERAL_GOODS . "'"; //修改 by 增加一条件 |
| | | |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if($row) //如果购物车已经有此物品,则更新 |
| | | { |
| | | $num += $row['goods_number']; |
| | | if ($GLOBALS['_CFG']['use_storage'] == 0 || $num > 0) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '" . $num . "'" . |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '$package_id' ". |
| | | " AND parent_id = 0 AND extension_code = 'package_buy' " . |
| | | " AND package_attr_id = '$package_attr_id' AND rec_type = '" . CART_GENERAL_GOODS . "'"; //修改 by 增加一条件 |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $num), ERR_OUT_OF_STOCK); |
| | | return false; |
| | | } |
| | | } |
| | | else //购物车没有此物品,则插入 |
| | | { |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('cart'), $parent, 'INSERT'); |
| | | } |
| | | } |
| | | |
| | | /* 把赠品删除 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | return true; |
| | | } |
| | | /* 代码修改_end By */ |
| | | /** |
| | | * 得到新发货单号 |
| | | * @return string |
| | | */ |
| | | function get_delivery_sn() |
| | | { |
| | | /* 选择一个随机的方案 */ |
| | | mt_srand((double) microtime() * 1000000); |
| | | |
| | | return date('YmdHi') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); |
| | | } |
| | | |
| | | /** |
| | | * 检查礼包内商品的库存 |
| | | * @return boolen |
| | | */ |
| | | function judge_package_stock($package_id, $package_num = 1) |
| | | { |
| | | $sql = "SELECT goods_id, product_id, goods_number |
| | | FROM " . $GLOBALS['ecs']->table('package_goods') . " |
| | | WHERE package_id = '" . $package_id . "'"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | if (empty($row)) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /* 分离货品与商品 */ |
| | | $goods = array('product_ids' => '', 'goods_ids' => ''); |
| | | foreach ($row as $value) |
| | | { |
| | | if ($value['product_id'] > 0) |
| | | { |
| | | $goods['product_ids'] .= ',' . $value['product_id']; |
| | | continue; |
| | | } |
| | | |
| | | $goods['goods_ids'] .= ',' . $value['goods_id']; |
| | | } |
| | | |
| | | /* 检查货品库存 */ |
| | | if ($goods['product_ids'] != '') |
| | | { |
| | | $sql = "SELECT p.product_id |
| | | FROM " . $GLOBALS['ecs']->table('products') . " AS p, " . $GLOBALS['ecs']->table('package_goods') . " AS pg |
| | | WHERE pg.product_id = p.product_id |
| | | AND pg.package_id = '$package_id' |
| | | AND pg.goods_number * $package_num > p.product_number |
| | | AND p.product_id IN (" . trim($goods['product_ids'], ',') . ")"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if (!empty($row)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /* 检查商品库存 */ |
| | | if ($goods['goods_ids'] != '') |
| | | { |
| | | $sql = "SELECT g.goods_id |
| | | FROM " . $GLOBALS['ecs']->table('goods') . "AS g, " . $GLOBALS['ecs']->table('package_goods') . " AS pg |
| | | WHERE pg.goods_id = g.goods_id |
| | | AND pg.goods_number * $package_num > g.goods_number |
| | | AND pg.package_id = '" . $package_id . "' |
| | | AND pg.goods_id IN (" . trim($goods['goods_ids'], ',') . ")"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if (!empty($row)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /* 代码增加_start By */ |
| | | |
| | | /* 代码增加_start By */ |
| | | function cart_weight_price2($type = CART_GENERAL_GOODS, $supplier_id) |
| | | { |
| | | $package_row['weight'] = 0; |
| | | $package_row['amount'] = 0; |
| | | $package_row['number'] = 0; |
| | | |
| | | $packages_row['free_shipping'] = 1; |
| | | |
| | | /* 计算超值礼包内商品的相关配送参数 */ |
| | | $sql = 'SELECT goods_id, goods_number, goods_price FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE extension_code = 'package_buy' AND session_id = '" . SESS_ID . "'"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if ($row) |
| | | { |
| | | $packages_row['free_shipping'] = 0; |
| | | $free_shipping_count = 0; |
| | | |
| | | foreach ($row as $val) |
| | | { |
| | | // 如果商品全为免运费商品,设置一个标识变量 |
| | | $sql = 'SELECT count(*) FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.supplier_id='". $supplier_id ."' and g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | $shipping_count = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if ($shipping_count > 0) |
| | | { |
| | | // 循环计算每个超值礼包商品的重量和数量,注意一个礼包中可能包换若干个同一商品 |
| | | $sql = 'SELECT SUM(g.goods_weight * pg.goods_number) AS weight, ' . |
| | | 'SUM(pg.goods_number) AS number FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.supplier_id='". $supplier_id ."' and g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | |
| | | $goods_row = $GLOBALS['db']->getRow($sql); |
| | | $package_row['weight'] += floatval($goods_row['weight']) * $val['goods_number']; |
| | | $package_row['amount'] += floatval($val['goods_price']) * $val['goods_number']; |
| | | $package_row['number'] += intval($goods_row['number']) * $val['goods_number']; |
| | | } |
| | | else |
| | | { |
| | | $free_shipping_count++; |
| | | } |
| | | } |
| | | |
| | | $packages_row['free_shipping'] = $free_shipping_count == count($row) ? 1 : 0; |
| | | } |
| | | |
| | | /* 获得购物车中非超值礼包商品的总重量 */ |
| | | $sql = 'SELECT SUM(g.goods_weight * c.goods_number) AS weight, ' . |
| | | 'SUM(c.goods_price * c.goods_number) AS amount, ' . |
| | | 'SUM(c.goods_number) AS number '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c '. |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = c.goods_id '. |
| | | "WHERE g.supplier_id='". $supplier_id ."' and c.session_id = '" . SESS_ID . "' " . |
| | | "AND rec_type = '$type' AND g.is_shipping = 0 AND c.extension_code != 'package_buy'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | $packages_row['weight'] = floatval($row['weight']) + $package_row['weight']; |
| | | $packages_row['amount'] = floatval($row['amount']) + $package_row['amount']; |
| | | $packages_row['number'] = intval($row['number']) + $package_row['number']; |
| | | /* 格式化重量 */ |
| | | $packages_row['formated_weight'] = formated_weight($packages_row['weight']); |
| | | |
| | | return $packages_row; |
| | | } |
| | | /* |
| | | * 获取订单对应的佣金记录id(只有店铺才计算) |
| | | * @param int $suppid 店铺id |
| | | */ |
| | | function get_order_rebate($suppid){ |
| | | $spkey = intval($suppid); |
| | | if($spkey<=0){ |
| | | return 0; |
| | | } |
| | | $sql = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $nowtime = gmtime(); |
| | | if ( $nowtime >= $row['rebate_paytime_start'] && $nowtime <= $row['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row['rebate_id']; |
| | | } |
| | | else |
| | | { |
| | | $kkk='yes'; |
| | | while($kkk=='yes') |
| | | { |
| | | insert_id_rebate($spkey); |
| | | $sql2 = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row2 = $GLOBALS['db']->getRow($sql2); |
| | | if ( $nowtime >= $row2['rebate_paytime_start'] && $nowtime <= $row2['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row2['rebate_id']; |
| | | $kkk='no'; |
| | | } |
| | | } |
| | | } |
| | | return $rebate_id; |
| | | } |
| | | |
| | | function split_order($new_order_id) |
| | | { |
| | | $sql = "select IF(g.supplier_id, g.supplier_id,0) AS supplier_id, og.rec_id, og.goods_number, og.goods_price from ". $GLOBALS['ecs']->table("order_goods") . |
| | | " AS og left join ". $GLOBALS['ecs']->table("goods") ." AS g on og.goods_id=g.goods_id ". |
| | | " where og.order_id = '$new_order_id' "; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $split_orders = array(); |
| | | $all_amount = 0; |
| | | while ($row=$GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $split_orders[$row['supplier_id']]['goods_amount'] += $row['goods_number'] * $row['goods_price']; |
| | | $split_orders[$row['supplier_id']]['goods_reclist'][] = $row['rec_id']; |
| | | $split_orders[$row['supplier_id']]['order_sn'] = $split_orders[$row['supplier_id']]['order_sn'] ? $split_orders[$row['supplier_id']]['order_sn'] : get_order_sn(); |
| | | $split_orders[$row['supplier_id']]['shipping_fee'] = $GLOBALS['total']['supplier_shipping'][$row['supplier_id']]['shipping_fee']; |
| | | $split_orders[$row['supplier_id']]['order_amount'] = $split_orders[$row['supplier_id']]['goods_amount'] + $split_orders[$row['supplier_id']]['shipping_fee']; |
| | | $split_orders[$row['supplier_id']]['order_amount_formated'] = price_format($split_orders[$row['supplier_id']]['order_amount']); |
| | | $all_amount += $split_orders[$row['supplier_id']]['order_amount']; |
| | | } |
| | | |
| | | //下单来源 |
| | | $order_from = WEB_FROM; |
| | | |
| | | $count_split_orders =count($split_orders); |
| | | |
| | | foreach ($split_orders AS $spkey => $split) |
| | | { |
| | | //获的返佣ID |
| | | if($spkey>0) |
| | | { |
| | | $sql = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $nowtime = gmtime(); |
| | | if ( $nowtime >= $row['rebate_paytime_start'] && $nowtime <= $row['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row['rebate_id']; |
| | | } |
| | | else |
| | | { |
| | | $kkk='yes'; |
| | | while($kkk=='yes') |
| | | { |
| | | insert_id_rebate($spkey); |
| | | $sql2 = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row2 = $GLOBALS['db']->getRow($sql2); |
| | | if ( $nowtime >= $row2['rebate_paytime_start'] && $nowtime <= $row2['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row2['rebate_id']; |
| | | $kkk='no'; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $rebate_id=0; |
| | | } |
| | | |
| | | $order_sn = $split['order_sn']; |
| | | if ($count_split_orders ==1) |
| | | { |
| | | $sql = "update ". $GLOBALS['ecs']->table('order_info') . |
| | | " set order_sn='$order_sn', supplier_id='$spkey', parent_order_id='0', rebate_id='$rebate_id', froms='$order_from' where order_id='$new_order_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $sql = "insert into ".$GLOBALS['ecs']->table('order_info') . "( ". |
| | | " order_sn, user_id, order_status, shipping_status, pay_status, consignee, country, province, city, district, address, zipcode, tel, mobile , email, best_time ,sign_building, postscript, shipping_id, shipping_name, pay_id, pay_name, how_oos, how_surplus, pack_name, card_name, card_message, inv_payee, inv_content, goods_amount, shipping_fee, insure_fee, pay_fee, pack_fee, card_fee, money_paid, surplus, integral, integral_money, bonus, order_amount, from_ad, referer, add_time, confirm_time, pay_time, shipping_time, pack_id, card_id, bonus_id, invoice_no, extension_code, extension_id, to_buyer, pay_note, agency_id, inv_type, tax, is_separate, parent_id, discount, supplier_id, parent_order_id, rebate_id, froms, pickup_point, is_pickup) ". |
| | | "select '$order_sn', user_id, order_status, shipping_status, pay_status, consignee, country, province, city, district, address, zipcode, tel, mobile , email, best_time ,sign_building, postscript, shipping_id, shipping_name, pay_id, pay_name, how_oos, how_surplus, pack_name, card_name, card_message, inv_payee, inv_content , '". $split['goods_amount']. "', '" . $split['shipping_fee'] ."', insure_fee, pay_fee, pack_fee, card_fee, money_paid, surplus, integral, integral_money, bonus, '". $split['order_amount'] ."', from_ad, referer, add_time, confirm_time, pay_time, shipping_time, pack_id, card_id, bonus_id, invoice_no, extension_code, extension_id, to_buyer, pay_note, agency_id, inv_type, tax, is_separate, parent_id, discount, '$spkey', '$new_order_id', '$rebate_id', '$order_from', pickup_point, is_pickup from ".$GLOBALS['ecs']->table('order_info')." where order_id= '$new_order_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | $order_id_new = $GLOBALS['db']->insert_id(); |
| | | foreach ($split['goods_reclist'] AS $rec) |
| | | { |
| | | $sql= "update ". $GLOBALS['ecs']->table('order_goods') ." set order_id='$order_id_new' where rec_id='$rec' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | if ($count_split_orders>1) |
| | | { |
| | | $sql="delete from ".$GLOBALS['ecs']->table('order_info')." where order_id='$new_order_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | $arr=array(); |
| | | $arr['suborder_list'] = $split_orders; |
| | | $arr['all_amount'] = $all_amount; |
| | | $arr['sub_order_count'] = $count_split_orders; |
| | | return $arr; |
| | | } |
| | | |
| | | function insert_id_rebate($supplier_id) |
| | | { |
| | | $sql="select supplier_rebate_paytime from ". $GLOBALS['ecs']->table('supplier') ." where supplier_id='$supplier_id'"; |
| | | $supplier_rebate_paytime = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $sql = "select rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id= '$supplier_id' and is_pay_ok=0 order by rebate_id DESC LIMIT 0,1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | if (!$row['rebate_paytime_start']) |
| | | { |
| | | $rebate_paytime_start = local_mktime(0,0,0,local_date('m'), local_date('d'), local_date('Y')); |
| | | } |
| | | if (!$row['rebate_paytime_end']) |
| | | { |
| | | switch($supplier_rebate_paytime) |
| | | { |
| | | case '1': |
| | | $rebate_paytime_end= local_strtotime("this Sunday") + 24*60*60-1; |
| | | break; |
| | | case '2': |
| | | $rebate_paytime_end= local_mktime(23,59,59,local_date("m"),local_date("t"),local_date("Y")); |
| | | break; |
| | | case '3': |
| | | if (local_date("m")=='1' || local_date("m")=='2' || local_date("m")=='3') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59,3,31,local_date("Y")); |
| | | } |
| | | elseif (local_date("m")=='4' || local_date("m")=='5' || local_date("m")=='6') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 6,30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='7' || local_date("m")=='8' || local_date("m")=='9') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 9, 30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='10' || local_date("m")=='11' || local_date("m")=='12') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 12,31,local_date("Y")); |
| | | } |
| | | break; |
| | | case '4': |
| | | $rebate_paytime_end= local_mktime(23,59,59,12,31,local_date("Y")); |
| | | break; |
| | | } |
| | | } |
| | | if ( $row['rebate_paytime_start'] && $row['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_paytime_start = $row['rebate_paytime_end'] + 1; |
| | | switch($supplier_rebate_paytime) |
| | | { |
| | | case '1': |
| | | $rebate_paytime_end= $row['rebate_paytime_end'] + 24*60*60*7; |
| | | break; |
| | | case '2': |
| | | $rebate_paytime_end= local_mktime(23,59,59,local_date("m",$rebate_paytime_start),local_date("t",$rebate_paytime_start),local_date("Y",$rebate_paytime_start)); |
| | | break; |
| | | case '3': |
| | | if (local_date("m",$rebate_paytime_start)=='1' || local_date("m")=='2' || local_date("m")=='3') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59,3,31,local_date("Y")); |
| | | } |
| | | elseif (local_date("m")=='4' || local_date("m")=='5' || local_date("m")=='6') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 6,30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='7' || local_date("m")=='8' || local_date("m")=='9') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 9, 30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='10' || local_date("m")=='11' || local_date("m")=='12') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 12,31,local_date("Y")); |
| | | } |
| | | break; |
| | | case '4': |
| | | $rebate_paytime_end= local_mktime(23,59,59,12,31,local_date("Y")); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | $sql="insert into ". $GLOBALS['ecs']->table('supplier_rebate') ."(rebate_paytime_start, rebate_paytime_end, supplier_id) value('$rebate_paytime_start', '$rebate_paytime_end', '$supplier_id') "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | function is_cansel($goods_id, $product_id, $package_buy) |
| | | { |
| | | if($package_buy=='package_buy') |
| | | { |
| | | return '1'; |
| | | } |
| | | $sql = "select is_on_sale, goods_number from ". $GLOBALS['ecs']->table('goods') ." where goods_id='$goods_id' "; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | if (!$row['is_on_sale']) |
| | | { |
| | | return '0'; |
| | | } |
| | | else |
| | | { |
| | | if ($product_id>0) |
| | | { |
| | | $sql2 = "select product_number from ". $GLOBALS['ecs']->table('products') ." where product_id='$product_id' "; |
| | | $row2 = $GLOBALS['db']->getRow($sql2); |
| | | if (!$row2['product_number']) |
| | | { |
| | | return '0'; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!$row['goods_number']) |
| | | { |
| | | return '0'; |
| | | } |
| | | } |
| | | } |
| | | return '1'; |
| | | } |
| | | |
| | | function getWeek($unixTime='') |
| | | { |
| | | $unixTime=is_numeric($unixTime) ? $unixTime : time(); |
| | | $weekarray=array('日','一','二','三','四','五','六'); |
| | | return '周'.$weekarray[date('w',$unixTime)]; |
| | | } |
| | | |
| | | function get_region_info($region_id) |
| | | { |
| | | $sql = 'SELECT region_name FROM ' . $GLOBALS['ecs']->table('region') . |
| | | " WHERE region_id = '$region_id' "; |
| | | |
| | | return $GLOBALS['db']->getOne($sql); |
| | | } |
| | | /* 代码增加_end By */ |
| | | ?> |
New file |
| | |
| | | <?php |
| | | |
| | | /** |
| | | 购物流程函数库 |
| | | * ============================================================================ |
| | | * * |
| | | |
| | | * ---------------------------------------------------------------------------- |
| | | |
| | | * ============================================================================ |
| | | |
| | | * $Id: lib_order.php 17217 2011-01-19 06:29:08Z $ |
| | | */ |
| | | |
| | | if (!defined('IN_ECS')) |
| | | { |
| | | die('Hacking attempt'); |
| | | } |
| | | |
| | | /** |
| | | * 处理序列化的支付、配送的配置参数 |
| | | * 返回一个以name为索引的数组 |
| | | * |
| | | * @access public |
| | | * @param string $cfg |
| | | * @return void |
| | | */ |
| | | function unserialize_config($cfg) |
| | | { |
| | | if (is_string($cfg) && ($arr = unserialize($cfg)) !== false) |
| | | { |
| | | $config = array(); |
| | | |
| | | foreach ($arr AS $key => $val) |
| | | { |
| | | $config[$val['name']] = $val['value']; |
| | | } |
| | | |
| | | return $config; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | /** |
| | | * 取得已安装的配送方式 |
| | | * @return array 已安装的配送方式 |
| | | */ |
| | | function shipping_list() |
| | | { |
| | | $sql = 'SELECT shipping_id, shipping_name ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('shipping') . |
| | | ' WHERE enabled = 1'; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得配送方式信息 |
| | | * @param int $shipping_id 配送方式id |
| | | * @return array 配送方式信息 |
| | | */ |
| | | function shipping_info($shipping_id) |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('shipping') . |
| | | " WHERE shipping_id = '$shipping_id' " . |
| | | 'AND enabled = 1'; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得可用的配送方式列表 |
| | | * @param array $region_id_list 收货人地区id数组(包括国家、省、市、区) |
| | | * @return array 配送方式数组 |
| | | */ |
| | | function available_shipping_list($region_id_list) |
| | | { |
| | | $sql = 'SELECT s.shipping_id, s.shipping_code, s.shipping_name, ' . |
| | | 's.shipping_desc, s.insure, s.support_cod, a.configure , s.support_pickup ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('shipping') . ' AS s, ' . |
| | | $GLOBALS['ecs']->table('shipping_area') . ' AS a, ' . |
| | | $GLOBALS['ecs']->table('area_region') . ' AS r ' . |
| | | 'WHERE r.region_id ' . db_create_in($region_id_list) . |
| | | ' AND r.shipping_area_id = a.shipping_area_id AND a.shipping_id = s.shipping_id AND s.enabled = 1 ORDER BY s.shipping_order'; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得某配送方式对应于某收货地址的区域信息 |
| | | * @param int $shipping_id 配送方式id |
| | | * @param array $region_id_list 收货人地区id数组 |
| | | * @return array 配送区域信息(config 对应着反序列化的 configure) |
| | | */ |
| | | function shipping_area_info($shipping_id, $region_id_list) |
| | | { |
| | | $sql = 'SELECT s.shipping_code, s.shipping_name, ' . |
| | | 's.shipping_desc, s.insure, s.support_cod, a.configure ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('shipping') . ' AS s, ' . |
| | | $GLOBALS['ecs']->table('shipping_area') . ' AS a, ' . |
| | | $GLOBALS['ecs']->table('area_region') . ' AS r ' . |
| | | "WHERE s.shipping_id = '$shipping_id' " . |
| | | 'AND r.region_id ' . db_create_in($region_id_list) . |
| | | ' AND r.shipping_area_id = a.shipping_area_id AND a.shipping_id = s.shipping_id AND s.enabled = 1'; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (!empty($row)) |
| | | { |
| | | $shipping_config = unserialize_config($row['configure']); |
| | | if (isset($shipping_config['pay_fee'])) |
| | | { |
| | | if (strpos($shipping_config['pay_fee'], '%') !== false) |
| | | { |
| | | $row['pay_fee'] = floatval($shipping_config['pay_fee']) . '%'; |
| | | } |
| | | else |
| | | { |
| | | $row['pay_fee'] = floatval($shipping_config['pay_fee']); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $row['pay_fee'] = 0.00; |
| | | } |
| | | } |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 计算运费 |
| | | * @param string $shipping_code 配送方式代码 |
| | | * @param mix $shipping_config 配送方式配置信息 |
| | | * @param float $goods_weight 商品重量 |
| | | * @param float $goods_amount 商品金额 |
| | | * @param float $goods_number 商品数量 |
| | | * @return float 运费 |
| | | */ |
| | | function shipping_fee($shipping_code, $shipping_config, $goods_weight, $goods_amount, $goods_number='') |
| | | { |
| | | if (!is_array($shipping_config)) |
| | | { |
| | | $shipping_config = unserialize($shipping_config); |
| | | } |
| | | |
| | | $filename = ROOT_PATH . 'includes/modules/shipping/' . $shipping_code . '.php'; |
| | | if (file_exists($filename)) |
| | | { |
| | | include_once($filename); |
| | | |
| | | $obj = new $shipping_code($shipping_config); |
| | | |
| | | return $obj->calculate($goods_weight, $goods_amount, $goods_number); |
| | | } |
| | | else |
| | | { |
| | | return 0; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取指定配送的保价费用 |
| | | * |
| | | * @access public |
| | | * @param string $shipping_code 配送方式的code |
| | | * @param float $goods_amount 保价金额 |
| | | * @param mix $insure 保价比例 |
| | | * @return float |
| | | */ |
| | | function shipping_insure_fee($shipping_code, $goods_amount, $insure) |
| | | { |
| | | if (strpos($insure, '%') === false) |
| | | { |
| | | /* 如果保价费用不是百分比则直接返回该数值 */ |
| | | return floatval($insure); |
| | | } |
| | | else |
| | | { |
| | | $path = ROOT_PATH . 'includes/modules/shipping/' . $shipping_code . '.php'; |
| | | |
| | | if (file_exists($path)) |
| | | { |
| | | include_once($path); |
| | | |
| | | $shipping = new $shipping_code; |
| | | $insure = floatval($insure) / 100; |
| | | |
| | | if (method_exists($shipping, 'calculate_insure')) |
| | | { |
| | | return $shipping->calculate_insure($goods_amount, $insure); |
| | | } |
| | | else |
| | | { |
| | | return ceil($goods_amount * $insure); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得已安装的支付方式列表 |
| | | * @return array 已安装的配送方式列表 |
| | | */ |
| | | function payment_list() |
| | | { |
| | | $sql = 'SELECT pay_id, pay_name ' . |
| | | 'FROM ' . $GLOBALS['ecs']->table('payment') . |
| | | ' WHERE enabled = 1'; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得支付方式信息 |
| | | * @param int $pay_id 支付方式id |
| | | * @return array 支付方式信息 |
| | | */ |
| | | function payment_info($pay_id) |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('payment') . |
| | | " WHERE pay_id = '$pay_id' AND enabled = 1"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 获得订单需要支付的支付费用 |
| | | * |
| | | * @access public |
| | | * @param integer $payment_id |
| | | * @param float $order_amount |
| | | * @param mix $cod_fee |
| | | * @return float |
| | | */ |
| | | function pay_fee($payment_id, $order_amount, $cod_fee=null) |
| | | { |
| | | $pay_fee = 0; |
| | | $payment = payment_info($payment_id); |
| | | $rate = ($payment['is_cod'] && !is_null($cod_fee)) ? $cod_fee : $payment['pay_fee']; |
| | | |
| | | if (strpos($rate, '%') !== false) |
| | | { |
| | | /* 支付费用是一个比例 */ |
| | | $val = floatval($rate) / 100; |
| | | $pay_fee = $val > 0 ? $order_amount * $val /(1- $val) : 0; |
| | | } |
| | | else |
| | | { |
| | | $pay_fee = floatval($rate); |
| | | } |
| | | |
| | | return round($pay_fee, 2); |
| | | } |
| | | |
| | | /** |
| | | * 取得可用的支付方式列表 |
| | | * @param bool $support_cod 配送方式是否支持货到付款 |
| | | * @param int $cod_fee 货到付款手续费(当配送方式支持货到付款时才传此参数) |
| | | * @param int $is_online 是否支持在线支付 |
| | | * @return array 配送方式数组 |
| | | */ |
| | | function available_payment_list($support_cod, $cod_fee = 0, $is_online = false) |
| | | { |
| | | $sql = 'SELECT pay_id, pay_code, pay_name, pay_fee, pay_desc, pay_config, is_cod' . |
| | | ' FROM ' . $GLOBALS['ecs']->table('payment') . |
| | | ' WHERE enabled = 1 '; |
| | | if (!$support_cod) |
| | | { |
| | | $sql .= 'AND is_cod = 0 '; // 如果不支持货到付款 |
| | | } |
| | | if ($is_online) |
| | | { |
| | | $sql .= "AND is_online = '1' "; |
| | | } |
| | | $sql .= 'ORDER BY pay_order'; // 排序 |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $pay_list = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['is_cod'] == '1') |
| | | { |
| | | $row['pay_fee'] = $cod_fee; |
| | | } |
| | | |
| | | $row['format_pay_fee'] = strpos($row['pay_fee'], '%') !== false ? $row['pay_fee'] : |
| | | price_format($row['pay_fee'], false); |
| | | $modules[] = $row; |
| | | } |
| | | |
| | | //include_once(ROOT_PATH.'includes/lib_compositor.php'); |
| | | |
| | | if(isset($modules)) |
| | | { |
| | | return $modules; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得包装列表 |
| | | * @return array 包装列表 |
| | | */ |
| | | function pack_list() |
| | | { |
| | | $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('pack'); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $list = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $row['format_pack_fee'] = price_format($row['pack_fee'], false); |
| | | $row['format_free_money'] = price_format($row['free_money'], false); |
| | | $list[] = $row; |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 取得包装信息 |
| | | * @param int $pack_id 包装id |
| | | * @return array 包装信息 |
| | | */ |
| | | function pack_info($pack_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('pack') . |
| | | " WHERE pack_id = '$pack_id'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单中的商品总额来获得包装的费用 |
| | | * |
| | | * @access public |
| | | * @param integer $pack_id |
| | | * @param float $goods_amount |
| | | * @return float |
| | | */ |
| | | function pack_fee($pack_id, $goods_amount) |
| | | { |
| | | $pack = pack_info($pack_id); |
| | | |
| | | $val = (floatval($pack['free_money']) <= $goods_amount && $pack['free_money'] > 0) ? 0 : floatval($pack['pack_fee']); |
| | | |
| | | return $val; |
| | | } |
| | | |
| | | /** |
| | | * 取得贺卡列表 |
| | | * @return array 贺卡列表 |
| | | */ |
| | | function card_list() |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('card'); |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | $list = array(); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $row['format_card_fee'] = price_format($row['card_fee'], false); |
| | | $row['format_free_money'] = price_format($row['free_money'], false); |
| | | $list[] = $row; |
| | | } |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 取得贺卡信息 |
| | | * @param int $card_id 贺卡id |
| | | * @return array 贺卡信息 |
| | | */ |
| | | function card_info($card_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('card') . |
| | | " WHERE card_id = '$card_id'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 根据订单中商品总额获得需要支付的贺卡费用 |
| | | * |
| | | * @access public |
| | | * @param integer $card_id |
| | | * @param float $goods_amount |
| | | * @return float |
| | | */ |
| | | function card_fee($card_id, $goods_amount) |
| | | { |
| | | $card = card_info($card_id); |
| | | |
| | | return ($card['free_money'] <= $goods_amount && $card['free_money'] > 0) ? 0 : $card['card_fee']; |
| | | } |
| | | |
| | | /** |
| | | * 取得订单信息 |
| | | * @param int $order_id 订单id(如果order_id > 0 就按id查,否则按sn查) |
| | | * @param string $order_sn 订单号 |
| | | * @return array 订单信息(金额都有相应格式化的字段,前缀是formated_) |
| | | */ |
| | | function order_info($order_id, $order_sn = '') |
| | | { |
| | | /* 计算订单各种费用之和的语句 */ |
| | | $total_fee = " (goods_amount - discount + tax + shipping_fee + insure_fee + pay_fee + pack_fee + card_fee) AS total_fee "; |
| | | $order_id = intval($order_id); |
| | | if ($order_id > 0) |
| | | { |
| | | $sql = "SELECT *, " . $total_fee . " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_id = '$order_id'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT *, " . $total_fee . " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_sn = '$order_sn'"; |
| | | } |
| | | $order = $GLOBALS['db']->getRow($sql); |
| | | |
| | | /* 格式化金额字段 */ |
| | | if ($order) |
| | | { |
| | | $order['formated_goods_amount'] = price_format($order['goods_amount'], false); |
| | | $order['formated_discount'] = price_format($order['discount'], false); |
| | | $order['formated_tax'] = price_format($order['tax'], false); |
| | | $order['formated_shipping_fee'] = price_format($order['shipping_fee'], false); |
| | | $order['formated_insure_fee'] = price_format($order['insure_fee'], false); |
| | | $order['formated_pay_fee'] = price_format($order['pay_fee'], false); |
| | | $order['formated_pack_fee'] = price_format($order['pack_fee'], false); |
| | | $order['formated_card_fee'] = price_format($order['card_fee'], false); |
| | | $order['formated_total_fee'] = price_format($order['total_fee'], false); |
| | | $order['formated_money_paid'] = price_format($order['money_paid'], false); |
| | | $order['formated_bonus'] = price_format($order['bonus'], false); |
| | | $order['formated_integral_money'] = price_format($order['integral_money'], false); |
| | | $order['formated_surplus'] = price_format($order['surplus'], false); |
| | | $order['formated_order_amount'] = price_format(abs($order['order_amount']), false); |
| | | $order['formated_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $order['add_time']); |
| | | } |
| | | |
| | | return $order; |
| | | } |
| | | |
| | | /** |
| | | * 判断订单是否已完成 |
| | | * @param array $order 订单信息 |
| | | * @return bool |
| | | */ |
| | | function order_finished($order) |
| | | { |
| | | return $order['order_status'] == OS_CONFIRMED && |
| | | ($order['shipping_status'] == SS_SHIPPED || $order['shipping_status'] == SS_RECEIVED) && |
| | | ($order['pay_status'] == PS_PAYED || $order['pay_status'] == PS_PAYING); |
| | | } |
| | | |
| | | /** |
| | | * 取得订单商品 |
| | | * @param int $order_id 订单id |
| | | * @return array 订单商品数组 |
| | | */ |
| | | function order_goods($order_id) |
| | | { |
| | | $sql = "SELECT rec_id, og.goods_id, og.goods_name, g.goods_thumb, og.goods_sn, og.market_price, og.goods_number, " . |
| | | "og.goods_price, og.goods_attr, og.is_real, og.parent_id, og.is_gift, " . |
| | | "og.goods_price * og.goods_number AS subtotal, og.extension_code, package_attr_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . "as og right join" . $GLOBALS['ecs']->table('goods') . |
| | | "as g on og.goods_id = g.goods_id" . |
| | | " WHERE order_id = '$order_id'";// 修改 by 增加 package_attr_id 字段 |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['extension_code'] == 'package_buy') |
| | | { |
| | | $row['package_goods_list'] = get_package_goods($row['goods_id'], $row['package_attr_id']); // 修改 by |
| | | } |
| | | $goods_list[] = $row; |
| | | } |
| | | |
| | | //return $GLOBALS['db']->getAll($sql); |
| | | return $goods_list; |
| | | } |
| | | |
| | | /** |
| | | * 取得订单总金额 |
| | | * @param int $order_id 订单id |
| | | * @param bool $include_gift 是否包括赠品 |
| | | * @return float 订单总金额 |
| | | */ |
| | | function order_amount($order_id, $include_gift = true) |
| | | { |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id'"; |
| | | if (!$include_gift) |
| | | { |
| | | $sql .= " AND is_gift = 0"; |
| | | } |
| | | |
| | | return floatval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 取得某订单商品总重量和总金额(对应 cart_weight_price) |
| | | * @param int $order_id 订单id |
| | | * @return array ('weight' => **, 'amount' => **, 'formated_weight' => **) |
| | | */ |
| | | function order_weight_price($order_id) |
| | | { |
| | | $sql = "SELECT SUM(g.goods_weight * o.goods_number) AS weight, " . |
| | | "SUM(o.goods_price * o.goods_number) AS amount ," . |
| | | "SUM(o.goods_number) AS number " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS o, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE o.order_id = '$order_id' " . |
| | | "AND o.goods_id = g.goods_id"; |
| | | |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $row['weight'] = floatval($row['weight']); |
| | | $row['amount'] = floatval($row['amount']); |
| | | $row['number'] = intval($row['number']); |
| | | |
| | | /* 格式化重量 */ |
| | | $row['formated_weight'] = formated_weight($row['weight']); |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 获得订单中的费用信息 |
| | | * |
| | | * @access public |
| | | * @param array $order |
| | | * @param array $goods |
| | | * @param array $consignee |
| | | * @param bool $is_gb_deposit 是否团购保证金(如果是,应付款金额只计算商品总额和支付费用,可以获得的积分取 $gift_integral) |
| | | * @return array |
| | | */ |
| | | function order_fee($order, $goods, $consignee) |
| | | { |
| | | /* 初始化订单的扩展code */ |
| | | if (!isset($order['extension_code'])) |
| | | { |
| | | $order['extension_code'] = ''; |
| | | } |
| | | |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $group_buy = group_buy_info($order['extension_id']); |
| | | } |
| | | |
| | | $total = array('real_goods_count' => 0, |
| | | 'gift_amount' => 0, |
| | | 'goods_price' => 0, |
| | | 'market_price' => 0, |
| | | 'discount' => 0, |
| | | 'pack_fee' => 0, |
| | | 'card_fee' => 0, |
| | | 'shipping_fee' => 0, |
| | | 'shipping_insure' => 0, |
| | | 'integral_money' => 0, |
| | | 'bonus' => 0, |
| | | 'surplus' => 0, |
| | | 'cod_fee' => 0, |
| | | 'pay_fee' => 0, |
| | | 'tax' => 0); |
| | | $weight = 0; |
| | | |
| | | /* 商品总价 */ |
| | | foreach ($goods AS $val) |
| | | { |
| | | /* 统计实体商品的个数 */ |
| | | if ($val['is_real']) |
| | | { |
| | | $total['real_goods_count']++; |
| | | } |
| | | |
| | | $total['goods_price'] += $val['goods_price'] * $val['goods_number']; |
| | | $total['market_price'] += $val['market_price'] * $val['goods_number']; |
| | | } |
| | | |
| | | $total['saving'] = $total['market_price'] - $total['goods_price']; |
| | | $total['save_rate'] = $total['market_price'] ? round($total['saving'] * 100 / $total['market_price']) . '%' : 0; |
| | | |
| | | $total['goods_price_formated'] = price_format($total['goods_price'], false); |
| | | $total['market_price_formated'] = price_format($total['market_price'], false); |
| | | $total['saving_formated'] = price_format($total['saving'], false); |
| | | |
| | | /* 折扣 */ |
| | | if ($order['extension_code'] != 'group_buy') |
| | | { |
| | | $discount = compute_discount(isset($order['supplier_id']) ? $order['supplier_id'] : -1); |
| | | $total['discount'] = $discount['discount']; |
| | | if ($total['discount'] > $total['goods_price']) |
| | | { |
| | | $total['discount'] = $total['goods_price']; |
| | | } |
| | | } |
| | | $total['discount_formated'] = price_format($total['discount'], false); |
| | | |
| | | /* 税额 */ |
| | | if (!empty($order['need_inv']) && $order['inv_type'] != '') |
| | | { |
| | | /* 查税率 */ |
| | | $rate = 0; |
| | | foreach ($GLOBALS['_CFG']['invoice_type']['type'] as $key => $type) |
| | | { |
| | | if ($type == $order['inv_type']) |
| | | { |
| | | $rate = floatval($GLOBALS['_CFG']['invoice_type']['rate'][$key]) / 100; |
| | | break; |
| | | } |
| | | } |
| | | if ($rate > 0) |
| | | { |
| | | $total['tax'] = $rate * $total['goods_price']; |
| | | } |
| | | } |
| | | $total['tax_formated'] = price_format($total['tax'], false); |
| | | |
| | | /* 包装费用 */ |
| | | if (!empty($order['pack_id'])) |
| | | { |
| | | $total['pack_fee'] = pack_fee($order['pack_id'], $total['goods_price']); |
| | | } |
| | | $total['pack_fee_formated'] = price_format($total['pack_fee'], false); |
| | | |
| | | /* 贺卡费用 */ |
| | | if (!empty($order['card_id'])) |
| | | { |
| | | $total['card_fee'] = card_fee($order['card_id'], $total['goods_price']); |
| | | } |
| | | $total['card_fee_formated'] = price_format($total['card_fee'], false); |
| | | |
| | | /* 红包 */ |
| | | $total['bonus'] = 0; |
| | | if (!empty($order['bonus_id'])) |
| | | { |
| | | $bonus = bonus_info($order['bonus_id']); |
| | | $total['bonus'] = $bonus['type_money']; |
| | | } |
| | | |
| | | |
| | | /* 线下红包 */ |
| | | if (!empty($order['bonus_sn'])) |
| | | { |
| | | $bonus = bonus_info(0,$order['bonus_sn']); |
| | | $total['bonus'] += $bonus['type_money']; |
| | | //$total['bonus_kill'] = $order['bonus_kill']; |
| | | //$total['bonus_kill_formated'] = price_format($total['bonus_kill'], false); |
| | | } |
| | | $total['bonus_formated'] = price_format($total['bonus'], false); |
| | | |
| | | |
| | | |
| | | /* 配送费用 */ |
| | | $shipping_cod_fee = NULL; |
| | | |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | |
| | | if ($order['shipping_id'] > 0 && $total['real_goods_count'] > 0) |
| | | { |
| | | $region['country'] = $consignee['country']; |
| | | $region['province'] = $consignee['province']; |
| | | $region['city'] = $consignee['city']; |
| | | $region['district'] = $consignee['district']; |
| | | $shipping_info = shipping_area_info($order['shipping_id'], $region); |
| | | |
| | | if (!empty($shipping_info)) |
| | | { |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $weight_price = cart_weight_price(CART_GROUP_BUY_GOODS); |
| | | } |
| | | else |
| | | { |
| | | $weight_price = cart_weight_price(); |
| | | } |
| | | |
| | | // 查看购物车中是否全为免运费商品,若是则把运费赋为零 |
| | | $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE $sql_where AND `extension_code` != 'package_buy' AND `is_shipping` = 0 "; //jx AND rec_id in (".$_SESSION['sel_cartgoods'].") |
| | | $shipping_count = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $total['shipping_fee'] = ($shipping_count == 0 AND $weight_price['free_shipping'] == 1) ?0 : shipping_fee($shipping_info['shipping_code'],$shipping_info['configure'], $weight_price['weight'], $total['goods_price'], $weight_price['number']); |
| | | |
| | | if (!empty($order['need_insure']) && $shipping_info['insure'] > 0) |
| | | { |
| | | $total['shipping_insure'] = shipping_insure_fee($shipping_info['shipping_code'], |
| | | $total['goods_price'], $shipping_info['insure']); |
| | | } |
| | | else |
| | | { |
| | | $total['shipping_insure'] = 0; |
| | | } |
| | | |
| | | if ($shipping_info['support_cod']) |
| | | { |
| | | $shipping_cod_fee = $shipping_info['pay_fee']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | $total['shipping_fee_formated'] = price_format($total['shipping_fee'], false); |
| | | $total['shipping_insure_formated'] = price_format($total['shipping_insure'], false); |
| | | |
| | | /* 代码增加_start By */ |
| | | foreach ($goods AS $val) |
| | | { |
| | | $sql_supp = "select g.supplier_id, IF(g.supplier_id='0', '本网站', s.supplier_name) AS supplier_name2 from ".$GLOBALS['ecs']->table('goods'). |
| | | " AS g left join ".$GLOBALS['ecs']->table('supplier')." AS s on g.supplier_id=s.supplier_id where g.goods_id='". $val['goods_id'] ."' "; |
| | | $row_supp = $GLOBALS['db']->getRow($sql_supp); |
| | | $row_supp['supplier_id'] = $row_supp['supplier_id'] ? intval($row_supp['supplier_id']) :0; |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['supplier_name'] =$row_supp['supplier_name2']; |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['goods_number'] += $val['goods_number']; |
| | | |
| | | $total['supplier_goodsnumber'][$row_supp['supplier_id']] += $val['goods_number']; |
| | | |
| | | $total['goods_price_supplier'][$row_supp['supplier_id']] += $val['goods_price'] * $val['goods_number']; |
| | | |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $weight_price2 = cart_weight_price2(CART_GROUP_BUY_GOODS, $row_supp['supplier_id']); |
| | | } |
| | | else |
| | | { |
| | | $weight_price2 = cart_weight_price2(CART_GENERAL_GOODS, $row_supp['supplier_id']); |
| | | } |
| | | |
| | | // 查看购物车中是否全为免运费商品,若是则把运费赋为零 |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('cart') . " AS c left join ". $GLOBALS['ecs']->table('goods') ." AS g on c.goods_id=g.goods_id WHERE g.supplier_id = '". $row_supp['supplier_id'] ."' AND $sql_where AND c.extension_code != 'package_buy' AND c.is_shipping = 0 "; //jx AND c.rec_id in (".$_SESSION['sel_cartgoods'].") |
| | | $shipping_count_supp = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['shipping_fee'] = ($shipping_count_supp == 0 AND $weight_price2['free_shipping'] == 1) ?0 : shipping_fee($shipping_info['shipping_code'],$shipping_info['configure'], $weight_price2['weight'], $total['goods_price_supplier'][$row_supp['supplier_id']], $weight_price2['number']); |
| | | $total['supplier_shipping'][$row_supp['supplier_id']]['formated_shipping_fee'] = price_format($total['supplier_shipping'][$row_supp['supplier_id']]['shipping_fee'], false); |
| | | |
| | | |
| | | } |
| | | krsort($total['supplier_shipping']); |
| | | $total['shipping_fee'] = 0; |
| | | foreach($total['supplier_shipping'] AS $supp_shipping) |
| | | { |
| | | $total['shipping_fee'] += $supp_shipping['shipping_fee']; |
| | | } |
| | | $total['shipping_fee_formated'] = price_format($total['shipping_fee'], false); |
| | | |
| | | /* 代码增加_end By */ |
| | | |
| | | // 购物车中的商品能享受红包支付的总额 |
| | | $bonus_amount = compute_discount_amount(); |
| | | // 红包和积分最多能支付的金额为商品总额 |
| | | $max_amount = $total['goods_price'] == 0 ? $total['goods_price'] : $total['goods_price'] - $bonus_amount; |
| | | |
| | | /* 计算订单总额 */ |
| | | if ($order['extension_code'] == 'group_buy' && $group_buy['deposit'] > 0) |
| | | { |
| | | $total['amount'] = $total['goods_price']; |
| | | } |
| | | else |
| | | { |
| | | $total['amount'] = $total['goods_price'] - $total['discount'] + $total['tax'] + $total['pack_fee'] + $total['card_fee'] + |
| | | $total['shipping_fee'] + $total['shipping_insure'] + $total['cod_fee']; |
| | | |
| | | // 减去红包金额 |
| | | $use_bonus = min($total['bonus'], $max_amount); // 实际减去的红包金额 |
| | | if(isset($total['bonus_kill'])) |
| | | { |
| | | $use_bonus_kill = min($total['bonus_kill'], $max_amount); |
| | | $total['amount'] -= $price = number_format($total['bonus_kill'], 2, '.', ''); // 还需要支付的订单金额 |
| | | } |
| | | |
| | | $total['bonus'] = $use_bonus; |
| | | $total['bonus_formated'] = price_format($total['bonus'], false); |
| | | |
| | | $total['amount'] -= $use_bonus; // 还需要支付的订单金额 |
| | | $max_amount -= $use_bonus; // 积分最多还能支付的金额 |
| | | |
| | | } |
| | | |
| | | /* 余额 */ |
| | | $order['surplus'] = $order['surplus'] > 0 ? $order['surplus'] : 0; |
| | | if ($total['amount'] > 0) |
| | | { |
| | | if (isset($order['surplus']) && $order['surplus'] > $total['amount']) |
| | | { |
| | | $order['surplus'] = $total['amount']; |
| | | $total['amount'] = 0; |
| | | } |
| | | else |
| | | { |
| | | $total['amount'] -= floatval($order['surplus']); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $order['surplus'] = 0; |
| | | $total['amount'] = 0; |
| | | } |
| | | $total['surplus'] = $order['surplus']; |
| | | $total['surplus_formated'] = price_format($order['surplus'], false); |
| | | |
| | | /* 积分 */ |
| | | $order['integral'] = $order['integral'] > 0 ? $order['integral'] : 0; |
| | | if ($total['amount'] > 0 && $max_amount > 0 && $order['integral'] > 0) |
| | | { |
| | | $integral_money = value_of_integral($order['integral']); |
| | | |
| | | // 使用积分支付 |
| | | $use_integral = min($total['amount'], $max_amount, $integral_money); // 实际使用积分支付的金额 |
| | | $total['amount'] -= $use_integral; |
| | | $total['integral_money'] = $use_integral; |
| | | $order['integral'] = integral_of_value($use_integral); |
| | | } |
| | | else |
| | | { |
| | | $total['integral_money'] = 0; |
| | | $order['integral'] = 0; |
| | | } |
| | | $total['integral'] = $order['integral']; |
| | | $total['integral_formated'] = price_format($total['integral_money'], false); |
| | | |
| | | /* 保存订单信息 */ |
| | | $_SESSION['flow_order'] = $order; |
| | | |
| | | $se_flow_type = isset($_SESSION['flow_type']) ? $_SESSION['flow_type'] : ''; |
| | | |
| | | /* 支付费用 */ |
| | | if (!empty($order['pay_id']) && ($total['real_goods_count'] > 0 || $se_flow_type != CART_EXCHANGE_GOODS)) |
| | | { |
| | | $total['pay_fee'] = pay_fee($order['pay_id'], $total['amount'], $shipping_cod_fee); |
| | | } |
| | | |
| | | $total['pay_fee_formated'] = price_format($total['pay_fee'], false); |
| | | |
| | | $total['amount'] += $total['pay_fee']; // 订单总额累加上支付费用 |
| | | $total['amount_formated'] = price_format($total['amount'], false); |
| | | |
| | | /* 取得可以得到的积分和红包 */ |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | $total['will_get_integral'] = $group_buy['gift_integral']; |
| | | } |
| | | elseif ($order['extension_code'] == 'exchange_goods') |
| | | { |
| | | $total['will_get_integral'] = 0; |
| | | } |
| | | else |
| | | { |
| | | $total['will_get_integral'] = get_give_integral($goods); |
| | | } |
| | | $total['will_get_bonus'] = $order['extension_code'] == 'exchange_goods' ? 0 : price_format(get_total_bonus(), false); |
| | | $total['formated_goods_price'] = price_format($total['goods_price'], false); |
| | | $total['formated_market_price'] = price_format($total['market_price'], false); |
| | | $total['formated_saving'] = price_format($total['saving'], false); |
| | | |
| | | if ($order['extension_code'] == 'exchange_goods') |
| | | { |
| | | $sql_exchange = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = 'SELECT SUM(eg.exchange_integral) '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c,' . $GLOBALS['ecs']->table('exchange_goods') . 'AS eg '. |
| | | "WHERE c.goods_id = eg.goods_id AND " . $sql_exchange . |
| | | " AND c.rec_type = '" . CART_EXCHANGE_GOODS . "' " . |
| | | ' AND c.is_gift = 0 AND c.goods_id > 0 ' . |
| | | 'GROUP BY eg.goods_id'; |
| | | $exchange_integral = $GLOBALS['db']->getOne($sql); |
| | | $total['exchange_integral'] = $exchange_integral; |
| | | } |
| | | |
| | | return $total; |
| | | } |
| | | |
| | | /** |
| | | * 修改订单 |
| | | * @param int $order_id 订单id |
| | | * @param array $order key => value |
| | | * @return bool |
| | | */ |
| | | function update_order($order_id, $order) |
| | | { |
| | | return $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), |
| | | $order, 'UPDATE', "order_id = '$order_id'"); |
| | | } |
| | | |
| | | /** |
| | | * 得到新订单号 |
| | | * @return string |
| | | */ |
| | | function get_order_sn() |
| | | { |
| | | /* 选择一个随机的方案 */ |
| | | mt_srand((double) microtime() * 1000000); |
| | | |
| | | return date('Ymd') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车商品 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return array 购物车商品数组 |
| | | */ |
| | | function cart_goods($type = CART_GENERAL_GOODS) |
| | | { |
| | | /* 代码增加_start By */ |
| | | |
| | | $id_ext = ""; |
| | | if ($_SESSION['sel_cartgoods']) |
| | | { |
| | | $id_ext = " AND c.rec_id in (". $_SESSION['sel_cartgoods'] .") "; |
| | | } |
| | | /* 代码增加_end By */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT c.rec_id, c.user_id, c.goods_id, c.goods_name, c.goods_sn, c.goods_number, " . |
| | | "c.market_price, c.goods_price, c.goods_attr, c.is_real, c.extension_code, c.parent_id, c.is_gift, c.is_shipping, package_attr_id," . |
| | | "c.goods_price * c.goods_number AS subtotal,IFNULL(g.supplier_id,0) as supplier_id,IFNULL(s.supplier_name,'网站自营') as seller " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " as c LEFT JOIN " . $GLOBALS['ecs']->table('goods') . " as g ON c.goods_id = g.goods_id LEFT JOIN ". $GLOBALS['ecs']->table('supplier') . |
| | | " as s ON s.supplier_id = g.supplier_id WHERE $sql_where " . |
| | | "AND c.rec_type = '$type'"; //代码修改 By 增加一个 $id_ext , package_attr_id $id_ext |
| | | |
| | | $arr = $GLOBALS['db']->getAll($sql); |
| | | |
| | | /* 格式化价格及礼包商品 */ |
| | | foreach ($arr as $key => $value) |
| | | { |
| | | $arr[$key]['formated_market_price'] = price_format($value['market_price'], false); |
| | | $arr[$key]['formated_goods_price'] = price_format($value['goods_price'], false); |
| | | $arr[$key]['formated_subtotal'] = price_format($value['subtotal'], false); |
| | | |
| | | /* 代码增加_start By */ |
| | | $arr[$key]['goods_thumb'] = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$value['goods_id']}'"); |
| | | $arr[$key]['goods_thumb'] = get_image_path($value['goods_id'], $arr[$key]['goods_thumb'], true); |
| | | /* 代码增加_end By */ |
| | | |
| | | if ($value['extension_code'] == 'package_buy') |
| | | { |
| | | $arr[$key]['package_goods_list'] = get_package_goods($value['goods_id'], $value['package_attr_id']); //修改 by |
| | | } |
| | | } |
| | | |
| | | return $arr; |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车总金额 |
| | | * @params boolean $include_gift 是否包括赠品 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return float 购物车总金额 |
| | | */ |
| | | function cart_amount($include_gift = true, $type = CART_GENERAL_GOODS) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | " FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_type = '$type' "; |
| | | |
| | | if (!$include_gift) |
| | | { |
| | | $sql .= ' AND is_gift = 0 AND goods_id > 0'; |
| | | } |
| | | |
| | | return floatval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车总金额根据购物车中的id |
| | | * @params array $cartids 购物车中的id数组 |
| | | * @params boolean $include_gift 是否包括赠品 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return float 购物车总金额 |
| | | */ |
| | | function cart_amount_new($cartids='', $include_gift = true, $type = CART_GENERAL_GOODS) |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' AND user_id=0 "; |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | " FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where " . |
| | | "AND rec_type = '$type' "; |
| | | if (is_array($cartids)){ |
| | | $idinfo = array_filter($cartids); |
| | | $sql .= ' AND rec_id in('.implode(',',$idinfo).')'; |
| | | } |
| | | if (!$include_gift) |
| | | { |
| | | $sql .= ' AND is_gift = 0 AND goods_id > 0'; |
| | | } |
| | | |
| | | return floatval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 检查某商品是否已经存在于购物车 |
| | | * |
| | | * @access public |
| | | * @param integer $id |
| | | * @param array $spec |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return boolean |
| | | */ |
| | | function cart_goods_exists($id, $spec, $type = CART_GENERAL_GOODS) |
| | | { |
| | | /* 检查该商品是否已经存在在购物车中 */ |
| | | $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('cart'). |
| | | "WHERE session_id = '" .SESS_ID. "' AND goods_id = '$id' ". |
| | | "AND parent_id = 0 AND goods_attr = '" .get_goods_attr_info($spec). "' " . |
| | | "AND rec_type = '$type'"; |
| | | |
| | | return ($GLOBALS['db']->getOne($sql) > 0); |
| | | } |
| | | |
| | | /** |
| | | * 获得购物车中商品的总重量、总价格、总数量 |
| | | * |
| | | * @access public |
| | | * @param int $type 类型:默认普通商品 |
| | | * @return array |
| | | */ |
| | | function cart_weight_price($type = CART_GENERAL_GOODS) |
| | | { |
| | | $package_row['weight'] = 0; |
| | | $package_row['amount'] = 0; |
| | | $package_row['number'] = 0; |
| | | |
| | | $packages_row['free_shipping'] = 1; |
| | | |
| | | /* 计算超值礼包内商品的相关配送参数 */ |
| | | $sql = 'SELECT goods_id, goods_number, goods_price FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE extension_code = 'package_buy' AND session_id = '" . SESS_ID . "'"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if ($row) |
| | | { |
| | | $packages_row['free_shipping'] = 0; |
| | | $free_shipping_count = 0; |
| | | |
| | | foreach ($row as $val) |
| | | { |
| | | // 如果商品全为免运费商品,设置一个标识变量 |
| | | $sql = 'SELECT count(*) FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | $shipping_count = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if ($shipping_count > 0) |
| | | { |
| | | // 循环计算每个超值礼包商品的重量和数量,注意一个礼包中可能包换若干个同一商品 |
| | | $sql = 'SELECT SUM(g.goods_weight * pg.goods_number) AS weight, ' . |
| | | 'SUM(pg.goods_number) AS number FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | |
| | | $goods_row = $GLOBALS['db']->getRow($sql); |
| | | $package_row['weight'] += floatval($goods_row['weight']) * $val['goods_number']; |
| | | $package_row['amount'] += floatval($val['goods_price']) * $val['goods_number']; |
| | | $package_row['number'] += intval($goods_row['number']) * $val['goods_number']; |
| | | } |
| | | else |
| | | { |
| | | $free_shipping_count++; |
| | | } |
| | | } |
| | | |
| | | $packages_row['free_shipping'] = $free_shipping_count == count($row) ? 1 : 0; |
| | | } |
| | | |
| | | /* 获得购物车中非超值礼包商品的总重量 */ |
| | | $sql = 'SELECT SUM(g.goods_weight * c.goods_number) AS weight, ' . |
| | | 'SUM(c.goods_price * c.goods_number) AS amount, ' . |
| | | 'SUM(c.goods_number) AS number '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c '. |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = c.goods_id '. |
| | | "WHERE c.session_id = '" . SESS_ID . "' " . |
| | | "AND rec_type = '$type' AND g.is_shipping = 0 AND c.extension_code != 'package_buy'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | $packages_row['weight'] = floatval($row['weight']) + $package_row['weight']; |
| | | $packages_row['amount'] = floatval($row['amount']) + $package_row['amount']; |
| | | $packages_row['number'] = intval($row['number']) + $package_row['number']; |
| | | /* 格式化重量 */ |
| | | $packages_row['formated_weight'] = formated_weight($packages_row['weight']); |
| | | |
| | | return $packages_row; |
| | | } |
| | | |
| | | /** |
| | | * 添加商品到购物车 |
| | | * |
| | | * @access public |
| | | * @param integer $goods_id 商品编号 |
| | | * @param integer $num 商品数量 |
| | | * @param array $spec 规格值对应的id数组 |
| | | * @param integer $parent 基本件 |
| | | * @return boolean |
| | | */ |
| | | function addto_cart($goods_id, $num = 1, $spec = array(), $parent = 0) |
| | | { |
| | | $GLOBALS['err']->clean(); |
| | | $_parent_id = $parent; |
| | | |
| | | /* 取得商品信息 */ |
| | | $sql = "SELECT g.goods_name, g.goods_sn, g.is_on_sale, g.is_real, ". |
| | | "g.market_price, g.shop_price AS org_price, g.promote_price, g.promote_start_date, ". |
| | | "g.promote_end_date, g.goods_weight, g.integral, g.extension_code, ". |
| | | "g.goods_number, g.is_alone_sale, g.is_shipping,". |
| | | "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price ". |
| | | " FROM " .$GLOBALS['ecs']->table('goods'). " AS g ". |
| | | " LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". |
| | | "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' ". |
| | | " WHERE g.goods_id = '$goods_id'" . |
| | | " AND g.is_delete = 0"; |
| | | $goods = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (empty($goods)) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['goods_not_exists'], ERR_NOT_EXISTS); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 如果是作为配件添加到购物车的,需要先检查购物车里面是否已经有基本件 */ |
| | | if ($parent > 0) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE goods_id='$parent' AND session_id='" . SESS_ID . "' AND extension_code <> 'package_buy'"; |
| | | if ($GLOBALS['db']->getOne($sql) == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['no_basic_goods'], ERR_NO_BASIC_GOODS); |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /* 是否正在销售 */ |
| | | if ($goods['is_on_sale'] == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['not_on_sale'], ERR_NOT_ON_SALE); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 不是配件时检查是否允许单独销售 */ |
| | | if (empty($parent) && $goods['is_alone_sale'] == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['cannt_alone_sale'], ERR_CANNT_ALONE_SALE); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 如果商品有规格则取规格商品信息 配件除外 */ |
| | | $sql = "SELECT * FROM " .$GLOBALS['ecs']->table('products'). " WHERE goods_id = '$goods_id' LIMIT 0, 1"; |
| | | $prod = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (is_spec($spec) && !empty($prod)) |
| | | { |
| | | $product_info = get_products_info($goods_id, $spec); |
| | | } |
| | | if (empty($product_info)) |
| | | { |
| | | $product_info = array('product_number' => '', 'product_id' => 0); |
| | | } |
| | | |
| | | /* 检查:库存 */ |
| | | if ($GLOBALS['_CFG']['use_storage'] == 1) |
| | | { |
| | | //检查:商品购买数量是否大于总库存 |
| | | if ($num > $goods['goods_number']) |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $goods['goods_number']), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | //商品存在规格 是货品 检查该货品库存 |
| | | if (is_spec($spec) && !empty($prod)) |
| | | { |
| | | if (!empty($spec)) |
| | | { |
| | | /* 取规格的货品库存 */ |
| | | if ($num > $product_info['product_number']) |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $product_info['product_number']), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* 计算商品的促销价格 */ |
| | | $spec_price = spec_price($spec); |
| | | $goods_price = get_final_price($goods_id, $num, true, $spec); |
| | | $goods['market_price'] += $spec_price; |
| | | $goods_attr = get_goods_attr_info($spec); |
| | | $goods_attr_id = join(',', $spec); |
| | | |
| | | /* 初始化要插入购物车的基本件数据 */ |
| | | $parent = array( |
| | | 'user_id' => $_SESSION['user_id'], |
| | | 'session_id' => SESS_ID, |
| | | 'goods_id' => $goods_id, |
| | | 'goods_sn' => addslashes($goods['goods_sn']), |
| | | 'product_id' => $product_info['product_id'], |
| | | 'goods_name' => addslashes($goods['goods_name']), |
| | | 'market_price' => $goods['market_price'], |
| | | 'goods_attr' => addslashes($goods_attr), |
| | | 'goods_attr_id' => $goods_attr_id, |
| | | 'is_real' => $goods['is_real'], |
| | | 'extension_code'=> $goods['extension_code'], |
| | | 'is_gift' => 0, |
| | | 'is_shipping' => $goods['is_shipping'], |
| | | 'add_time' => gmtime(), //代码增加 By |
| | | 'rec_type' => CART_GENERAL_GOODS |
| | | ); |
| | | |
| | | /* 如果该配件在添加为基本件的配件时,所设置的“配件价格”比原价低,即此配件在价格上提供了优惠, */ |
| | | /* 则按照该配件的优惠价格卖,但是每一个基本件只能购买一个优惠价格的“该配件”,多买的“该配件”不享 */ |
| | | /* 受此优惠 */ |
| | | $basic_list = array(); |
| | | $sql = "SELECT parent_id, goods_price " . |
| | | "FROM " . $GLOBALS['ecs']->table('group_goods') . |
| | | " WHERE goods_id = '$goods_id'" . |
| | | " AND goods_price < '$goods_price'" . |
| | | " AND parent_id = '$_parent_id'" . |
| | | " ORDER BY goods_price"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $basic_list[$row['parent_id']] = $row['goods_price']; |
| | | } |
| | | |
| | | /* 取得购物车中该商品每个基本件的数量 */ |
| | | $basic_count_list = array(); |
| | | if ($basic_list) |
| | | { |
| | | $sql = "SELECT goods_id, SUM(goods_number) AS count " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "'" . |
| | | " AND parent_id = 0" . |
| | | " AND extension_code <> 'package_buy' " . |
| | | " AND goods_id " . db_create_in(array_keys($basic_list)) . |
| | | " GROUP BY goods_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $basic_count_list[$row['goods_id']] = $row['count']; |
| | | } |
| | | } |
| | | |
| | | /* 取得购物车中该商品每个基本件已有该商品配件数量,计算出每个基本件还能有几个该商品配件 */ |
| | | /* 一个基本件对应一个该商品配件 */ |
| | | if ($basic_count_list) |
| | | { |
| | | $sql = "SELECT parent_id, SUM(goods_number) AS count " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "'" . |
| | | " AND goods_id = '$goods_id'" . |
| | | " AND extension_code <> 'package_buy' " . |
| | | " AND parent_id " . db_create_in(array_keys($basic_count_list)) . |
| | | " GROUP BY parent_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $basic_count_list[$row['parent_id']] -= $row['count']; |
| | | } |
| | | } |
| | | |
| | | /* 循环插入配件 如果是配件则用其添加数量依次为购物车中所有属于其的基本件添加足够数量的该配件 */ |
| | | foreach ($basic_list as $parent_id => $fitting_price) |
| | | { |
| | | /* 如果已全部插入,退出 */ |
| | | if ($num <= 0) |
| | | { |
| | | break; |
| | | } |
| | | |
| | | /* 如果该基本件不再购物车中,执行下一个 */ |
| | | if (!isset($basic_count_list[$parent_id])) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | /* 如果该基本件的配件数量已满,执行下一个基本件 */ |
| | | if ($basic_count_list[$parent_id] <= 0) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | /* 作为该基本件的配件插入 */ |
| | | $parent['goods_price'] = max($fitting_price, 0) + $spec_price; //允许该配件优惠价格为0 |
| | | $parent['goods_number'] = min($num, $basic_count_list[$parent_id]); |
| | | $parent['parent_id'] = $parent_id; |
| | | |
| | | /* 添加 */ |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('cart'), $parent, 'INSERT'); |
| | | |
| | | /* 改变数量 */ |
| | | $num -= $parent['goods_number']; |
| | | } |
| | | |
| | | /* 如果数量不为0,作为基本件插入 */ |
| | | if ($num > 0) |
| | | { |
| | | /* 检查该商品是否已经存在在购物车中 */ |
| | | $sql = "SELECT goods_number FROM " .$GLOBALS['ecs']->table('cart'). |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '$goods_id' ". |
| | | " AND parent_id = 0 AND goods_attr = '" .get_goods_attr_info($spec). "' " . |
| | | " AND extension_code <> 'package_buy' " . |
| | | " AND user_id= '".$_SESSION['user_id']."'". //代码增加 By |
| | | " AND rec_type = 'CART_GENERAL_GOODS'"; |
| | | |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if($row) //如果购物车已经有此物品,则更新 |
| | | { |
| | | $num += $row['goods_number']; |
| | | if(is_spec($spec) && !empty($prod) ) |
| | | { |
| | | $goods_storage=$product_info['product_number']; |
| | | } |
| | | else |
| | | { |
| | | $goods_storage=$goods['goods_number']; |
| | | } |
| | | if ($GLOBALS['_CFG']['use_storage'] == 0 || $num <= $goods_storage) |
| | | { |
| | | $goods_price = get_final_price($goods_id, $num, true, $spec); |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '$num'" . |
| | | " , goods_price = '$goods_price'". |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '$goods_id' ". |
| | | " AND parent_id = 0 AND goods_attr = '" .get_goods_attr_info($spec). "' " . |
| | | " AND extension_code <> 'package_buy' " . |
| | | "AND rec_type = 'CART_GENERAL_GOODS'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $num), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | } |
| | | else //购物车没有此物品,则插入 |
| | | { |
| | | $goods_price = get_final_price($goods_id, $num, true, $spec); |
| | | $parent['goods_price'] = max($goods_price, 0); |
| | | $parent['goods_number'] = $num; |
| | | $parent['parent_id'] = 0; |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('cart'), $parent, 'INSERT'); |
| | | } |
| | | } |
| | | |
| | | /* 把赠品删除 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /* 重写方法_start By */ |
| | | /** |
| | | * 清空购物车 |
| | | * @param int $type 类型:默认普通商品 |
| | | * @param string $other 需要扩展的条件字符串 |
| | | */ |
| | | function clear_cart($type = CART_GENERAL_GOODS) |
| | | { |
| | | |
| | | //$sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | // " WHERE session_id = '" . SESS_ID . "' AND rec_type = '$type'"; |
| | | |
| | | |
| | | $sql_where = $_SESSION['user_id']>0 ? "user_id='". $_SESSION['user_id'] ."' " : "session_id = '" . SESS_ID . "' "; |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE $sql_where AND rec_type = '$type'"; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | /* 代码增加_end By */ |
| | | |
| | | /** |
| | | * 获得指定的商品属性 |
| | | * |
| | | * @access public |
| | | * @param array $arr 规格、属性ID数组 |
| | | * @param type $type 设置返回结果类型:pice,显示价格,默认;no,不显示价格 |
| | | * |
| | | * @return string |
| | | */ |
| | | function get_goods_attr_info($arr, $type = 'pice') |
| | | { |
| | | $attr = ''; |
| | | |
| | | if (!empty($arr)) |
| | | { |
| | | $fmt = "%s:%s[%s] \n"; |
| | | |
| | | $sql = "SELECT a.attr_name, ga.attr_value, ga.attr_price ". |
| | | "FROM ".$GLOBALS['ecs']->table('goods_attr')." AS ga, ". |
| | | $GLOBALS['ecs']->table('attribute')." AS a ". |
| | | "WHERE " .db_create_in($arr, 'ga.goods_attr_id')." AND a.attr_id = ga.attr_id"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $attr_price = round(floatval($row['attr_price']), 2); |
| | | $attr .= sprintf($fmt, $row['attr_name'], $row['attr_value'], $attr_price); |
| | | } |
| | | |
| | | $attr = str_replace('[0]', '', $attr); |
| | | } |
| | | |
| | | return $attr; |
| | | } |
| | | |
| | | /** |
| | | * 取得用户信息 |
| | | * @param int $user_id 用户id |
| | | * @return array 用户信息 |
| | | */ |
| | | function user_info($user_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('users') . |
| | | " WHERE user_id = '$user_id'"; |
| | | $user = $GLOBALS['db']->getRow($sql); |
| | | |
| | | unset($user['question']); |
| | | unset($user['answer']); |
| | | |
| | | /* 格式化帐户余额 */ |
| | | if ($user) |
| | | { |
| | | // if ($user['user_money'] < 0) |
| | | // { |
| | | // $user['user_money'] = 0; |
| | | // } |
| | | $user['formated_user_money'] = price_format($user['user_money'], false); |
| | | $user['formated_frozen_money'] = price_format($user['frozen_money'], false); |
| | | } |
| | | |
| | | return $user; |
| | | } |
| | | |
| | | /** |
| | | * 修改用户 |
| | | * @param int $user_id 订单id |
| | | * @param array $user key => value |
| | | * @return bool |
| | | */ |
| | | function update_user($user_id, $user) |
| | | { |
| | | return $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('users'), |
| | | $user, 'UPDATE', "user_id = '$user_id'"); |
| | | } |
| | | |
| | | /** |
| | | * 取得用户地址列表 |
| | | * @param int $user_id 用户id |
| | | * @return array |
| | | */ |
| | | function address_list($user_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_address') . |
| | | " WHERE user_id = '$user_id'"; |
| | | |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得用户地址信息 |
| | | * @param int $address_id 地址id |
| | | * @return array |
| | | */ |
| | | function address_info($address_id) |
| | | { |
| | | $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('user_address') . |
| | | " WHERE address_id = '$address_id'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得用户当前可用红包 |
| | | * @param int $user_id 用户id |
| | | * @param float $goods_amount 订单商品金额 |
| | | * @return array 红包数组 |
| | | */ |
| | | function user_bonus($user_id, $goods_amount = 0) |
| | | { |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | $sql = "SELECT t.type_id, t.type_name, t.type_money, b.bonus_id, t.supplier_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," . |
| | | $GLOBALS['ecs']->table('user_bonus') . " AS b " . |
| | | "WHERE t.type_id = b.bonus_type_id " . |
| | | "AND t.use_start_date <= '$today' " . |
| | | "AND t.use_end_date >= '$today' " . |
| | | "AND t.min_goods_amount <= '$goods_amount' " . |
| | | "AND b.user_id<>0 " . |
| | | "AND b.user_id = '$user_id' " . |
| | | "AND b.order_id = 0"; |
| | | return $GLOBALS['db']->getAll($sql); |
| | | } |
| | | |
| | | /** |
| | | * 取得红包信息 |
| | | * @param int $bonus_id 红包id |
| | | * @param string $bonus_sn 红包序列号 |
| | | * @param array 红包信息 |
| | | */ |
| | | function bonus_info($bonus_id, $bonus_sn = '') |
| | | { |
| | | $sql = "SELECT t.*, sum(t.type_money) as type_money, b.* " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . " AS t," . |
| | | $GLOBALS['ecs']->table('user_bonus') . " AS b " . |
| | | "WHERE t.type_id = b.bonus_type_id "; |
| | | |
| | | if (!empty($bonus_id)) |
| | | { |
| | | $sql .= "AND b.bonus_id in(".$bonus_id.")"; |
| | | } |
| | | if(!empty($bonus_sn)) |
| | | { |
| | | $sql .= "AND b.bonus_sn in(".$bonus_sn.")"; |
| | | } |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | |
| | | /** |
| | | * 检查红包是否已使用 |
| | | * @param int $bonus_id 红包id |
| | | * @return bool |
| | | */ |
| | | function bonus_used($bonus_id) |
| | | { |
| | | $sql = "SELECT order_id FROM " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " WHERE bonus_id = '$bonus_id'"; |
| | | |
| | | return $GLOBALS['db']->getOne($sql) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 设置红包为已使用 |
| | | * @param int $bonus_id 红包id |
| | | * @param int $order_id 订单id |
| | | * @return bool |
| | | */ |
| | | function use_bonus($bonus_id, $order_id) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " SET order_id = '$order_id', used_time = '" . gmtime() . "' " . |
| | | "WHERE bonus_id = '$bonus_id' LIMIT 1"; |
| | | |
| | | return $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 设置红包为未使用 |
| | | * @param int $bonus_id 红包id |
| | | * @param int $order_id 订单id |
| | | * @return bool |
| | | */ |
| | | function unuse_bonus($bonus_id) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " SET order_id = 0, used_time = 0 " . |
| | | "WHERE bonus_id = '$bonus_id' LIMIT 1"; |
| | | |
| | | return $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 计算积分的价值(能抵多少钱) |
| | | * @param int $integral 积分 |
| | | * @return float 积分价值 |
| | | */ |
| | | function value_of_integral($integral) |
| | | { |
| | | $scale = floatval($GLOBALS['_CFG']['integral_scale']); |
| | | |
| | | return $scale > 0 ? round(($integral / 100) * $scale, 2) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 计算指定的金额需要多少积分 |
| | | * |
| | | * @access public |
| | | * @param integer $value 金额 |
| | | * @return void |
| | | */ |
| | | function integral_of_value($value) |
| | | { |
| | | $scale = floatval($GLOBALS['_CFG']['integral_scale']); |
| | | |
| | | return $scale > 0 ? round($value / $scale * 100) : 0; |
| | | } |
| | | |
| | | /** |
| | | * 订单退款 |
| | | * @param array $order 订单 |
| | | * @param int $refund_type 退款方式 1 到帐户余额 2 到退款申请(先到余额,再申请提款) 3 不处理 |
| | | * @param string $refund_note 退款说明 |
| | | * @param float $refund_amount 退款金额(如果为0,取订单已付款金额) |
| | | * @return bool |
| | | */ |
| | | function order_refund($order, $refund_type, $refund_note, $refund_amount = 0) |
| | | { |
| | | /* 检查参数 */ |
| | | $user_id = $order['user_id']; |
| | | if ($user_id == 0 && $refund_type == 1) |
| | | { |
| | | die('anonymous, cannot return to account balance'); |
| | | } |
| | | |
| | | $amount = $refund_amount > 0 ? $refund_amount : $order['money_paid']; |
| | | if ($amount <= 0) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (!in_array($refund_type, array(1, 2, 3))) |
| | | { |
| | | die('invalid params'); |
| | | } |
| | | |
| | | /* 备注信息 */ |
| | | if ($refund_note) |
| | | { |
| | | $change_desc = $refund_note; |
| | | } |
| | | else |
| | | { |
| | | include_once(ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/admin/order.php'); |
| | | $change_desc = sprintf($GLOBALS['_LANG']['order_refund'], $order['order_sn']); |
| | | } |
| | | |
| | | /* 处理退款 */ |
| | | if (1 == $refund_type) |
| | | { |
| | | log_account_change($user_id, $amount, 0, 0, 0, $change_desc); |
| | | |
| | | return true; |
| | | } |
| | | elseif (2 == $refund_type) |
| | | { |
| | | /* 如果非匿名,退回余额 */ |
| | | if ($user_id > 0) |
| | | { |
| | | log_account_change($user_id, $amount, 0, 0, 0, $change_desc); |
| | | } |
| | | |
| | | /* user_account 表增加提款申请记录 */ |
| | | $account = array( |
| | | 'user_id' => $user_id, |
| | | 'amount' => (-1) * $amount, |
| | | 'add_time' => gmtime(), |
| | | 'user_note' => $refund_note, |
| | | 'process_type' => SURPLUS_RETURN, |
| | | 'admin_user' => $_SESSION['admin_name'], |
| | | 'admin_note' => sprintf($GLOBALS['_LANG']['order_refund'], $order['order_sn']), |
| | | 'is_paid' => 0 |
| | | ); |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('user_account'), $account, 'INSERT'); |
| | | |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /* 重构方法_start By */ |
| | | /** |
| | | * 获得购物车中的商品 |
| | | * |
| | | * @access public |
| | | * @return array |
| | | */ |
| | | function get_cart_goods($other='') |
| | | { |
| | | /* 初始化 */ |
| | | $goods_list = array(); |
| | | $total = array( |
| | | 'goods_price' => 0, // 本店售价合计(有格式) |
| | | 'market_price' => 0, // 市场售价合计(有格式) |
| | | 'saving' => 0, // 节省金额(有格式) |
| | | 'save_rate' => 0, // 节省百分比 |
| | | 'goods_amount' => 0, // 本店售价合计(无格式) |
| | | ); |
| | | |
| | | /* 循环、统计 */ |
| | | |
| | | /* 代码增加_start By */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT c.*, g.supplier_id, IF(c.parent_id, c.parent_id, c.goods_id) AS pid " . |
| | | " FROM " . $GLOBALS['ecs']->table('cart') . " AS c left join " .$GLOBALS['ecs']->table('goods')." AS g ". |
| | | " on c.goods_id=g.goods_id ". |
| | | " WHERE $sql_where AND c.rec_type = '" . CART_GENERAL_GOODS . "' $other " . |
| | | " ORDER BY pid, c.parent_id"; |
| | | /* 代码增加_end By */ |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | |
| | | /* 用于统计购物车中实体商品和虚拟商品的个数 */ |
| | | $virtual_goods_count = 0; |
| | | $real_goods_count = 0; |
| | | |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $total['goods_price'] += $row['goods_price'] * $row['goods_number']; |
| | | $total['market_price'] += $row['market_price'] * $row['goods_number']; |
| | | |
| | | $row['subtotal'] = price_format($row['goods_price'] * $row['goods_number'], false); |
| | | $row['goods_price'] = price_format($row['goods_price'], false); |
| | | $row['market_price'] = price_format($row['market_price'], false); |
| | | |
| | | /* 统计实体商品和虚拟商品的个数 */ |
| | | if ($row['is_real']) |
| | | { |
| | | $real_goods_count++; |
| | | } |
| | | else |
| | | { |
| | | $virtual_goods_count++; |
| | | } |
| | | |
| | | /* 查询规格 */ |
| | | if (trim($row['goods_attr']) != '') |
| | | { |
| | | $row['goods_attr']=addslashes($row['goods_attr']); |
| | | $sql = "SELECT attr_value FROM " . $GLOBALS['ecs']->table('goods_attr') . " WHERE goods_attr_id " . |
| | | db_create_in($row['goods_attr']); |
| | | $attr_list = $GLOBALS['db']->getCol($sql); |
| | | foreach ($attr_list AS $attr) |
| | | { |
| | | $row['goods_name'] .= ' [' . $attr . '] '; |
| | | } |
| | | } |
| | | /* 增加是否在购物车里显示商品图 */ |
| | | if (($GLOBALS['_CFG']['show_goods_in_cart'] == "2" || $GLOBALS['_CFG']['show_goods_in_cart'] == "3") && $row['extension_code'] != 'package_buy') |
| | | { |
| | | $goods_thumb = $GLOBALS['db']->getOne("SELECT `goods_thumb` FROM " . $GLOBALS['ecs']->table('goods') . " WHERE `goods_id`='{$row['goods_id']}'"); |
| | | $row['goods_thumb'] = get_image_path($row['goods_id'], $goods_thumb, true); |
| | | } |
| | | if ($row['extension_code'] == 'package_buy') |
| | | { |
| | | $row['package_goods_list'] = get_package_goods($row['goods_id'], $row['package_attr_id'] ); //修改 by 增加一个变量 |
| | | } |
| | | |
| | | /* 代码增加_start By */ |
| | | $row['is_cansel'] = is_cansel($row['goods_id'], $row['product_id'], $row['package_buy']); |
| | | |
| | | if($row['supplier_id']) |
| | | { |
| | | $supplier_name = $GLOBALS['db']->getOne("select supplier_name from ". $GLOBALS['ecs']->table('supplier') ." where supplier_id='". $row['supplier_id']."' "); |
| | | $supplier_name = '供货商:'. $supplier_name; |
| | | } |
| | | else |
| | | { |
| | | $supplier_name = '网站自营'; |
| | | } |
| | | |
| | | $keyname = $row['supplier_id'] ? $row['supplier_id'] : '0' ; |
| | | $goods_list[$keyname]['goods_list'][] = $row; |
| | | $goods_list[$keyname]['supplier_name'] = $supplier_name; |
| | | ksort($goods_list); |
| | | |
| | | //$goods_list[] = $row; |
| | | |
| | | /* 代码修改_end By */ |
| | | } |
| | | $total['goods_amount'] = $total['goods_price']; |
| | | $total['saving'] = price_format($total['market_price'] - $total['goods_price'], false); |
| | | if ($total['market_price'] > 0) |
| | | { |
| | | $total['save_rate'] = $total['market_price'] ? round(($total['market_price'] - $total['goods_price']) * |
| | | 100 / $total['market_price']).'%' : 0; |
| | | } |
| | | $total['goods_price'] = price_format($total['goods_price'], false); |
| | | $total['market_price'] = price_format($total['market_price'], false); |
| | | $total['real_goods_count'] = $real_goods_count; |
| | | $total['virtual_goods_count'] = $virtual_goods_count; |
| | | |
| | | return array('goods_list' => $goods_list, 'total' => $total); |
| | | } |
| | | |
| | | /** |
| | | * 取得收货人信息 |
| | | * @param int $user_id 用户编号 |
| | | * @return array |
| | | */ |
| | | function get_consignee($user_id) |
| | | { |
| | | if (isset($_SESSION['flow_consignee'])) |
| | | { |
| | | //如果在用户中心首次新增地址,去结算时获得的session只有$_SESSION['flow_consignee']['country'] |
| | | if(!isset($_SESSION['flow_consignee']['province'])) |
| | | { |
| | | if ($user_id > 0) |
| | | { |
| | | /* 取默认地址 */ |
| | | $sql = "SELECT * FROM ".$GLOBALS['ecs']->table('user_address')." WHERE user_id='$user_id'"; |
| | | $arr = $GLOBALS['db']->getRow($sql); |
| | | return $arr; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | return $_SESSION['flow_consignee']; |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | /* 如果不存在,则取得用户的默认收货人信息 */ |
| | | $arr = array(); |
| | | |
| | | if ($user_id > 0) |
| | | { |
| | | /* 取默认地址 */ |
| | | $sql = "SELECT ua.*". |
| | | " FROM " . $GLOBALS['ecs']->table('user_address') . "AS ua, ".$GLOBALS['ecs']->table('users').' AS u '. |
| | | " WHERE u.user_id='$user_id' AND ua.address_id = u.address_id"; |
| | | |
| | | $arr = $GLOBALS['db']->getRow($sql); |
| | | } |
| | | return $arr; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询购物车(订单id为0)或订单中是否有实体商品 |
| | | * @param int $order_id 订单id |
| | | * @param int $flow_type 购物流程类型 |
| | | * @return bool |
| | | */ |
| | | function exist_real_goods($order_id = 0, $flow_type = CART_GENERAL_GOODS) |
| | | { |
| | | if ($order_id <= 0) |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "' AND is_real = 1 " . |
| | | "AND rec_type = '$flow_type'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id' AND is_real = 1"; |
| | | } |
| | | |
| | | return $GLOBALS['db']->getOne($sql) > 0; |
| | | } |
| | | |
| | | /** |
| | | * 检查收货人信息是否完整 |
| | | * @param array $consignee 收货人信息 |
| | | * @param int $flow_type 购物流程类型 |
| | | * @return bool true 完整 false 不完整 |
| | | */ |
| | | |
| | | /* 代码修改_start By */ |
| | | function check_consignee_info($consignee, $flow_type) |
| | | { |
| | | if (exist_real_goods(0, $flow_type)) |
| | | { |
| | | /* 如果存在实体商品 */ |
| | | $res = !empty($consignee['consignee']) && |
| | | !empty($consignee['country']) ; |
| | | |
| | | if ($res) |
| | | { |
| | | if (empty($consignee['province'])) |
| | | { |
| | | /* 没有设置省份,检查当前国家下面有没有设置省份 */ |
| | | $pro = get_regions(1, $consignee['country']); |
| | | $res = empty($pro); |
| | | } |
| | | elseif (empty($consignee['city'])) |
| | | { |
| | | /* 没有设置城市,检查当前省下面有没有城市 */ |
| | | $city = get_regions(2, $consignee['province']); |
| | | $res = empty($city); |
| | | } |
| | | elseif (empty($consignee['district'])) |
| | | { |
| | | $dist = get_regions(3, $consignee['city']); |
| | | $res = empty($dist); |
| | | } |
| | | } |
| | | |
| | | return $res; |
| | | } |
| | | else |
| | | { |
| | | /* 如果不存在实体商品 */ |
| | | return !empty($consignee['consignee']) ; |
| | | } |
| | | } |
| | | /* 代码修改_end By */ |
| | | |
| | | /** |
| | | * 获得上一次用户采用的支付和配送方式 |
| | | * |
| | | * @access public |
| | | * @return void |
| | | */ |
| | | function last_shipping_and_payment() |
| | | { |
| | | $sql = "SELECT shipping_id, pay_id " . |
| | | " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE user_id = '$_SESSION[user_id]' " . |
| | | " ORDER BY order_id DESC LIMIT 1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if (empty($row)) |
| | | { |
| | | /* 如果获得是一个空数组,则返回默认值 */ |
| | | $row = array('shipping_id' => 0, 'pay_id' => 0); |
| | | } |
| | | |
| | | return $row; |
| | | } |
| | | |
| | | /** |
| | | * 取得当前用户应该得到的红包总额 |
| | | */ |
| | | function get_total_bonus() |
| | | { |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | /* 按商品发的红包 */ |
| | | $sql = "SELECT SUM(c.goods_number * t.type_money)" . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " |
| | | . $GLOBALS['ecs']->table('bonus_type') . " AS t, " |
| | | . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.session_id = '" . SESS_ID . "' " . |
| | | "AND c.is_gift = 0 " . |
| | | "AND c.goods_id = g.goods_id " . |
| | | "AND g.bonus_type_id = t.type_id " . |
| | | "AND t.send_type = '" . SEND_BY_GOODS . "' " . |
| | | "AND t.send_start_date <= '$today' " . |
| | | "AND t.send_end_date >= '$today' " . |
| | | "AND c.rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $goods_total = floatval($GLOBALS['db']->getOne($sql)); |
| | | |
| | | /* 取得购物车中非赠品总金额 */ |
| | | $sql = "SELECT SUM(goods_price * goods_number) " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . |
| | | " WHERE session_id = '" . SESS_ID . "' " . |
| | | " AND is_gift = 0 " . |
| | | " AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $amount = floatval($GLOBALS['db']->getOne($sql)); |
| | | |
| | | /* 按订单发的红包 */ |
| | | $sql = "SELECT FLOOR('$amount' / min_amount) * type_money " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . |
| | | " WHERE send_type = '" . SEND_BY_ORDER . "' " . |
| | | " AND send_start_date <= '$today' " . |
| | | "AND send_end_date >= '$today' " . |
| | | "AND min_amount > 0 "; |
| | | $order_total = floatval($GLOBALS['db']->getOne($sql)); |
| | | |
| | | return $goods_total + $order_total; |
| | | } |
| | | |
| | | /** |
| | | * 处理红包(下订单时设为使用,取消(无效,退货)订单时设为未使用 |
| | | * @param int $bonus_id 红包编号 |
| | | * @param int $order_id 订单号 |
| | | * @param int $is_used 是否使用了 |
| | | */ |
| | | function change_user_bonus($bonus_id, $order_id, $is_used = true) |
| | | { |
| | | if ($is_used) |
| | | { |
| | | $sql = 'UPDATE ' . $GLOBALS['ecs']->table('user_bonus') . ' SET ' . |
| | | 'used_time = ' . gmtime() . ', ' . |
| | | "order_id = '$order_id' " . |
| | | "WHERE bonus_id = '$bonus_id'"; |
| | | } |
| | | else |
| | | { |
| | | $sql = 'UPDATE ' . $GLOBALS['ecs']->table('user_bonus') . ' SET ' . |
| | | 'used_time = 0, ' . |
| | | 'order_id = 0 ' . |
| | | "WHERE bonus_id = '$bonus_id'"; |
| | | } |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /** |
| | | * 获得订单信息 |
| | | * |
| | | * @access private |
| | | * @return array |
| | | */ |
| | | function flow_order_info() |
| | | { |
| | | $order = isset($_SESSION['flow_order']) ? $_SESSION['flow_order'] : array(); |
| | | |
| | | /* 初始化配送和支付方式 */ |
| | | if (!isset($order['shipping_id']) || !isset($order['pay_id'])) |
| | | { |
| | | /* 如果还没有设置配送和支付 */ |
| | | if ($_SESSION['user_id'] > 0) |
| | | { |
| | | /* 用户已经登录了,则获得上次使用的配送和支付 */ |
| | | $arr = last_shipping_and_payment(); |
| | | |
| | | if (!isset($order['shipping_id'])) |
| | | { |
| | | $order['shipping_id'] = $arr['shipping_id']; |
| | | } |
| | | if (!isset($order['pay_id'])) |
| | | { |
| | | $order['pay_id'] = $arr['pay_id']; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!isset($order['shipping_id'])) |
| | | { |
| | | $order['shipping_id'] = 0; |
| | | } |
| | | if (!isset($order['pay_id'])) |
| | | { |
| | | $order['pay_id'] = 0; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!isset($order['pack_id'])) |
| | | { |
| | | $order['pack_id'] = 0; // 初始化包装 |
| | | } |
| | | if (!isset($order['card_id'])) |
| | | { |
| | | $order['card_id'] = 0; // 初始化贺卡 |
| | | } |
| | | if (!isset($order['bonus'])) |
| | | { |
| | | $order['bonus'] = 0; // 初始化红包 |
| | | } |
| | | if (!isset($order['integral'])) |
| | | { |
| | | $order['integral'] = 0; // 初始化积分 |
| | | } |
| | | if (!isset($order['surplus'])) |
| | | { |
| | | $order['surplus'] = 0; // 初始化余额 |
| | | } |
| | | |
| | | /* 扩展信息 */ |
| | | if (isset($_SESSION['flow_type']) && intval($_SESSION['flow_type']) != CART_GENERAL_GOODS) |
| | | { |
| | | $order['extension_code'] = $_SESSION['extension_code']; |
| | | $order['extension_id'] = $_SESSION['extension_id']; |
| | | } |
| | | |
| | | return $order; |
| | | } |
| | | |
| | | /** |
| | | * 合并订单 |
| | | * @param string $from_order_sn 从订单号 |
| | | * @param string $to_order_sn 主订单号 |
| | | * @return 成功返回true,失败返回错误信息 |
| | | */ |
| | | function merge_order($from_order_sn, $to_order_sn) |
| | | { |
| | | /* 订单号不能为空 */ |
| | | if (trim($from_order_sn) == '' || trim($to_order_sn) == '') |
| | | { |
| | | return $GLOBALS['_LANG']['order_sn_not_null']; |
| | | } |
| | | |
| | | /* 订单号不能相同 */ |
| | | if ($from_order_sn == $to_order_sn) |
| | | { |
| | | return $GLOBALS['_LANG']['two_order_sn_same']; |
| | | } |
| | | |
| | | /* 取得订单信息 */ |
| | | $from_order = order_info(0, $from_order_sn); |
| | | $to_order = order_info(0, $to_order_sn); |
| | | |
| | | /* 检查订单是否存在 */ |
| | | if (!$from_order) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['order_not_exist'], $from_order_sn); |
| | | } |
| | | elseif (!$to_order) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['order_not_exist'], $to_order_sn); |
| | | } |
| | | |
| | | /* 检查合并的订单是否为普通订单,非普通订单不允许合并 */ |
| | | if ($from_order['extension_code'] != '' || $to_order['extension_code'] != 0) |
| | | { |
| | | return $GLOBALS['_LANG']['merge_invalid_order']; |
| | | } |
| | | |
| | | /* 检查订单状态是否是已确认或未确认、未付款、未发货 */ |
| | | if ($from_order['order_status'] != OS_UNCONFIRMED && $from_order['order_status'] != OS_CONFIRMED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $from_order_sn); |
| | | } |
| | | elseif ($from_order['pay_status'] != PS_UNPAYED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $from_order_sn); |
| | | } |
| | | elseif ($from_order['shipping_status'] != SS_UNSHIPPED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $from_order_sn); |
| | | } |
| | | |
| | | if ($to_order['order_status'] != OS_UNCONFIRMED && $to_order['order_status'] != OS_CONFIRMED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['os_not_unconfirmed_or_confirmed'], $to_order_sn); |
| | | } |
| | | elseif ($to_order['pay_status'] != PS_UNPAYED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ps_not_unpayed'], $to_order_sn); |
| | | } |
| | | elseif ($to_order['shipping_status'] != SS_UNSHIPPED) |
| | | { |
| | | return sprintf($GLOBALS['_LANG']['ss_not_unshipped'], $to_order_sn); |
| | | } |
| | | |
| | | /* 检查订单用户是否相同 */ |
| | | if ($from_order['user_id'] != $to_order['user_id']) |
| | | { |
| | | return $GLOBALS['_LANG']['order_user_not_same']; |
| | | } |
| | | |
| | | /* 合并订单 */ |
| | | $order = $to_order; |
| | | $order['order_id'] = ''; |
| | | $order['add_time'] = gmtime(); |
| | | |
| | | // 合并商品总额 |
| | | $order['goods_amount'] += $from_order['goods_amount']; |
| | | |
| | | // 合并折扣 |
| | | $order['discount'] += $from_order['discount']; |
| | | |
| | | if ($order['shipping_id'] > 0) |
| | | { |
| | | // 重新计算配送费用 |
| | | $weight_price = order_weight_price($to_order['order_id']); |
| | | $from_weight_price = order_weight_price($from_order['order_id']); |
| | | $weight_price['weight'] += $from_weight_price['weight']; |
| | | $weight_price['amount'] += $from_weight_price['amount']; |
| | | $weight_price['number'] += $from_weight_price['number']; |
| | | |
| | | $region_id_list = array($order['country'], $order['province'], $order['city'], $order['district']); |
| | | $shipping_area = shipping_area_info($order['shipping_id'], $region_id_list); |
| | | |
| | | $order['shipping_fee'] = shipping_fee($shipping_area['shipping_code'], |
| | | unserialize($shipping_area['configure']), $weight_price['weight'], $weight_price['amount'], $weight_price['number']); |
| | | |
| | | // 如果保价了,重新计算保价费 |
| | | if ($order['insure_fee'] > 0) |
| | | { |
| | | $order['insure_fee'] = shipping_insure_fee($shipping_area['shipping_code'], $order['goods_amount'], $shipping_area['insure']); |
| | | } |
| | | } |
| | | |
| | | // 重新计算包装费、贺卡费 |
| | | if ($order['pack_id'] > 0) |
| | | { |
| | | $pack = pack_info($order['pack_id']); |
| | | $order['pack_fee'] = $pack['free_money'] > $order['goods_amount'] ? $pack['pack_fee'] : 0; |
| | | } |
| | | if ($order['card_id'] > 0) |
| | | { |
| | | $card = card_info($order['card_id']); |
| | | $order['card_fee'] = $card['free_money'] > $order['goods_amount'] ? $card['card_fee'] : 0; |
| | | } |
| | | |
| | | // 红包不变,合并积分、余额、已付款金额 |
| | | $order['integral'] += $from_order['integral']; |
| | | $order['integral_money'] = value_of_integral($order['integral']); |
| | | $order['surplus'] += $from_order['surplus']; |
| | | $order['money_paid'] += $from_order['money_paid']; |
| | | |
| | | // 计算应付款金额(不包括支付费用) |
| | | $order['order_amount'] = $order['goods_amount'] - $order['discount'] |
| | | + $order['shipping_fee'] |
| | | + $order['insure_fee'] |
| | | + $order['pack_fee'] |
| | | + $order['card_fee'] |
| | | - $order['bonus'] |
| | | - $order['integral_money'] |
| | | - $order['surplus'] |
| | | - $order['money_paid']; |
| | | |
| | | // 重新计算支付费 |
| | | if ($order['pay_id'] > 0) |
| | | { |
| | | // 货到付款手续费 |
| | | $cod_fee = $shipping_area ? $shipping_area['pay_fee'] : 0; |
| | | $order['pay_fee'] = pay_fee($order['pay_id'], $order['order_amount'], $cod_fee); |
| | | |
| | | // 应付款金额加上支付费 |
| | | $order['order_amount'] += $order['pay_fee']; |
| | | } |
| | | |
| | | /* 插入订单表 */ |
| | | do |
| | | { |
| | | $order['order_sn'] = get_order_sn(); |
| | | if ($GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('order_info'), addslashes_deep($order), 'INSERT')) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | if ($GLOBALS['db']->errno() != 1062) |
| | | { |
| | | die($GLOBALS['db']->errorMsg()); |
| | | } |
| | | } |
| | | } |
| | | while (true); // 防止订单号重复 |
| | | |
| | | /* 订单号 */ |
| | | $order_id = $GLOBALS['db']->insert_id(); |
| | | |
| | | /* 更新订单商品 */ |
| | | $sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_goods') . |
| | | " SET order_id = '$order_id' " . |
| | | "WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id'])); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | include_once(ROOT_PATH . 'includes/lib_clips.php'); |
| | | /* 插入支付日志 */ |
| | | insert_pay_log($order_id, $order['order_amount'], PAY_ORDER); |
| | | |
| | | /* 删除原订单 */ |
| | | $sql = 'DELETE FROM ' . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id'])); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 删除原订单支付日志 */ |
| | | $sql = 'DELETE FROM ' . $GLOBALS['ecs']->table('pay_log') . |
| | | " WHERE order_id " . db_create_in(array($from_order['order_id'], $to_order['order_id'])); |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | /* 返还 from_order 的红包,因为只使用 to_order 的红包 */ |
| | | if ($from_order['bonus_id'] > 0) |
| | | { |
| | | unuse_bonus($from_order['bonus_id']); |
| | | } |
| | | |
| | | /* 返回成功 */ |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 查询配送区域属于哪个办事处管辖 |
| | | * @param array $regions 配送区域(1、2、3、4级按顺序) |
| | | * @return int 办事处id,可能为0 |
| | | */ |
| | | function get_agency_by_regions($regions) |
| | | { |
| | | if (!is_array($regions) || empty($regions)) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | $arr = array(); |
| | | $sql = "SELECT region_id, agency_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('region') . |
| | | " WHERE region_id " . db_create_in($regions) . |
| | | " AND region_id > 0 AND agency_id > 0"; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $arr[$row['region_id']] = $row['agency_id']; |
| | | } |
| | | if (empty($arr)) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | $agency_id = 0; |
| | | for ($i = count($regions) - 1; $i >= 0; $i--) |
| | | { |
| | | if (isset($arr[$regions[$i]])) |
| | | { |
| | | return $arr[$regions[$i]]; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取配送插件的实例 |
| | | * @param int $shipping_id 配送插件ID |
| | | * @return object 配送插件对象实例 |
| | | */ |
| | | function &get_shipping_object($shipping_id) |
| | | { |
| | | $shipping = shipping_info($shipping_id); |
| | | if (!$shipping) |
| | | { |
| | | $object = new stdClass(); |
| | | return $object; |
| | | } |
| | | |
| | | $file_path = ROOT_PATH.'includes/modules/shipping/' . $shipping['shipping_code'] . '.php'; |
| | | |
| | | include_once($file_path); |
| | | |
| | | $object = new $shipping['shipping_code']; |
| | | return $object; |
| | | } |
| | | |
| | | /** |
| | | * 改变订单中商品库存 |
| | | * @param int $order_id 订单号 |
| | | * @param bool $is_dec 是否减少库存 |
| | | * @param bool $storage 减库存的时机,1,下订单时;0,发货时; |
| | | */ |
| | | function change_order_goods_storage($order_id, $is_dec = true, $storage = 0) |
| | | { |
| | | /* 查询订单商品信息 */ |
| | | switch ($storage) |
| | | { |
| | | case 0 : |
| | | $sql = "SELECT goods_id, SUM(send_number) AS num, MAX(extension_code) AS extension_code, product_id FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id' AND is_real = 1 GROUP BY goods_id, product_id"; |
| | | break; |
| | | |
| | | case 1 : |
| | | $sql = "SELECT goods_id, SUM(goods_number) AS num, MAX(extension_code) AS extension_code, product_id FROM " . $GLOBALS['ecs']->table('order_goods') . |
| | | " WHERE order_id = '$order_id' AND is_real = 1 GROUP BY goods_id, product_id"; |
| | | break; |
| | | } |
| | | |
| | | $res = $GLOBALS['db']->query($sql); |
| | | while ($row = $GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | if ($row['extension_code'] != "package_buy") |
| | | { |
| | | if ($is_dec) |
| | | { |
| | | change_goods_storage($row['goods_id'], $row['product_id'], - $row['num']); |
| | | } |
| | | else |
| | | { |
| | | change_goods_storage($row['goods_id'], $row['product_id'], $row['num']); |
| | | } |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT goods_id, goods_number" . |
| | | " FROM " . $GLOBALS['ecs']->table('package_goods') . |
| | | " WHERE package_id = '" . $row['goods_id'] . "'"; |
| | | $res_goods = $GLOBALS['db']->query($sql); |
| | | while ($row_goods = $GLOBALS['db']->fetchRow($res_goods)) |
| | | { |
| | | $sql = "SELECT is_real" . |
| | | " FROM " . $GLOBALS['ecs']->table('goods') . |
| | | " WHERE goods_id = '" . $row_goods['goods_id'] . "'"; |
| | | $real_goods = $GLOBALS['db']->query($sql); |
| | | $is_goods = $GLOBALS['db']->fetchRow($real_goods); |
| | | |
| | | if ($is_dec) |
| | | { |
| | | change_goods_storage($row_goods['goods_id'], $row['product_id'], - ($row['num'] * $row_goods['goods_number'])); |
| | | } |
| | | elseif ($is_goods['is_real']) |
| | | { |
| | | change_goods_storage($row_goods['goods_id'], $row['product_id'], ($row['num'] * $row_goods['goods_number'])); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 商品库存增与减 货品库存增与减 |
| | | * |
| | | * @param int $good_id 商品ID |
| | | * @param int $product_id 货品ID |
| | | * @param int $number 增减数量,默认0; |
| | | * |
| | | * @return bool true,成功;false,失败; |
| | | */ |
| | | function change_goods_storage($good_id, $product_id, $number = 0) |
| | | { |
| | | if ($number == 0) |
| | | { |
| | | return true; // 值为0即不做、增减操作,返回true |
| | | } |
| | | |
| | | if (empty($good_id) || empty($number)) |
| | | { |
| | | return false; |
| | | } |
| | | |
| | | $number = ($number > 0) ? '+ ' . $number : $number; |
| | | |
| | | /* 处理货品库存 */ |
| | | $products_query = true; |
| | | if (!empty($product_id)) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('products') ." |
| | | SET product_number = product_number $number |
| | | WHERE goods_id = '$good_id' |
| | | AND product_id = '$product_id' |
| | | LIMIT 1"; |
| | | $products_query = $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | /* 处理商品库存 */ |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('goods') ." |
| | | SET goods_number = goods_number $number |
| | | WHERE goods_id = '$good_id' |
| | | LIMIT 1"; |
| | | $query = $GLOBALS['db']->query($sql); |
| | | |
| | | if ($query && $products_query) |
| | | { |
| | | return true; |
| | | } |
| | | else |
| | | { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得支付方式id列表 |
| | | * @param bool $is_cod 是否货到付款 |
| | | * @return array |
| | | */ |
| | | function payment_id_list($is_cod) |
| | | { |
| | | $sql = "SELECT pay_id FROM " . $GLOBALS['ecs']->table('payment'); |
| | | if ($is_cod) |
| | | { |
| | | $sql .= " WHERE is_cod = 1"; |
| | | } |
| | | else |
| | | { |
| | | $sql .= " WHERE is_cod = 0"; |
| | | } |
| | | |
| | | return $GLOBALS['db']->getCol($sql); |
| | | } |
| | | |
| | | /** |
| | | * 生成查询订单的sql |
| | | * @param string $type 类型 |
| | | * @param string $alias order表的别名(包括.例如 o.) |
| | | * @return string |
| | | */ |
| | | function order_query_sql($type = 'finished', $alias = '') |
| | | { |
| | | /* 已完成订单 */ |
| | | if ($type == 'finished') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) . |
| | | " AND {$alias}shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . |
| | | " AND {$alias}pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " "; |
| | | } |
| | | /* 待发货订单 */ |
| | | elseif ($type == 'await_ship') |
| | | { |
| | | return " AND {$alias}order_status " . |
| | | db_create_in(array(OS_CONFIRMED, OS_SPLITED, OS_SPLITING_PART)) . |
| | | " AND {$alias}shipping_status " . |
| | | db_create_in(array(SS_UNSHIPPED, SS_PREPARING, SS_SHIPPED_ING)) . |
| | | " AND ( {$alias}pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) . " OR {$alias}pay_id " . db_create_in(payment_id_list(true)) . ") "; |
| | | } |
| | | /* 待付款订单 */ |
| | | elseif ($type == 'await_pay') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) . |
| | | " AND {$alias}pay_status = '" . PS_UNPAYED . "'" . |
| | | " AND ( {$alias}shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " OR {$alias}pay_id " . db_create_in(payment_id_list(false)) . ") "; |
| | | } |
| | | /* 未确认订单 */ |
| | | elseif ($type == 'unconfirmed') |
| | | { |
| | | return " AND {$alias}order_status = '" . OS_UNCONFIRMED . "' "; |
| | | } |
| | | /* 未处理订单:用户可操作 */ |
| | | elseif ($type == 'unprocessed') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_UNCONFIRMED, OS_CONFIRMED)) . |
| | | " AND {$alias}shipping_status = '" . SS_UNSHIPPED . "'" . |
| | | " AND {$alias}pay_status = '" . PS_UNPAYED . "' "; |
| | | } |
| | | /* 未付款未发货订单:管理员可操作 */ |
| | | elseif ($type == 'unpay_unship') |
| | | { |
| | | return " AND {$alias}order_status " . db_create_in(array(OS_UNCONFIRMED, OS_CONFIRMED)) . |
| | | " AND {$alias}shipping_status " . db_create_in(array(SS_UNSHIPPED, SS_PREPARING)) . |
| | | " AND {$alias}pay_status = '" . PS_UNPAYED . "' "; |
| | | } |
| | | /* 已发货订单:不论是否付款 */ |
| | | elseif ($type == 'shipped') |
| | | { |
| | | return " AND {$alias}order_status = '" . OS_CONFIRMED . "'" . |
| | | " AND {$alias}shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) . " "; |
| | | } |
| | | else |
| | | { |
| | | die('函数 order_query_sql 参数错误'); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 生成查询订单总金额的字段 |
| | | * @param string $alias order表的别名(包括.例如 o.) |
| | | * @return string |
| | | */ |
| | | function order_amount_field($alias = '') |
| | | { |
| | | return " {$alias}goods_amount + {$alias}tax + {$alias}shipping_fee" . |
| | | " + {$alias}insure_fee + {$alias}pay_fee + {$alias}pack_fee" . |
| | | " + {$alias}card_fee "; |
| | | } |
| | | |
| | | /** |
| | | * 生成计算应付款金额的字段 |
| | | * @param string $alias order表的别名(包括.例如 o.) |
| | | * @return string |
| | | */ |
| | | function order_due_field($alias = '') |
| | | { |
| | | return order_amount_field($alias) . |
| | | " - {$alias}money_paid - {$alias}surplus - {$alias}integral_money" . |
| | | " - {$alias}bonus - {$alias}discount "; |
| | | } |
| | | |
| | | /** |
| | | * 计算折扣:根据购物车和优惠活动 |
| | | * @param int $supplierid 店铺id |
| | | * @return float 折扣 |
| | | */ |
| | | function compute_discount($supplierid=-1) |
| | | { |
| | | /* 查询优惠活动 */ |
| | | $now = gmtime(); |
| | | $user_rank = ',' . $_SESSION['user_rank'] . ','; |
| | | $sql = "SELECT *" . |
| | | "FROM " . $GLOBALS['ecs']->table('favourable_activity') . |
| | | " WHERE start_time <= '$now'" . |
| | | " AND end_time >= '$now'" . |
| | | " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'" . |
| | | " AND act_type " . db_create_in(array(FAT_DISCOUNT, FAT_PRICE)); |
| | | $sql .= ($supplierid>=0) ? " AND supplier_id=".$supplierid : ""; |
| | | $favourable_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$favourable_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 查询购物车商品 */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT c.goods_id, c.goods_price * c.goods_number AS subtotal, g.cat_id, g.brand_id, g.supplier_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND " .$sql_where. |
| | | "AND c.parent_id = 0 " . |
| | | "AND c.is_gift = 0 " . |
| | | "AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $sql .= (isset($_SESSION['sel_cartgoods']) && !empty($_SESSION['sel_cartgoods'])) ? " AND c.rec_id in (". $_SESSION['sel_cartgoods'] .") " : ""; |
| | | $sql .= ($supplierid>=0) ? " AND g.supplier_id=".$supplierid : ""; |
| | | $goods_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$goods_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 初始化折扣 */ |
| | | $discount = 0; |
| | | $favourable_name = array(); |
| | | |
| | | /* 循环计算每个优惠活动的折扣 */ |
| | | foreach ($favourable_list as $favourable) |
| | | { |
| | | $total_amount = 0; |
| | | if ($favourable['act_range'] == FAR_ALL) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if($favourable['supplier_id'] == $goods['supplier_id']){ |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | /* 找出分类id的子分类id */ |
| | | $id_list = array(); |
| | | $raw_id_list = explode(',', $favourable['act_range_ext']); |
| | | foreach ($raw_id_list as $id) |
| | | { |
| | | $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false))); |
| | | } |
| | | $ids = join(',', array_unique($id_list)); |
| | | |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $ids . ',', ',' . $goods['cat_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['brand_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_GOODS) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['goods_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | /* 如果金额满足条件,累计折扣 */ |
| | | if ($total_amount > 0 && $total_amount >= $favourable['min_amount'] && ($total_amount <= $favourable['max_amount'] || $favourable['max_amount'] == 0)) |
| | | { |
| | | if ($favourable['act_type'] == FAT_DISCOUNT) |
| | | { |
| | | $discount += $total_amount * (1 - $favourable['act_type_ext'] / 100); |
| | | |
| | | $favourable_name[] = $favourable['act_name']; |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_PRICE) |
| | | { |
| | | $discount += $favourable['act_type_ext']; |
| | | |
| | | $favourable_name[] = $favourable['act_name']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | return array('discount' => $discount, 'name' => $favourable_name); |
| | | } |
| | | |
| | | /** |
| | | * 取得购物车该赠送的积分数 |
| | | * @return int 积分数 |
| | | */ |
| | | function get_give_integral() |
| | | { |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | $sql = "SELECT SUM(c.goods_number * IF(g.give_integral > -1, g.give_integral, c.goods_price))" . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND $sql_where " . |
| | | "AND c.rec_id in (".$_SESSION['sel_cartgoods'].")" . |
| | | "AND c.goods_id > 0 " . |
| | | "AND c.parent_id = 0 " . |
| | | "AND c.rec_type = 0 " . |
| | | "AND c.is_gift = 0"; |
| | | |
| | | return intval($GLOBALS['db']->getOne($sql)); |
| | | } |
| | | |
| | | /** |
| | | * 取得某订单应该赠送的积分数 |
| | | * @param array $order 订单 |
| | | * @return int 积分数 |
| | | */ |
| | | function integral_to_give($order) |
| | | { |
| | | /* 判断是否团购 */ |
| | | if ($order['extension_code'] == 'group_buy') |
| | | { |
| | | include_once(ROOT_PATH . 'includes/lib_goods.php'); |
| | | $group_buy = group_buy_info(intval($order['extension_id'])); |
| | | |
| | | return array('custom_points' => $group_buy['gift_integral'], 'rank_points' => $order['goods_amount']); |
| | | } |
| | | else |
| | | { |
| | | $sql = "SELECT SUM(og.goods_number * IF(g.give_integral > -1, g.give_integral, og.goods_price)) AS custom_points, SUM(og.goods_number * IF(g.rank_integral > -1, g.rank_integral, og.goods_price)) AS rank_points " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS og, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE og.goods_id = g.goods_id " . |
| | | "AND og.order_id = '$order[order_id]' " . |
| | | "AND og.goods_id > 0 " . |
| | | "AND og.parent_id = 0 " . |
| | | "AND og.is_gift = 0 AND og.extension_code != 'package_buy'"; |
| | | |
| | | return $GLOBALS['db']->getRow($sql); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 发红包:发货时发红包 |
| | | * @param int $order_id 订单号 |
| | | * @return bool |
| | | */ |
| | | function send_order_bonus($order_id) |
| | | { |
| | | /* 取得订单应该发放的红包 */ |
| | | $bonus_list = order_bonus($order_id); |
| | | |
| | | /* 如果有红包,统计并发送 */ |
| | | if ($bonus_list) |
| | | { |
| | | /* 用户信息 */ |
| | | $sql = "SELECT u.user_id, u.user_name, u.email " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_info') . " AS o, " . |
| | | $GLOBALS['ecs']->table('users') . " AS u " . |
| | | "WHERE o.order_id = '$order_id' " . |
| | | "AND o.user_id = u.user_id "; |
| | | $user = $GLOBALS['db']->getRow($sql); |
| | | |
| | | /* 统计 */ |
| | | $count = 0; |
| | | $money = ''; |
| | | foreach ($bonus_list AS $bonus) |
| | | { |
| | | $count += $bonus['number']; |
| | | $money .= price_format($bonus['type_money']) . ' [' . $bonus['number'] . '], '; |
| | | |
| | | /* 修改用户红包 */ |
| | | $sql = "INSERT INTO " . $GLOBALS['ecs']->table('user_bonus') . " (bonus_type_id, user_id) " . |
| | | "VALUES('$bonus[type_id]', '$user[user_id]')"; |
| | | for ($i = 0; $i < $bonus['number']; $i++) |
| | | { |
| | | if (!$GLOBALS['db']->query($sql)) |
| | | { |
| | | return $GLOBALS['db']->errorMsg(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /* 如果有红包,发送邮件 */ |
| | | if ($count > 0) |
| | | { |
| | | $tpl = get_mail_template('send_bonus'); |
| | | $GLOBALS['smarty']->assign('user_name', $user['user_name']); |
| | | $GLOBALS['smarty']->assign('count', $count); |
| | | $GLOBALS['smarty']->assign('money', $money); |
| | | $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']); |
| | | $GLOBALS['smarty']->assign('send_date', local_date($GLOBALS['_CFG']['date_format'])); |
| | | $GLOBALS['smarty']->assign('sent_date', local_date($GLOBALS['_CFG']['date_format'])); |
| | | $content = $GLOBALS['smarty']->fetch('str:' . $tpl['template_content']); |
| | | send_mail($user['user_name'], $user['email'], $tpl['template_subject'], $content, $tpl['is_html']); |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 返回订单发放的红包 |
| | | * @param int $order_id 订单id |
| | | */ |
| | | function return_order_bonus($order_id) |
| | | { |
| | | /* 取得订单应该发放的红包 */ |
| | | $bonus_list = order_bonus($order_id); |
| | | |
| | | /* 删除 */ |
| | | if ($bonus_list) |
| | | { |
| | | /* 取得订单信息 */ |
| | | $order = order_info($order_id); |
| | | $user_id = $order['user_id']; |
| | | |
| | | foreach ($bonus_list AS $bonus) |
| | | { |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('user_bonus') . |
| | | " WHERE bonus_type_id = '$bonus[type_id]' " . |
| | | "AND user_id = '$user_id' " . |
| | | "AND order_id = '0' LIMIT " . $bonus['number']; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 取得订单应该发放的红包 |
| | | * @param int $order_id 订单id |
| | | * @return array |
| | | */ |
| | | function order_bonus($order_id) |
| | | { |
| | | /* 查询按商品发的红包 */ |
| | | $day = getdate(); |
| | | $today = local_mktime(23, 59, 59, $day['mon'], $day['mday'], $day['year']); |
| | | |
| | | $sql = "SELECT b.type_id, b.type_money, SUM(o.goods_number) AS number " . |
| | | "FROM " . $GLOBALS['ecs']->table('order_goods') . " AS o, " . |
| | | $GLOBALS['ecs']->table('goods') . " AS g, " . |
| | | $GLOBALS['ecs']->table('bonus_type') . " AS b " . |
| | | " WHERE o.order_id = '$order_id' " . |
| | | " AND o.is_gift = 0 " . |
| | | " AND o.goods_id = g.goods_id " . |
| | | " AND g.bonus_type_id = b.type_id " . |
| | | " AND b.send_type = '" . SEND_BY_GOODS . "' " . |
| | | " AND b.send_start_date <= '$today' " . |
| | | " AND b.send_end_date >= '$today' " . |
| | | " GROUP BY b.type_id "; |
| | | $list = $GLOBALS['db']->getAll($sql); |
| | | |
| | | /* 查询定单中非赠品总金额 */ |
| | | $amount = order_amount($order_id, false); |
| | | |
| | | /* 查询订单日期 */ |
| | | $sql = "SELECT add_time " . |
| | | " FROM " . $GLOBALS['ecs']->table('order_info') . |
| | | " WHERE order_id = '$order_id' LIMIT 1"; |
| | | $order_time = $GLOBALS['db']->getOne($sql); |
| | | |
| | | /* 查询按订单发的红包 */ |
| | | $sql = "SELECT type_id, type_money, IFNULL(FLOOR('$amount' / min_amount), 1) AS number " . |
| | | "FROM " . $GLOBALS['ecs']->table('bonus_type') . |
| | | "WHERE send_type = '" . SEND_BY_ORDER . "' " . |
| | | "AND send_start_date <= '$order_time' " . |
| | | "AND send_end_date >= '$order_time' "; |
| | | $list = array_merge($list, $GLOBALS['db']->getAll($sql)); |
| | | |
| | | return $list; |
| | | } |
| | | |
| | | /** |
| | | * 计算购物车中的商品能享受红包支付的总额 |
| | | * @param int $suppid 店铺id |
| | | * @return float 享受红包支付的总额 |
| | | */ |
| | | function compute_discount_amount($suppid=-1) |
| | | { |
| | | /* 查询优惠活动 */ |
| | | $now = gmtime(); |
| | | $user_rank = ',' . $_SESSION['user_rank'] . ','; |
| | | $where_suppid = ''; |
| | | if($suppid>-1){ |
| | | $where_suppid = " AND supplier_id=".$suppid; |
| | | } |
| | | $sql = "SELECT *" . |
| | | "FROM " . $GLOBALS['ecs']->table('favourable_activity') . |
| | | " WHERE start_time <= '$now'" . |
| | | " AND end_time >= '$now'" .$where_suppid. |
| | | " AND CONCAT(',', user_rank, ',') LIKE '%" . $user_rank . "%'" . |
| | | " AND act_type " . db_create_in(array(FAT_DISCOUNT, FAT_PRICE)); |
| | | $favourable_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$favourable_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 查询购物车商品 */ |
| | | $sql_where = $_SESSION['user_id']>0 ? "c.user_id='". $_SESSION['user_id'] ."' " : "c.session_id = '" . SESS_ID . "' AND c.user_id=0 "; |
| | | if($suppid>-1){ |
| | | $where_suppid = " AND g.supplier_id=".$suppid." "; |
| | | } |
| | | $sql = "SELECT c.goods_id, c.goods_price * c.goods_number AS subtotal, g.cat_id, g.brand_id, g.supplier_id " . |
| | | "FROM " . $GLOBALS['ecs']->table('cart') . " AS c, " . $GLOBALS['ecs']->table('goods') . " AS g " . |
| | | "WHERE c.goods_id = g.goods_id " . |
| | | "AND $sql_where " .$where_suppid. |
| | | "AND c.parent_id = 0 " . |
| | | "AND c.is_gift = 0 " . |
| | | "AND rec_type = '" . CART_GENERAL_GOODS . "'"; |
| | | $goods_list = $GLOBALS['db']->getAll($sql); |
| | | if (!$goods_list) |
| | | { |
| | | return 0; |
| | | } |
| | | |
| | | /* 初始化折扣 */ |
| | | $discount = 0; |
| | | $favourable_name = array(); |
| | | |
| | | /* 循环计算每个优惠活动的折扣 */ |
| | | foreach ($favourable_list as $favourable) |
| | | { |
| | | $total_amount = 0; |
| | | if ($favourable['act_range'] == FAR_ALL) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if($favourable['supplier_id'] == $goods['supplier_id']){ |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_CATEGORY) |
| | | { |
| | | /* 找出分类id的子分类id */ |
| | | $id_list = array(); |
| | | $raw_id_list = explode(',', $favourable['act_range_ext']); |
| | | foreach ($raw_id_list as $id) |
| | | { |
| | | $id_list = array_merge($id_list, array_keys(cat_list($id, 0, false))); |
| | | } |
| | | $ids = join(',', array_unique($id_list)); |
| | | |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $ids . ',', ',' . $goods['cat_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_BRAND) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['brand_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | elseif ($favourable['act_range'] == FAR_GOODS) |
| | | { |
| | | foreach ($goods_list as $goods) |
| | | { |
| | | if (strpos(',' . $favourable['act_range_ext'] . ',', ',' . $goods['goods_id'] . ',') !== false && $favourable['supplier_id'] == $goods['supplier_id']) |
| | | { |
| | | $total_amount += $goods['subtotal']; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | continue; |
| | | } |
| | | if ($total_amount > 0 && $total_amount >= $favourable['min_amount'] && ($total_amount <= $favourable['max_amount'] || $favourable['max_amount'] == 0)) |
| | | { |
| | | if ($favourable['act_type'] == FAT_DISCOUNT) |
| | | { |
| | | $discount += $total_amount * (1 - $favourable['act_type_ext'] / 100); |
| | | } |
| | | elseif ($favourable['act_type'] == FAT_PRICE) |
| | | { |
| | | $discount += $favourable['act_type_ext']; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | return $discount; |
| | | } |
| | | |
| | | /** |
| | | * 添加礼包到购物车 |
| | | * |
| | | * @access public |
| | | * @param integer $package_id 礼包编号 |
| | | * @param integer $num 礼包数量 |
| | | * @return boolean |
| | | */ |
| | | /* 代码修改_start By 提示:增加了两个参数 */ |
| | | function add_package_to_cart($package_id, $num = 1, $package_attr_id='', $package_prices='') |
| | | { |
| | | $GLOBALS['err']->clean(); |
| | | |
| | | //增加 By |
| | | if($package_prices) |
| | | { |
| | | $package_pricea=explode("-", $package_prices); |
| | | } |
| | | |
| | | /* 取得礼包信息 */ |
| | | $package = get_package_info($package_id); |
| | | |
| | | if (empty($package)) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['goods_not_exists'], ERR_NOT_EXISTS); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 是否正在销售 */ |
| | | if ($package['is_on_sale'] == 0) |
| | | { |
| | | $GLOBALS['err']->add($GLOBALS['_LANG']['not_on_sale'], ERR_NOT_ON_SALE); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 现有库存是否还能凑齐一个礼包 */ |
| | | if ($GLOBALS['_CFG']['use_storage'] == '1' && judge_package_stock($package_id)) |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], 1), ERR_OUT_OF_STOCK); |
| | | |
| | | return false; |
| | | } |
| | | |
| | | /* 检查库存 */ |
| | | // if ($GLOBALS['_CFG']['use_storage'] == 1 && $num > $package['goods_number']) |
| | | // { |
| | | // $num = $goods['goods_number']; |
| | | // $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $num), ERR_OUT_OF_STOCK); |
| | | // |
| | | // return false; |
| | | // } |
| | | |
| | | /* 初始化要插入购物车的基本件数据 */ |
| | | $parent = array( |
| | | 'user_id' => $_SESSION['user_id'], |
| | | 'session_id' => SESS_ID, |
| | | 'goods_id' => $package_id, |
| | | 'goods_sn' => '', |
| | | 'goods_name' => addslashes($package['package_name']), |
| | | 'market_price' => $package_pricea[0] ? $package_pricea[0] : $package['market_package'], //修改 by |
| | | 'goods_price' => $package_pricea[1] ? $package_pricea[1] : $package['package_price'], //修改 by |
| | | 'package_attr_id' =>$package_attr_id, //增加 by |
| | | 'goods_number' => $num, |
| | | 'goods_attr' => '', |
| | | 'goods_attr_id' => '', |
| | | 'is_real' => $package['is_real'], |
| | | 'extension_code'=> 'package_buy', |
| | | 'is_gift' => 0, |
| | | 'rec_type' => CART_GENERAL_GOODS |
| | | ); |
| | | |
| | | /* 如果数量不为0,作为基本件插入 */ |
| | | if ($num > 0) |
| | | { |
| | | /* 检查该商品是否已经存在在购物车中 */ |
| | | $sql = "SELECT goods_number FROM " .$GLOBALS['ecs']->table('cart'). |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '" . $package_id . "' ". |
| | | " AND parent_id = 0 AND extension_code = 'package_buy' " . |
| | | " AND package_attr_id = '$package_attr_id' AND rec_type = '" . CART_GENERAL_GOODS . "'"; //修改 by 增加一条件 |
| | | |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | if($row) //如果购物车已经有此物品,则更新 |
| | | { |
| | | $num += $row['goods_number']; |
| | | if ($GLOBALS['_CFG']['use_storage'] == 0 || $num > 0) |
| | | { |
| | | $sql = "UPDATE " . $GLOBALS['ecs']->table('cart') . " SET goods_number = '" . $num . "'" . |
| | | " WHERE session_id = '" .SESS_ID. "' AND goods_id = '$package_id' ". |
| | | " AND parent_id = 0 AND extension_code = 'package_buy' " . |
| | | " AND package_attr_id = '$package_attr_id' AND rec_type = '" . CART_GENERAL_GOODS . "'"; //修改 by 增加一条件 |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $GLOBALS['err']->add(sprintf($GLOBALS['_LANG']['shortage'], $num), ERR_OUT_OF_STOCK); |
| | | return false; |
| | | } |
| | | } |
| | | else //购物车没有此物品,则插入 |
| | | { |
| | | $GLOBALS['db']->autoExecute($GLOBALS['ecs']->table('cart'), $parent, 'INSERT'); |
| | | } |
| | | } |
| | | |
| | | /* 把赠品删除 */ |
| | | $sql = "DELETE FROM " . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift <> 0"; |
| | | $GLOBALS['db']->query($sql); |
| | | |
| | | return true; |
| | | } |
| | | /* 代码修改_end By */ |
| | | /** |
| | | * 得到新发货单号 |
| | | * @return string |
| | | */ |
| | | function get_delivery_sn() |
| | | { |
| | | /* 选择一个随机的方案 */ |
| | | mt_srand((double) microtime() * 1000000); |
| | | |
| | | return date('YmdHi') . str_pad(mt_rand(1, 99999), 5, '0', STR_PAD_LEFT); |
| | | } |
| | | |
| | | /** |
| | | * 检查礼包内商品的库存 |
| | | * @return boolen |
| | | */ |
| | | function judge_package_stock($package_id, $package_num = 1) |
| | | { |
| | | $sql = "SELECT goods_id, product_id, goods_number |
| | | FROM " . $GLOBALS['ecs']->table('package_goods') . " |
| | | WHERE package_id = '" . $package_id . "'"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | if (empty($row)) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | /* 分离货品与商品 */ |
| | | $goods = array('product_ids' => '', 'goods_ids' => ''); |
| | | foreach ($row as $value) |
| | | { |
| | | if ($value['product_id'] > 0) |
| | | { |
| | | $goods['product_ids'] .= ',' . $value['product_id']; |
| | | continue; |
| | | } |
| | | |
| | | $goods['goods_ids'] .= ',' . $value['goods_id']; |
| | | } |
| | | |
| | | /* 检查货品库存 */ |
| | | if ($goods['product_ids'] != '') |
| | | { |
| | | $sql = "SELECT p.product_id |
| | | FROM " . $GLOBALS['ecs']->table('products') . " AS p, " . $GLOBALS['ecs']->table('package_goods') . " AS pg |
| | | WHERE pg.product_id = p.product_id |
| | | AND pg.package_id = '$package_id' |
| | | AND pg.goods_number * $package_num > p.product_number |
| | | AND p.product_id IN (" . trim($goods['product_ids'], ',') . ")"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if (!empty($row)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /* 检查商品库存 */ |
| | | if ($goods['goods_ids'] != '') |
| | | { |
| | | $sql = "SELECT g.goods_id |
| | | FROM " . $GLOBALS['ecs']->table('goods') . "AS g, " . $GLOBALS['ecs']->table('package_goods') . " AS pg |
| | | WHERE pg.goods_id = g.goods_id |
| | | AND pg.goods_number * $package_num > g.goods_number |
| | | AND pg.package_id = '" . $package_id . "' |
| | | AND pg.goods_id IN (" . trim($goods['goods_ids'], ',') . ")"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if (!empty($row)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /* 代码增加_start By */ |
| | | |
| | | /* 代码增加_start By */ |
| | | function cart_weight_price2($type = CART_GENERAL_GOODS, $supplier_id) |
| | | { |
| | | $package_row['weight'] = 0; |
| | | $package_row['amount'] = 0; |
| | | $package_row['number'] = 0; |
| | | |
| | | $packages_row['free_shipping'] = 1; |
| | | |
| | | /* 计算超值礼包内商品的相关配送参数 */ |
| | | $sql = 'SELECT goods_id, goods_number, goods_price FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE extension_code = 'package_buy' AND session_id = '" . SESS_ID . "'"; |
| | | $row = $GLOBALS['db']->getAll($sql); |
| | | |
| | | if ($row) |
| | | { |
| | | $packages_row['free_shipping'] = 0; |
| | | $free_shipping_count = 0; |
| | | |
| | | foreach ($row as $val) |
| | | { |
| | | // 如果商品全为免运费商品,设置一个标识变量 |
| | | $sql = 'SELECT count(*) FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.supplier_id='". $supplier_id ."' and g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | $shipping_count = $GLOBALS['db']->getOne($sql); |
| | | |
| | | if ($shipping_count > 0) |
| | | { |
| | | // 循环计算每个超值礼包商品的重量和数量,注意一个礼包中可能包换若干个同一商品 |
| | | $sql = 'SELECT SUM(g.goods_weight * pg.goods_number) AS weight, ' . |
| | | 'SUM(pg.goods_number) AS number FROM ' . |
| | | $GLOBALS['ecs']->table('package_goods') . ' AS pg, ' . |
| | | $GLOBALS['ecs']->table('goods') . ' AS g ' . |
| | | "WHERE g.supplier_id='". $supplier_id ."' and g.goods_id = pg.goods_id AND g.is_shipping = 0 AND pg.package_id = '" . $val['goods_id'] . "'"; |
| | | |
| | | $goods_row = $GLOBALS['db']->getRow($sql); |
| | | $package_row['weight'] += floatval($goods_row['weight']) * $val['goods_number']; |
| | | $package_row['amount'] += floatval($val['goods_price']) * $val['goods_number']; |
| | | $package_row['number'] += intval($goods_row['number']) * $val['goods_number']; |
| | | } |
| | | else |
| | | { |
| | | $free_shipping_count++; |
| | | } |
| | | } |
| | | |
| | | $packages_row['free_shipping'] = $free_shipping_count == count($row) ? 1 : 0; |
| | | } |
| | | |
| | | /* 获得购物车中非超值礼包商品的总重量 */ |
| | | $sql = 'SELECT SUM(g.goods_weight * c.goods_number) AS weight, ' . |
| | | 'SUM(c.goods_price * c.goods_number) AS amount, ' . |
| | | 'SUM(c.goods_number) AS number '. |
| | | 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c '. |
| | | 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = c.goods_id '. |
| | | "WHERE g.supplier_id='". $supplier_id ."' and c.session_id = '" . SESS_ID . "' " . |
| | | "AND rec_type = '$type' AND g.is_shipping = 0 AND c.extension_code != 'package_buy'"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | |
| | | $packages_row['weight'] = floatval($row['weight']) + $package_row['weight']; |
| | | $packages_row['amount'] = floatval($row['amount']) + $package_row['amount']; |
| | | $packages_row['number'] = intval($row['number']) + $package_row['number']; |
| | | /* 格式化重量 */ |
| | | $packages_row['formated_weight'] = formated_weight($packages_row['weight']); |
| | | |
| | | return $packages_row; |
| | | } |
| | | /* |
| | | * 获取订单对应的佣金记录id(只有店铺才计算) |
| | | * @param int $suppid 店铺id |
| | | */ |
| | | function get_order_rebate($suppid){ |
| | | $spkey = intval($suppid); |
| | | if($spkey<=0){ |
| | | return 0; |
| | | } |
| | | $sql = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $nowtime = gmtime(); |
| | | if ( $nowtime >= $row['rebate_paytime_start'] && $nowtime <= $row['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row['rebate_id']; |
| | | } |
| | | else |
| | | { |
| | | $kkk='yes'; |
| | | while($kkk=='yes') |
| | | { |
| | | insert_id_rebate($spkey); |
| | | $sql2 = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row2 = $GLOBALS['db']->getRow($sql2); |
| | | if ( $nowtime >= $row2['rebate_paytime_start'] && $nowtime <= $row2['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row2['rebate_id']; |
| | | $kkk='no'; |
| | | } |
| | | } |
| | | } |
| | | return $rebate_id; |
| | | } |
| | | |
| | | function split_order($new_order_id) |
| | | { |
| | | $sql = "select IF(g.supplier_id, g.supplier_id,0) AS supplier_id, og.rec_id, og.goods_number, og.goods_price from ". $GLOBALS['ecs']->table("order_goods") . |
| | | " AS og left join ". $GLOBALS['ecs']->table("goods") ." AS g on og.goods_id=g.goods_id ". |
| | | " where og.order_id = '$new_order_id' "; |
| | | $res = $GLOBALS['db']->query($sql); |
| | | $split_orders = array(); |
| | | $all_amount = 0; |
| | | while ($row=$GLOBALS['db']->fetchRow($res)) |
| | | { |
| | | $split_orders[$row['supplier_id']]['goods_amount'] += $row['goods_number'] * $row['goods_price']; |
| | | $split_orders[$row['supplier_id']]['goods_reclist'][] = $row['rec_id']; |
| | | $split_orders[$row['supplier_id']]['order_sn'] = $split_orders[$row['supplier_id']]['order_sn'] ? $split_orders[$row['supplier_id']]['order_sn'] : get_order_sn(); |
| | | $split_orders[$row['supplier_id']]['shipping_fee'] = $GLOBALS['total']['supplier_shipping'][$row['supplier_id']]['shipping_fee']; |
| | | $split_orders[$row['supplier_id']]['order_amount'] = $split_orders[$row['supplier_id']]['goods_amount'] + $split_orders[$row['supplier_id']]['shipping_fee']; |
| | | $split_orders[$row['supplier_id']]['order_amount_formated'] = price_format($split_orders[$row['supplier_id']]['order_amount']); |
| | | $all_amount += $split_orders[$row['supplier_id']]['order_amount']; |
| | | } |
| | | |
| | | //下单来源 |
| | | $order_from = WEB_FROM; |
| | | |
| | | $count_split_orders =count($split_orders); |
| | | |
| | | foreach ($split_orders AS $spkey => $split) |
| | | { |
| | | //获的返佣ID |
| | | if($spkey>0) |
| | | { |
| | | $sql = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | $nowtime = gmtime(); |
| | | if ( $nowtime >= $row['rebate_paytime_start'] && $nowtime <= $row['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row['rebate_id']; |
| | | } |
| | | else |
| | | { |
| | | $kkk='yes'; |
| | | while($kkk=='yes') |
| | | { |
| | | insert_id_rebate($spkey); |
| | | $sql2 = "select rebate_id, rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id='$spkey' and is_pay_ok=0 order by rebate_id desc limit 0,1"; |
| | | $row2 = $GLOBALS['db']->getRow($sql2); |
| | | if ( $nowtime >= $row2['rebate_paytime_start'] && $nowtime <= $row2['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_id= $row2['rebate_id']; |
| | | $kkk='no'; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | $rebate_id=0; |
| | | } |
| | | |
| | | $order_sn = $split['order_sn']; |
| | | if ($count_split_orders ==1) |
| | | { |
| | | $sql = "update ". $GLOBALS['ecs']->table('order_info') . |
| | | " set order_sn='$order_sn', supplier_id='$spkey', parent_order_id='0', rebate_id='$rebate_id', froms='$order_from' where order_id='$new_order_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | else |
| | | { |
| | | $sql = "insert into ".$GLOBALS['ecs']->table('order_info') . "( ". |
| | | " order_sn, user_id, order_status, shipping_status, pay_status, consignee, country, province, city, district, address, zipcode, tel, mobile , email, best_time ,sign_building, postscript, shipping_id, shipping_name, pay_id, pay_name, how_oos, how_surplus, pack_name, card_name, card_message, inv_payee, inv_content, goods_amount, shipping_fee, insure_fee, pay_fee, pack_fee, card_fee, money_paid, surplus, integral, integral_money, bonus, order_amount, from_ad, referer, add_time, confirm_time, pay_time, shipping_time, pack_id, card_id, bonus_id, invoice_no, extension_code, extension_id, to_buyer, pay_note, agency_id, inv_type, tax, is_separate, parent_id, discount, supplier_id, parent_order_id, rebate_id, froms, pickup_point, is_pickup) ". |
| | | "select '$order_sn', user_id, order_status, shipping_status, pay_status, consignee, country, province, city, district, address, zipcode, tel, mobile , email, best_time ,sign_building, postscript, shipping_id, shipping_name, pay_id, pay_name, how_oos, how_surplus, pack_name, card_name, card_message, inv_payee, inv_content , '". $split['goods_amount']. "', '" . $split['shipping_fee'] ."', insure_fee, pay_fee, pack_fee, card_fee, money_paid, surplus, integral, integral_money, bonus, '". $split['order_amount'] ."', from_ad, referer, add_time, confirm_time, pay_time, shipping_time, pack_id, card_id, bonus_id, invoice_no, extension_code, extension_id, to_buyer, pay_note, agency_id, inv_type, tax, is_separate, parent_id, discount, '$spkey', '$new_order_id', '$rebate_id', '$order_from', pickup_point, is_pickup from ".$GLOBALS['ecs']->table('order_info')." where order_id= '$new_order_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | $order_id_new = $GLOBALS['db']->insert_id(); |
| | | foreach ($split['goods_reclist'] AS $rec) |
| | | { |
| | | $sql= "update ". $GLOBALS['ecs']->table('order_goods') ." set order_id='$order_id_new' where rec_id='$rec' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | if ($count_split_orders>1) |
| | | { |
| | | $sql="delete from ".$GLOBALS['ecs']->table('order_info')." where order_id='$new_order_id' "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | $arr=array(); |
| | | $arr['suborder_list'] = $split_orders; |
| | | $arr['all_amount'] = $all_amount; |
| | | $arr['sub_order_count'] = $count_split_orders; |
| | | return $arr; |
| | | } |
| | | |
| | | function insert_id_rebate($supplier_id) |
| | | { |
| | | $sql="select supplier_rebate_paytime from ". $GLOBALS['ecs']->table('supplier') ." where supplier_id='$supplier_id'"; |
| | | $supplier_rebate_paytime = $GLOBALS['db']->getOne($sql); |
| | | |
| | | $sql = "select rebate_paytime_start, rebate_paytime_end from ". $GLOBALS['ecs']->table('supplier_rebate') ." where supplier_id= '$supplier_id' and is_pay_ok=0 order by rebate_id DESC LIMIT 0,1"; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | if (!$row['rebate_paytime_start']) |
| | | { |
| | | $rebate_paytime_start = local_mktime(0,0,0,local_date('m'), local_date('d'), local_date('Y')); |
| | | } |
| | | if (!$row['rebate_paytime_end']) |
| | | { |
| | | switch($supplier_rebate_paytime) |
| | | { |
| | | case '1': |
| | | $rebate_paytime_end= local_strtotime("this Sunday") + 24*60*60-1; |
| | | break; |
| | | case '2': |
| | | $rebate_paytime_end= local_mktime(23,59,59,local_date("m"),local_date("t"),local_date("Y")); |
| | | break; |
| | | case '3': |
| | | if (local_date("m")=='1' || local_date("m")=='2' || local_date("m")=='3') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59,3,31,local_date("Y")); |
| | | } |
| | | elseif (local_date("m")=='4' || local_date("m")=='5' || local_date("m")=='6') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 6,30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='7' || local_date("m")=='8' || local_date("m")=='9') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 9, 30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='10' || local_date("m")=='11' || local_date("m")=='12') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 12,31,local_date("Y")); |
| | | } |
| | | break; |
| | | case '4': |
| | | $rebate_paytime_end= local_mktime(23,59,59,12,31,local_date("Y")); |
| | | break; |
| | | } |
| | | } |
| | | if ( $row['rebate_paytime_start'] && $row['rebate_paytime_end'] ) |
| | | { |
| | | $rebate_paytime_start = $row['rebate_paytime_end'] + 1; |
| | | switch($supplier_rebate_paytime) |
| | | { |
| | | case '1': |
| | | $rebate_paytime_end= $row['rebate_paytime_end'] + 24*60*60*7; |
| | | break; |
| | | case '2': |
| | | $rebate_paytime_end= local_mktime(23,59,59,local_date("m",$rebate_paytime_start),local_date("t",$rebate_paytime_start),local_date("Y",$rebate_paytime_start)); |
| | | break; |
| | | case '3': |
| | | if (local_date("m",$rebate_paytime_start)=='1' || local_date("m")=='2' || local_date("m")=='3') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59,3,31,local_date("Y")); |
| | | } |
| | | elseif (local_date("m")=='4' || local_date("m")=='5' || local_date("m")=='6') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 6,30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='7' || local_date("m")=='8' || local_date("m")=='9') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 9, 30,local_date("Y")); |
| | | } |
| | | elseif(local_date("m")=='10' || local_date("m")=='11' || local_date("m")=='12') |
| | | { |
| | | $rebate_paytime_end= local_mktime(23,59,59, 12,31,local_date("Y")); |
| | | } |
| | | break; |
| | | case '4': |
| | | $rebate_paytime_end= local_mktime(23,59,59,12,31,local_date("Y")); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | $sql="insert into ". $GLOBALS['ecs']->table('supplier_rebate') ."(rebate_paytime_start, rebate_paytime_end, supplier_id) value('$rebate_paytime_start', '$rebate_paytime_end', '$supplier_id') "; |
| | | $GLOBALS['db']->query($sql); |
| | | } |
| | | |
| | | function is_cansel($goods_id, $product_id, $package_buy) |
| | | { |
| | | if($package_buy=='package_buy') |
| | | { |
| | | return '1'; |
| | | } |
| | | $sql = "select is_on_sale, goods_number from ". $GLOBALS['ecs']->table('goods') ." where goods_id='$goods_id' "; |
| | | $row = $GLOBALS['db']->getRow($sql); |
| | | if (!$row['is_on_sale']) |
| | | { |
| | | return '0'; |
| | | } |
| | | else |
| | | { |
| | | if ($product_id>0) |
| | | { |
| | | $sql2 = "select product_number from ". $GLOBALS['ecs']->table('products') ." where product_id='$product_id' "; |
| | | $row2 = $GLOBALS['db']->getRow($sql2); |
| | | if (!$row2['product_number']) |
| | | { |
| | | return '0'; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!$row['goods_number']) |
| | | { |
| | | return '0'; |
| | | } |
| | | } |
| | | } |
| | | return '1'; |
| | | } |
| | | |
| | | function getWeek($unixTime='') |
| | | { |
| | | $unixTime=is_numeric($unixTime) ? $unixTime : time(); |
| | | $weekarray=array('日','一','二','三','四','五','六'); |
| | | return '周'.$weekarray[date('w',$unixTime)]; |
| | | } |
| | | |
| | | function get_region_info($region_id) |
| | | { |
| | | $sql = 'SELECT region_name FROM ' . $GLOBALS['ecs']->table('region') . |
| | | " WHERE region_id = '$region_id' "; |
| | | |
| | | return $GLOBALS['db']->getOne($sql); |
| | | } |
| | | /* 代码增加_end By */ |
| | | ?> |
json/includes/lib_template.php
json/includes/safety_mysql.php
json/includes/website/cls_http.php
json/includes/website/config/qq_config.php
json/includes/website/config/weixin_config.php
json/includes/website/jntoo.php
json/includes/website/oath2.class.php
json/includes/website/qq.php
json/includes/website/weixin.php
json/init(bf).php
json/insertComment.php
json/insertOrderInfo.php
json/insert_account.php
json/login.php
json/myCollect.php
json/myComment.php
json/orderAddressUpdata.php
json/orderDetail.php
json/orderList.php
json/out.php
json/payorder.php
json/qq_oath_login_error2
json/quehuo.php
json/reg.php
json/reg.php---
json/reg.php--0708
json/reg_fields.php
json/search.php
json/send.php
json/sql.php
json/store.php
json/storebf.php
json/stores.php
json/supplier.php
json/supplier_category.php
json/supplier_index.php
json/supplier_search.php
json/topic.php
json/tpl/activity_app.lbi
json/tpl/app/address_checkout_app.lbi
json/tpl/app/list_checkout_app.lbi
json/tpl/app/order_supplier_shipping_app.lbi
json/tpl/app/order_total_app.lbi
json/tpl/checkout_app.lbi
json/tpl/favourable_app.lbi
json/tpl/goodlist_app.lbi
json/tpl/lunbo.lbi
json/tpl/order_app.lib
json/tpl/orderlist_app.lib
json/tpl/payorderlist_app.lbi
json/tpl/quehuolist_app.lbi
json/tpl/supplier/app/recommend_best.lbi
json/tpl/supplier/lunbo.lbi
json/tpl/supplier/supplier_category_app.lbi
json/tpl/supplier/supplier_index_app.lbi
json/tpl/supplier/supplier_search_app.lbi
json/updatePassWord.php
json/user.php
json/user.php---
json/userInfo.php
json/user_account.php
json/user_order_num.php
json/user_rank.php
json/user_stores.php
json/volume_price.php
languages/zh_cn/admin/account_log.php
languages/zh_cn/admin/admin_logs.php
languages/zh_cn/admin/ads.php
languages/zh_cn/admin/affiliate.php
languages/zh_cn/admin/affiliate_ck.php
languages/zh_cn/admin/agency.php
languages/zh_cn/admin/area_manage.php
languages/zh_cn/admin/article.php
languages/zh_cn/admin/article_auto.php
languages/zh_cn/admin/articlecat.php
languages/zh_cn/admin/attention_list.php
languages/zh_cn/admin/attribute.php
languages/zh_cn/admin/auction.php
languages/zh_cn/admin/back.php
languages/zh_cn/admin/bonus.php
languages/zh_cn/admin/brand.php
languages/zh_cn/admin/captcha_manage.php
languages/zh_cn/admin/card.php
languages/zh_cn/admin/category.php
languages/zh_cn/admin/chat_settings.php
languages/zh_cn/admin/check_file_priv.php
languages/zh_cn/admin/cloud.php
languages/zh_cn/admin/comment_manage.php
languages/zh_cn/admin/common.php
languages/zh_cn/admin/convert.php
languages/zh_cn/admin/cron.php
languages/zh_cn/admin/customer.php
languages/zh_cn/admin/database.php
languages/zh_cn/admin/distrib_goods.php
languages/zh_cn/admin/distrib_order.php
languages/zh_cn/admin/distributor.php
languages/zh_cn/admin/ebao_commend.php
languages/zh_cn/admin/edit_languages.php
languages/zh_cn/admin/email_list.php
languages/zh_cn/admin/exchange_goods.php
languages/zh_cn/admin/favourable.php
languages/zh_cn/admin/fckfile_manage.php
languages/zh_cn/admin/filecheck.php
languages/zh_cn/admin/flashplay.php
languages/zh_cn/admin/flow_stats.php
languages/zh_cn/admin/friend_link.php
languages/zh_cn/admin/gen_goods_script.php
languages/zh_cn/admin/get_password.php
languages/zh_cn/admin/goods.php
languages/zh_cn/admin/goods_auto.php
languages/zh_cn/admin/goods_batch.php
languages/zh_cn/admin/goods_booking.php
languages/zh_cn/admin/goods_export.php
languages/zh_cn/admin/goods_type.php
languages/zh_cn/admin/group_buy.php
languages/zh_cn/admin/index.php
languages/zh_cn/admin/integrate.php
languages/zh_cn/admin/keyword.php
languages/zh_cn/admin/kuaidi_order.php
languages/zh_cn/admin/license.php
languages/zh_cn/admin/log_action.php
languages/zh_cn/admin/magazine_list.php
languages/zh_cn/admin/mail_template.php
languages/zh_cn/admin/message.php
languages/zh_cn/admin/navigator.php
languages/zh_cn/admin/order.php
languages/zh_cn/admin/pack.php
languages/zh_cn/admin/package.php
languages/zh_cn/admin/payment.php
languages/zh_cn/admin/pickup_point.php
languages/zh_cn/admin/picture_batch.php
languages/zh_cn/admin/plugins.php
languages/zh_cn/admin/postman.php
languages/zh_cn/admin/pre_sale.php
languages/zh_cn/admin/pricecut.php
languages/zh_cn/admin/priv_action.php
languages/zh_cn/admin/privilege.php
languages/zh_cn/admin/reg_fields.php
languages/zh_cn/admin/repay.php
languages/zh_cn/admin/role.php
languages/zh_cn/admin/search_log.php
languages/zh_cn/admin/sendmail.php
languages/zh_cn/admin/shipping.php
languages/zh_cn/admin/shipping_area.php
languages/zh_cn/admin/shop_config.php
languages/zh_cn/admin/shophelp.php
languages/zh_cn/admin/shopinfo.php
languages/zh_cn/admin/sitemap.php
languages/zh_cn/admin/sms.php
languages/zh_cn/admin/snatch.php
languages/zh_cn/admin/sql.php
languages/zh_cn/admin/statistic.php
languages/zh_cn/admin/supplier.php
languages/zh_cn/admin/supplier_order.php
languages/zh_cn/admin/supplier_priv_action.php
languages/zh_cn/admin/supplier_tag.php
languages/zh_cn/admin/suppliers.php
languages/zh_cn/admin/suppliers_goods.php
languages/zh_cn/admin/tag_manage.php
languages/zh_cn/admin/takegoods.php
languages/zh_cn/admin/template.php
languages/zh_cn/admin/third_customer.php
languages/zh_cn/admin/topic.php
languages/zh_cn/admin/user_account.php
languages/zh_cn/admin/user_account_manage.php
languages/zh_cn/admin/user_grade.php
languages/zh_cn/admin/user_msg.php
languages/zh_cn/admin/user_rank.php
languages/zh_cn/admin/users.php
languages/zh_cn/admin/users_export.php
languages/zh_cn/admin/valuecard - #U526f#U672c.php
languages/zh_cn/admin/valuecard.php
languages/zh_cn/admin/view_sendlist.php
languages/zh_cn/admin/virtual_card.php
languages/zh_cn/admin/virtual_goods.php
languages/zh_cn/admin/virtual_goods_card.php
languages/zh_cn/admin/vote.php
languages/zh_cn/admin/webcollect.php
languages/zh_cn/admin/website.php
languages/zh_cn/admin/wholesale.php
languages/zh_cn/calendar.php
languages/zh_cn/common.php
languages/zh_cn/convert/shopex46.php
languages/zh_cn/convert/shopex47.php
languages/zh_cn/convert/shopex48.php
languages/zh_cn/cron/auto_manage.php
languages/zh_cn/cron/clear_file_desc.php
languages/zh_cn/cron/ipdel.php
languages/zh_cn/cron/order_del_www_ecshop68_com.php
languages/zh_cn/payment/alipay.php
languages/zh_cn/payment/alipay_bank.php
languages/zh_cn/payment/balance.php
languages/zh_cn/payment/bank.php
languages/zh_cn/payment/chinapay.php
languages/zh_cn/payment/cod.php
languages/zh_cn/payment/kuaiqian.php
languages/zh_cn/payment/post.php
languages/zh_cn/payment/tenpay.php
languages/zh_cn/payment/tenpayc2c.php
languages/zh_cn/payment/udpay.php
languages/zh_cn/payment/unionpay.php
languages/zh_cn/payment/weixin.php
languages/zh_cn/payment/wxnative.php
languages/zh_cn/payment/yeepay.php
languages/zh_cn/payment/yeepayszx.php
languages/zh_cn/shipping/bestex.php
languages/zh_cn/shipping/cac.php
languages/zh_cn/shipping/city_express.php
languages/zh_cn/shipping/deppon.php
languages/zh_cn/shipping/ems.php
languages/zh_cn/shipping/flat.php
languages/zh_cn/shipping/fpd.php
languages/zh_cn/shipping/post_express.php
languages/zh_cn/shipping/post_mail.php
languages/zh_cn/shipping/presswork.php
languages/zh_cn/shipping/pups.php
languages/zh_cn/shipping/qfkd.php
languages/zh_cn/shipping/sf_express.php
languages/zh_cn/shipping/sto_express.php
languages/zh_cn/shipping/tc_express.php
languages/zh_cn/shipping/ttkd.php
languages/zh_cn/shipping/yd_express.php
languages/zh_cn/shipping/yto.php
languages/zh_cn/shipping/zjs.php
languages/zh_cn/shipping/zto.php
languages/zh_cn/shopping_flow.php
languages/zh_cn/user.php
mobile/MP_verify_X4C1Rdz4Dtl2Nw63.txt
mobile/activity.php
mobile/admin/account_log.php
mobile/admin/ad_position.php
mobile/admin/admin_logs.php
mobile/admin/ads.php
mobile/admin/affiliate.php
mobile/admin/affiliate_ck.php
mobile/admin/app_manage.php
mobile/admin/app_push.php
mobile/admin/article.php
mobile/admin/article_auto.php
mobile/admin/articlecat.php
mobile/admin/brand.php
mobile/admin/captcha_manage.php
mobile/admin/category.php
mobile/admin/cloud.php
mobile/admin/deposit_list.php
mobile/admin/distrib_goods.php
mobile/admin/distrib_order.php
mobile/admin/distrib_sort.php
mobile/admin/distributor.php
mobile/admin/ecshopfiles.md5
mobile/admin/edit_languages.php
mobile/admin/flashplay.php
mobile/admin/fonts/FontAwesome.otf
mobile/admin/fonts/fontawesome-webfont.eot
mobile/admin/fonts/fontawesome-webfont.svg
mobile/admin/fonts/fontawesome-webfont.ttf
mobile/admin/fonts/fontawesome-webfont.woff
mobile/admin/fonts/fontawesome-webfont.woff2
mobile/admin/get_password.php
mobile/admin/help.php
mobile/admin/help/zh_cn/ad_position.xml
mobile/admin/help/zh_cn/admin_logs.xml
mobile/admin/help/zh_cn/ads.xml
mobile/admin/help/zh_cn/article.xml
mobile/admin/help/zh_cn/articlecat.xml
mobile/admin/help/zh_cn/attribute.xml
mobile/admin/help/zh_cn/bonus.xml
mobile/admin/help/zh_cn/bonus_type.xml
mobile/admin/help/zh_cn/brand.xml
mobile/admin/help/zh_cn/card.xml
mobile/admin/help/zh_cn/category.xml
mobile/admin/help/zh_cn/comment_manage.xml
mobile/admin/help/zh_cn/database.xml
mobile/admin/help/zh_cn/friend_link.xml
mobile/admin/help/zh_cn/gift.xml
mobile/admin/help/zh_cn/goods.xml
mobile/admin/help/zh_cn/goods_batch.xml
mobile/admin/help/zh_cn/goods_booking.xml
mobile/admin/help/zh_cn/goods_type.xml
mobile/admin/help/zh_cn/group_buy.xml
mobile/admin/help/zh_cn/index.xml
mobile/admin/help/zh_cn/integrate.xml
mobile/admin/help/zh_cn/mail_template.xml
mobile/admin/help/zh_cn/order.xml
mobile/admin/help/zh_cn/pack.xml
mobile/admin/help/zh_cn/payment.xml
mobile/admin/help/zh_cn/plugins.xml
mobile/admin/help/zh_cn/prc.xml
mobile/admin/help/zh_cn/privilege.xml
mobile/admin/help/zh_cn/repay.xml
mobile/admin/help/zh_cn/shipping.xml
mobile/admin/help/zh_cn/shipping_area.xml
mobile/admin/help/zh_cn/shophelp.xml
mobile/admin/help/zh_cn/shopinfo.xml
mobile/admin/help/zh_cn/sms.xml
mobile/admin/help/zh_cn/snatch.xml
mobile/admin/help/zh_cn/tag_manage.xml
mobile/admin/help/zh_cn/template.xml
mobile/admin/help/zh_cn/user_account.xml
mobile/admin/help/zh_cn/user_msg.xml
mobile/admin/help/zh_cn/user_rank.xml
mobile/admin/help/zh_cn/users.xml
mobile/admin/help/zh_cn/vote.xml
mobile/admin/images/allico.png
mobile/admin/images/arrow.gif
mobile/admin/images/arrow_left.gif
mobile/admin/images/arrow_right.gif
mobile/admin/images/bg.jpg
mobile/admin/images/bg2.png
mobile/admin/images/bg_repx.gif
mobile/admin/images/btn_close.gif
mobile/admin/images/btn_drop.gif
mobile/admin/images/btn_maximize.gif
mobile/admin/images/btn_minimize.gif
mobile/admin/images/button1.gif
mobile/admin/images/charts/MSColumn3D.swf
mobile/admin/images/charts/MSLine.swf
mobile/admin/images/charts/ScrollColumn2D.swf
mobile/admin/images/charts/column3d.swf
mobile/admin/images/charts/line.swf
mobile/admin/images/charts/pie3d.swf
mobile/admin/images/confirm.gif
mobile/admin/images/ecshop_logo.png
mobile/admin/images/filecheck.gif
mobile/admin/images/header-profile.png
mobile/admin/images/help_menu-b5.gif
mobile/admin/images/help_menu-plus.gif
mobile/admin/images/icon1.png
mobile/admin/images/icon2.png
mobile/admin/images/icon_account.gif
mobile/admin/images/icon_add.gif
mobile/admin/images/icon_copy.gif
mobile/admin/images/icon_docs.gif
mobile/admin/images/icon_drop.gif
mobile/admin/images/icon_edit.gif
mobile/admin/images/icon_js.gif
mobile/admin/images/icon_output.gif
mobile/admin/images/icon_priv.gif
mobile/admin/images/icon_search.gif
mobile/admin/images/icon_send_bonus.gif
mobile/admin/images/icon_title.gif
mobile/admin/images/icon_trash.gif
mobile/admin/images/icon_view.gif
mobile/admin/images/information.gif
mobile/admin/images/left_line.gif
mobile/admin/images/login.png
mobile/admin/images/login_bg.png
mobile/admin/images/login_dl.jpg
mobile/admin/images/login_dl.png
mobile/admin/images/menu_arrow.gif
mobile/admin/images/menu_bottom.gif
mobile/admin/images/menu_minus.gif
mobile/admin/images/menu_plus.gif
mobile/admin/images/no.gif
mobile/admin/images/notice.gif
mobile/admin/images/numberico.png
mobile/admin/images/online.swf
mobile/admin/images/online.wav
mobile/admin/images/picflag.gif
mobile/admin/images/profile_small.jpg
mobile/admin/images/show_right.gif
mobile/admin/images/sort_asc.gif
mobile/admin/images/sort_desc.gif
mobile/admin/images/stepnum.gif
mobile/admin/images/thbg.gif
mobile/admin/images/top_bg.gif
mobile/admin/images/top_header.png
mobile/admin/images/top_header_hover.png
mobile/admin/images/warning.gif
mobile/admin/images/yes.gif
mobile/admin/includes/cls_exchange.php
mobile/admin/includes/cls_google_sitemap.php
mobile/admin/includes/cls_phpzip.php
mobile/admin/includes/cls_sql_dump.php
mobile/admin/includes/inc_menu.php
mobile/admin/includes/inc_priv.php
mobile/admin/includes/init.php
mobile/admin/includes/jpush/vendor/autoload.php
mobile/admin/includes/jpush/vendor/composer/ClassLoader.php
mobile/admin/includes/jpush/vendor/composer/autoload_classmap.php
mobile/admin/includes/jpush/vendor/composer/autoload_files.php
mobile/admin/includes/jpush/vendor/composer/autoload_namespaces.php
mobile/admin/includes/jpush/vendor/composer/autoload_psr4.php
mobile/admin/includes/jpush/vendor/composer/autoload_real.php
mobile/admin/includes/jpush/vendor/composer/installed.json
mobile/admin/includes/jpush/vendor/jpush/jpush/.gitignore
mobile/admin/includes/jpush/vendor/jpush/jpush/.travis.yml
mobile/admin/includes/jpush/vendor/jpush/jpush/README.md
mobile/admin/includes/jpush/vendor/jpush/jpush/composer.json
mobile/admin/includes/jpush/vendor/jpush/jpush/doc/api.md
mobile/admin/includes/jpush/vendor/jpush/jpush/examples/DeviceExample.php
mobile/admin/includes/jpush/vendor/jpush/jpush/examples/PushExample.php
mobile/admin/includes/jpush/vendor/jpush/jpush/examples/PushExample2.php
mobile/admin/includes/jpush/vendor/jpush/jpush/examples/README.md
mobile/admin/includes/jpush/vendor/jpush/jpush/examples/ReportExample.php
mobile/admin/includes/jpush/vendor/jpush/jpush/examples/ValidateExample.php
mobile/admin/includes/jpush/vendor/jpush/jpush/examples/composer.json
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Exception/APIConnectionException.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Exception/APIRequestException.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/JPushClient.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/JPushLog.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/Audience.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/DeviceResponse.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/Message.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/MessageAndroid.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/MessageIOS.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/MessageItem.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/MessageResponse.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/Notification.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/Options.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/Platform.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/PushPayload.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/PushResponse.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/Report.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/ReportResponse.php
mobile/admin/includes/jpush/vendor/jpush/jpush/src/JPush/Model/UserResponse.php
mobile/admin/includes/jpush/vendor/jpush/jpush/tests/Bootstrap.php
mobile/admin/includes/jpush/vendor/jpush/jpush/tests/DeviceTest.php
mobile/admin/includes/jpush/vendor/jpush/jpush/tests/PushPayloadTest.php
mobile/admin/includes/jpush/vendor/jpush/jpush/tests/PushTest.php
mobile/admin/includes/jpush/vendor/jpush/jpush/tests/ReportTest.php
mobile/admin/includes/jpush/vendor/jpush/jpush/tests/ValidateTest.php
mobile/admin/includes/jpush/vendor/jpush/jpush/tests/phpunit.xml.dist
mobile/admin/includes/jpush/vendor/monolog/monolog
mobile/admin/includes/jpush/vendor/nategood/httpful
mobile/admin/includes/jpush/vendor/psr/log
mobile/admin/includes/lib_common.php
mobile/admin/includes/lib_goods.php
mobile/admin/includes/lib_main.php
mobile/admin/includes/lib_order.php
mobile/admin/includes/lib_template.php
mobile/admin/index.php
mobile/admin/js/colorselector.js
mobile/admin/js/colorselector_topic.js
mobile/admin/js/common.js
mobile/admin/js/helpmenu.js
mobile/admin/js/jquery.easing.1.3.js
mobile/admin/js/jquery.min.js
mobile/admin/js/listtable.js
mobile/admin/js/md5.js
mobile/admin/js/menu.js
mobile/admin/js/selectbox.js
mobile/admin/js/selectzone.js
mobile/admin/js/tab.js
mobile/admin/js/todolist.js
mobile/admin/js/topbar.js
mobile/admin/js/validator.js
mobile/admin/mail_template.php
mobile/admin/menu.php
mobile/admin/message.php
mobile/admin/navigator.php
mobile/admin/order.php
mobile/admin/patch_num
mobile/admin/payment.php
mobile/admin/pintuan.php
mobile/admin/privilege.php
mobile/admin/shop_config.php
mobile/admin/shophelp.php
mobile/admin/shopinfo.php
mobile/admin/sms_url.php
mobile/admin/sql.php
mobile/admin/styles/bootstrap.min.css
mobile/admin/styles/font-awesome.min.css
mobile/admin/styles/general.css
mobile/admin/styles/main.css
mobile/admin/tag_manage.php
mobile/admin/template.php
mobile/admin/templates/about_us.htm
mobile/admin/templates/account_info.htm
mobile/admin/templates/account_list.htm
mobile/admin/templates/ad_position_info.htm
mobile/admin/templates/ad_position_list.htm
mobile/admin/templates/admin_logs.htm
mobile/admin/templates/ads_info.htm
mobile/admin/templates/ads_js.htm
mobile/admin/templates/ads_list.htm
mobile/admin/templates/affiliate.htm
mobile/admin/templates/affiliate_ck_list.htm
mobile/admin/templates/affiliate_list.htm
mobile/admin/templates/app_add_template.htm
mobile/admin/templates/app_basic_setting.htm
mobile/admin/templates/app_guide_picture.htm
mobile/admin/templates/app_menu_info.htm
mobile/admin/templates/app_menu_list.htm
mobile/admin/templates/app_push_message.htm
mobile/admin/templates/app_push_setting.htm
mobile/admin/templates/app_template_setting.htm
mobile/admin/templates/article_info.htm
mobile/admin/templates/article_list.htm
mobile/admin/templates/articlecat_info.htm
mobile/admin/templates/articlecat_list.htm
mobile/admin/templates/brand_info.htm
mobile/admin/templates/brand_list.htm
mobile/admin/templates/brand_search.htm
mobile/admin/templates/captcha_manage.htm
mobile/admin/templates/category_info.htm
mobile/admin/templates/category_list.htm
mobile/admin/templates/category_move.htm
mobile/admin/templates/deposit_info.htm
mobile/admin/templates/deposit_list.htm
mobile/admin/templates/distrib_batch_info.htm
mobile/admin/templates/distrib_goods_info.htm
mobile/admin/templates/distrib_goods_list.htm
mobile/admin/templates/distrib_order.htm
mobile/admin/templates/distrib_sort_list.htm
mobile/admin/templates/distributor_info.htm
mobile/admin/templates/distributor_list.htm
mobile/admin/templates/dodolink_list.htm
mobile/admin/templates/drag.htm
mobile/admin/templates/flashplay_add.htm
mobile/admin/templates/flashplay_ccustom_edit.htm
mobile/admin/templates/flashplay_custom.htm
mobile/admin/templates/flashplay_custom_add.htm
mobile/admin/templates/flashplay_list.htm
mobile/admin/templates/flashplay_tab.htm
mobile/admin/templates/flow_stats.htm
mobile/admin/templates/get_pwd.htm
mobile/admin/templates/index.htm
mobile/admin/templates/language_list.htm
mobile/admin/templates/login.htm
mobile/admin/templates/mail_template.htm
mobile/admin/templates/menu.htm
mobile/admin/templates/menu_info.htm
mobile/admin/templates/menu_list.htm
mobile/admin/templates/merge_order.htm
mobile/admin/templates/message.htm
mobile/admin/templates/message_info.htm
mobile/admin/templates/message_list.htm
mobile/admin/templates/message_view.htm
mobile/admin/templates/navigator.htm
mobile/admin/templates/navigator_add.htm
mobile/admin/templates/order_goods_info.htm
mobile/admin/templates/order_info.htm
mobile/admin/templates/order_info9-9.htm
mobile/admin/templates/page.htm
mobile/admin/templates/pagefooter.htm
mobile/admin/templates/pageheader.htm
mobile/admin/templates/payment_edit.htm
mobile/admin/templates/payment_list.htm
mobile/admin/templates/pintuan_detail_view.htm
mobile/admin/templates/pintuan_info.htm
mobile/admin/templates/pintuan_info.htm.bak
mobile/admin/templates/pintuan_list.htm
mobile/admin/templates/pintuan_list.htm.bak
mobile/admin/templates/pintuan_view.htm
mobile/admin/templates/privilege_allot.htm
mobile/admin/templates/privilege_info.htm
mobile/admin/templates/privilege_list.htm
mobile/admin/templates/shop_config.htm
mobile/admin/templates/shop_config_form.htm
mobile/admin/templates/shop_config_mail_settings.htm
mobile/admin/templates/shophelp_article_list.htm
mobile/admin/templates/shophelp_cat_list.htm
mobile/admin/templates/shophelp_info.htm
mobile/admin/templates/shopinfo_info.htm
mobile/admin/templates/shopinfo_list.htm
mobile/admin/templates/sql.htm
mobile/admin/templates/sql_dump_msg.htm
mobile/admin/templates/start.htm
mobile/admin/templates/tag_edit.htm
mobile/admin/templates/tag_manage.htm
mobile/admin/templates/template_library.htm
mobile/admin/templates/template_setup.htm
mobile/admin/templates/templates_backup.htm
mobile/admin/templates/templates_list.htm
mobile/admin/templates/top.htm
mobile/admin/templates/user_grade_list.htm
mobile/admin/templates/website.htm
mobile/admin/templates/website_install.htm
mobile/admin/templates/website_view.htm
mobile/admin/templates/weixin/act_add.html
mobile/admin/templates/weixin/act_list.html
mobile/admin/templates/weixin/act_listall.html
mobile/admin/templates/weixin/act_log.html
mobile/admin/templates/weixin/act_show.html
mobile/admin/templates/weixin/auto_do.html
mobile/admin/templates/weixin/menu.htm
mobile/admin/templates/weixin/news.html
mobile/admin/templates/weixin/oauth_add.html
mobile/admin/templates/weixin/oauth_list.html
mobile/admin/templates/weixin/qiandao_add.html
mobile/admin/templates/weixin/wx_addconfig.html
mobile/admin/templates/weixin/wx_addkey.html
mobile/admin/templates/weixin/wx_addmenu.html
mobile/admin/templates/weixin/wx_addmsg.html
mobile/admin/templates/weixin/wx_addqcode.html
mobile/admin/templates/weixin/wx_config.html
mobile/admin/templates/weixin/wx_fans.html
mobile/admin/templates/weixin/wx_fansmsg.html
mobile/admin/templates/weixin/wx_keywords.html
mobile/admin/templates/weixin/wx_keywords2.html
mobile/admin/templates/weixin/wx_keywordsedit.html
mobile/admin/templates/weixin/wx_menu.html
mobile/admin/templates/weixin/wx_newslist.html
mobile/admin/templates/weixin/wx_newsview.html
mobile/admin/templates/weixin/wx_notice.html
mobile/admin/templates/weixin/wx_qcode.html
mobile/admin/templates/weixin/wx_reg.html
mobile/admin/templates/weixin/wx_share.html
mobile/admin/user_grade.php
mobile/admin/website.php
mobile/admin/weixin.php
mobile/admin/weixin_egg.php
mobile/admin/weixin_share.php
mobile/affiche.php
mobile/affiliate.php
mobile/ajax_68ecshop.php
mobile/alipay.html
mobile/animated_favicon.gif
mobile/api.php
mobile/api/checkorder.php
mobile/api/client/api.php
mobile/api/client/includes/init.php
mobile/api/client/includes/lib_api.php
mobile/api/client/includes/lib_struct.php
mobile/api/cron.php
mobile/api/goods.php
mobile/api/init.php
mobile/api/uc.php
mobile/article.php
mobile/article_cat.php
mobile/article_cat_list.php
mobile/auction.php
mobile/brand.php
mobile/brands.php
mobile/buy.php
mobile/captcha.php
mobile/cat_all.php
mobile/catalog.php
mobile/catalog1.php
mobile/category.php
mobile/cert/index.htm
mobile/certi.php
mobile/chat.php
mobile/chinabank_receive.php
mobile/comment.php
mobile/compare.php
mobile/cycle_image.php
mobile/data/afficheimg/1439591535717867966.jpg
mobile/data/afficheimg/1439591548228839147.jpg
mobile/data/afficheimg/1439591558400212846.jpg
mobile/data/afficheimg/1439599472181302331.jpg
mobile/data/afficheimg/1439599491617243245.jpg
mobile/data/afficheimg/1439599504598896792.jpg
mobile/data/afficheimg/1439599529226660871.jpg
mobile/data/afficheimg/1439599552270841766.jpg
mobile/data/afficheimg/1439599583128695320.jpg
mobile/data/afficheimg/1439599621092805367.jpg
mobile/data/afficheimg/1439599654105691437.jpg
mobile/data/afficheimg/1439599668860020191.jpg
mobile/data/afficheimg/1439599682320705212.jpg
mobile/data/afficheimg/1439602645444465829.jpg
mobile/data/afficheimg/1440434742398149569.jpg
mobile/data/afficheimg/1440434755442738492.jpg
mobile/data/afficheimg/1440434770177026373.jpg
mobile/data/afficheimg/1440440627334881243.jpg
mobile/data/afficheimg/1440440640683529598.jpg
mobile/data/afficheimg/1440440653012080615.jpg
mobile/data/afficheimg/1440440937541312619.jpg
mobile/data/afficheimg/1440440950270619270.jpg
mobile/data/afficheimg/1440440964221579671.jpg
mobile/data/afficheimg/1440441297891645726.jpg
mobile/data/afficheimg/1440441309298547049.jpg
mobile/data/afficheimg/1440441322747825925.jpg
mobile/data/afficheimg/1440441335666954737.jpg
mobile/data/afficheimg/1440441570105186778.jpg
mobile/data/afficheimg/1440441583106823034.jpg
mobile/data/afficheimg/1440441598298427200.jpg
mobile/data/afficheimg/1440441609637332520.jpg
mobile/data/afficheimg/1440441619190091684.jpg
mobile/data/afficheimg/1440441632074619018.jpg
mobile/data/afficheimg/1440441976376098118.jpg
mobile/data/afficheimg/1440441984421548785.jpg
mobile/data/afficheimg/1440441994603605044.jpg
mobile/data/afficheimg/1440442007543226328.jpg
mobile/data/afficheimg/1440444848938395010.jpg
mobile/data/afficheimg/1440456990529538866.jpg
mobile/data/afficheimg/1440457126418759028.jpg
mobile/data/afficheimg/1440457211293796703.jpg
mobile/data/afficheimg/1440457313245024328.jpg
mobile/data/afficheimg/1440457944231102054.jpg
mobile/data/afficheimg/1440458000750131498.jpg
mobile/data/afficheimg/1440458064787438667.jpg
mobile/data/afficheimg/1448356604008293472.jpg
mobile/data/afficheimg/1448356612986562725.jpg
mobile/data/afficheimg/1448416401897197122.jpg
mobile/data/afficheimg/1448416422047195495.jpg
mobile/data/afficheimg/1448416436816079625.jpg
mobile/data/afficheimg/1448416460390350945.jpg
mobile/data/afficheimg/1448416481544558283.jpg
mobile/data/afficheimg/1448416503832636230.jpg
mobile/data/afficheimg/1448416517733666473.jpg
mobile/data/afficheimg/1448416662917354150.jpg
mobile/data/afficheimg/1448416907284561457.jpg
mobile/data/afficheimg/1448419532609281907.jpg
mobile/data/afficheimg/1448440003796254934.jpg
mobile/data/afficheimg/1448440497252672657.jpg
mobile/data/afficheimg/1448440512759137490.jpg
mobile/data/afficheimg/1449133050335953602.jpg
mobile/data/afficheimg/1449133803800332070.jpg
mobile/data/afficheimg/1449133969679372692.jpg
mobile/data/afficheimg/1449211304384657002.jpg
mobile/data/afficheimg/1449211314337500026.jpg
mobile/data/afficheimg/1449211322053543907.jpg
mobile/data/afficheimg/1449211332982038760.jpg
mobile/data/afficheimg/1449211863640232866.jpg
mobile/data/afficheimg/1449211895142209316.jpg
mobile/data/afficheimg/1449211911907172232.jpg
mobile/data/afficheimg/1449211938054319010.jpg
mobile/data/afficheimg/1449211949778889111.jpg
mobile/data/afficheimg/1449212159665202116.jpg
mobile/data/afficheimg/1449212183865532525.jpg
mobile/data/afficheimg/1449212229129350287.jpg
mobile/data/afficheimg/1449212256564841331.jpg
mobile/data/afficheimg/1449212370392366109.jpg
mobile/data/afficheimg/1450750792588671498.jpg
mobile/data/afficheimg/1450750817550331600.jpg
mobile/data/afficheimg/1451270139500734936.jpg
mobile/data/afficheimg/1451270251124076751.jpg
mobile/data/afficheimg/1451270287631313925.jpg
mobile/data/afficheimg/1451275144815472920.jpg
mobile/data/afficheimg/1451275159159962868.jpg
mobile/data/afficheimg/1451275222798552828.jpg
mobile/data/afficheimg/1451275333968246484.jpg
mobile/data/afficheimg/1451275345734837088.jpg
mobile/data/afficheimg/1452810972762816784.jpg
mobile/data/afficheimg/1452810986135754884.jpg
mobile/data/afficheimg/1452811020009445847.jpg
mobile/data/afficheimg/1452811387900646782.jpg
mobile/data/afficheimg/1452811408822963367.jpg
mobile/data/afficheimg/1452811423799666746.jpg
mobile/data/afficheimg/1452811438628044923.jpg
mobile/data/afficheimg/1452811457000913314.jpg
mobile/data/afficheimg/1452811476590464687.jpg
mobile/data/afficheimg/1452811493908717068.jpg
mobile/data/afficheimg/1452811510576763038.jpg
mobile/data/afficheimg/1452812005570415972.jpg
mobile/data/afficheimg/1452812047611630483.jpg
mobile/data/afficheimg/1452812082460141997.jpg
mobile/data/afficheimg/1452812100378989741.jpg
mobile/data/afficheimg/1452812336571368655.jpg
mobile/data/afficheimg/1452814956091747599.jpg
mobile/data/afficheimg/1452814970763144335.jpg
mobile/data/afficheimg/1452814986621416638.jpg
mobile/data/afficheimg/1452815044625354701.jpg
mobile/data/afficheimg/1452815058500002271.jpg
mobile/data/afficheimg/1452824547393265233.jpg
mobile/data/afficheimg/1452824560514196085.jpg
mobile/data/afficheimg/1452824572356937668.jpg
mobile/data/afficheimg/1452824719172073451.jpg
mobile/data/afficheimg/1461550450976297313.jpg
mobile/data/afficheimg/1461550476770626389.jpg
mobile/data/afficheimg/1461550494828509479.jpg
mobile/data/afficheimg/1461550529924414460.jpg
mobile/data/afficheimg/1461550567599490669.jpg
mobile/data/afficheimg/1461550728091868202.jpg
mobile/data/afficheimg/1510642958390772626.jpg
mobile/data/afficheimg/1510642981844659761.jpg
mobile/data/afficheimg/1510642995117925076.jpg
mobile/data/afficheimg/1510643092556673527.jpg
mobile/data/afficheimg/1515217468897252044.jpg
mobile/data/afficheimg/1515217545715130525.jpg
mobile/data/afficheimg/1515218326259665440.jpg
mobile/data/afficheimg/1515219912591890794.jpg
mobile/data/article/1457663142121799978.jpg
mobile/data/article/1461551571348457193.jpg
mobile/data/brandimg/1439493435770837926.jpg
mobile/data/brandimg/1439493661538300802.jpg
mobile/data/brandimg/1439494873000764950.jpg
mobile/data/brandimg/1439495128443057874.jpg
mobile/data/brandimg/1439507092286349385.jpg
mobile/data/brandimg/1439830265271758949.png
mobile/data/brandimg/1440456261266965400.jpg
mobile/data/brandimg/1440456279008753414.jpg
mobile/data/brandimg/1440456363479143683.jpg
mobile/data/brandimg/1440456395149945674.png
mobile/data/brandimg/1440456435863047826.png
mobile/data/brandimg/1440456456924398149.png
mobile/data/brandimg/1440456510915052146.png
mobile/data/brandimg/1442790563691794015.jpg
mobile/data/brandimg/1442790605221252695.jpg
mobile/data/brandimg/1442790975812733125.jpg
mobile/data/brandimg/1442790986130898587.jpg
mobile/data/brandimg/1450246427784027649.jpg
mobile/data/brandimg/1450406698318846984.jpg
mobile/data/brandimg/1452812469083112945.jpg
mobile/data/brandlogo/1440456381049200755.png
mobile/data/captcha/arial.ttf
mobile/data/captcha/captcha_bg1.gif
mobile/data/captcha/captcha_bg1.jpg
mobile/data/captcha/captcha_bg2.gif
mobile/data/captcha/captcha_bg2.jpg
mobile/data/captcha/captcha_bg3.gif
mobile/data/captcha/captcha_bg3.jpg
mobile/data/captcha/captcha_bg4.gif
mobile/data/captcha/captcha_bg4.jpg
mobile/data/captcha/captcha_bg5.gif
mobile/data/captcha/captcha_bg5.jpg
mobile/data/captcha/captcha_bg6.gif
mobile/data/captcha/captcha_bg6.jpg
mobile/data/catthumb/1440446120625080634.png
mobile/data/catthumb/1440452916316021707.jpg
mobile/data/catthumb/1440452927958984817.jpg
mobile/data/catthumb/1440452939358425472.jpg
mobile/data/catthumb/1440452948644700328.jpg
mobile/data/catthumb/1440452960121012065.jpg
mobile/data/catthumb/1440452970837283393.jpg
mobile/data/catthumb/1440452980125176131.jpg
mobile/data/catthumb/1440453251939605115.jpg
mobile/data/catthumb/1450750888212113209.png
mobile/data/catthumb/1450750902190715379.jpg
mobile/data/catthumb/1450750911792735655.jpg
mobile/data/catthumb/1450750923910091174.jpg
mobile/data/catthumb/1450750939174415043.jpg
mobile/data/catthumb/1450752837884252182.jpg
mobile/data/catthumb/1450752849696680991.jpg
mobile/data/catthumb/1450752896510442617.jpg
mobile/dm299_h5.php
mobile/dm299_h5_notify.php
mobile/erweima_png.php
mobile/erweima_supplier.php
mobile/exchange.php
mobile/favicon.ico
mobile/feed.php
mobile/findPwd.php
mobile/flow-old.php
mobile/flow.php
mobile/freegoods.php
mobile/freeorder.php
mobile/gallery.php
mobile/goods.php
mobile/goods_comment.php
mobile/goods_list.php
mobile/goods_script.php
mobile/group_buy.php
mobile/http-bind.php
mobile/images/201508/1440437162673438083.png
mobile/images/201508/1440437165699930301.png
mobile/images/201508/1440439257667525408.png
mobile/images/201508/1440439281976779943.png
mobile/images/201508/1440439295519914039.png
mobile/images/201508/1440439318451279676.png
mobile/images/201508/1440439335793850371.png
mobile/images/201508/1440439353048484531.png
mobile/images/201508/1440439367001464442.png
mobile/images/201508/1440439952487090605.png
mobile/images/201509/1443551444334875453.png
mobile/images/201511/1448357410668489955.png
mobile/images/201511/1448357420970576068.png
mobile/images/201511/1448357548318185262.png
mobile/images/201511/1448357560550018688.png
mobile/images/201511/1448357597203920848.png
mobile/images/201511/1448413440331660162.png
mobile/images/201511/1448413461072502099.png
mobile/images/201511/1448413478840545601.png
mobile/images/201511/1448413495936293613.png
mobile/images/201512/1449211462264405303.png
mobile/images/201512/1449211492577777979.png
mobile/images/201512/1449211492591489800.png
mobile/images/201512/1449211509436179357.png
mobile/images/201512/1449211532327444058.png
mobile/images/201512/1449211552095142246.png
mobile/images/201512/1449211569920962849.png
mobile/images/201512/1449211591837778089.png
mobile/images/201512/1449211609954015320.png
mobile/images/201512/1450059682138456527.png
mobile/images/201601/1451965457243296384.png
mobile/images/201601/1451965612112657192.png
mobile/images/201601/1451977412796659441.png
mobile/images/201601/1451977420977965019.png
mobile/images/201601/1451977432795953606.png
mobile/images/201601/1451977442725078786.png
mobile/images/201601/1451977451983679267.png
mobile/images/201601/1451977578591535688.png
mobile/images/201601/1451977578968511640.png
mobile/images/201601/1451977598569272280.png
mobile/images/201601/1451977612241684520.png
mobile/images/201601/1451977620253191836.png
mobile/images/201601/1452668561361790966.png
mobile/images/201601/1452810567181783162.png
mobile/images/201601/1452810582121261988.png
mobile/images/201601/1452810601709424321.png
mobile/images/201601/1452810635366168502.png
mobile/images/201601/1452810660773862571.png
mobile/images/201601/1452810686747643308.png
mobile/images/201601/1452810713069539296.png
mobile/images/201601/1452810735464758653.png
mobile/images/201601/1452810753312811629.png
mobile/images/201601/1452810882593112551.png
mobile/images/201603/1458379366066881920.png
mobile/images/201603/1458379393020351679.png
mobile/images/201603/1458379414416900416.png
mobile/images/201603/1458379433548978373.png
mobile/images/201603/1458379450725165370.png
mobile/images/201603/1458379473071020374.png
mobile/images/201603/1458379492296814740.png
mobile/images/201603/1458379510825667230.png
mobile/images/201605/1462529513327111190.png
mobile/images/201605/1462529532929607713.png
mobile/images/201710/1508307230350765949.jpg
mobile/images/icon_drop.gif
mobile/images/icon_edit.gif
mobile/images/profile_small.jpg
mobile/images/weixin/Thumbs.db
mobile/images/weixin/pt_qrcode.jpg
mobile/includes/Geohash.php
mobile/includes/OpenFire.php
mobile/includes/cls_captcha.php
mobile/includes/cls_ecshop.php
mobile/includes/cls_error.php
mobile/includes/cls_iconv.php
mobile/includes/cls_image.php
mobile/includes/cls_json.php
mobile/includes/cls_mysql.php
mobile/includes/cls_rss.php
mobile/includes/cls_session.php
mobile/includes/cls_sms.php
mobile/includes/cls_smtp.php
mobile/includes/cls_sql_executor.php
mobile/includes/cls_template.php
mobile/includes/cls_transport.php
mobile/includes/codetable/big5-gb.table
mobile/includes/codetable/big5_utf8.php
mobile/includes/codetable/gb-big5.table
mobile/includes/codetable/gb_utf8.php
mobile/includes/codetable/ipdata.dat
mobile/includes/fckeditor/editor/css/behaviors/disablehandles.htc
mobile/includes/fckeditor/editor/css/behaviors/showtableborders.htc
mobile/includes/fckeditor/editor/css/fck_editorarea.css
mobile/includes/fckeditor/editor/css/fck_internal.css
mobile/includes/fckeditor/editor/css/fck_showtableborders_gecko.css
mobile/includes/fckeditor/editor/css/images/block_address.png
mobile/includes/fckeditor/editor/css/images/block_blockquote.png
mobile/includes/fckeditor/editor/css/images/block_div.png
mobile/includes/fckeditor/editor/css/images/block_h1.png
mobile/includes/fckeditor/editor/css/images/block_h2.png
mobile/includes/fckeditor/editor/css/images/block_h3.png
mobile/includes/fckeditor/editor/css/images/block_h4.png
mobile/includes/fckeditor/editor/css/images/block_h5.png
mobile/includes/fckeditor/editor/css/images/block_h6.png
mobile/includes/fckeditor/editor/css/images/block_p.png
mobile/includes/fckeditor/editor/css/images/block_pre.png
mobile/includes/fckeditor/editor/css/images/fck_anchor.gif
mobile/includes/fckeditor/editor/css/images/fck_flashlogo.gif
mobile/includes/fckeditor/editor/css/images/fck_hiddenfield.gif
mobile/includes/fckeditor/editor/css/images/fck_pagebreak.gif
mobile/includes/fckeditor/editor/css/images/fck_plugin.gif
mobile/includes/fckeditor/editor/dialog/common/fck_dialog_common.css
mobile/includes/fckeditor/editor/dialog/common/fck_dialog_common.js
mobile/includes/fckeditor/editor/dialog/fck_UpFileBtn.html
mobile/includes/fckeditor/editor/dialog/fck_UpFileBtn/fck_UpFileBtn.js
mobile/includes/fckeditor/editor/dialog/fck_about.html
mobile/includes/fckeditor/editor/dialog/fck_about/logo_fckeditor.gif
mobile/includes/fckeditor/editor/dialog/fck_about/logo_fredck.gif
mobile/includes/fckeditor/editor/dialog/fck_about/sponsors/spellchecker_net.gif
mobile/includes/fckeditor/editor/dialog/fck_anchor.html
mobile/includes/fckeditor/editor/dialog/fck_button.html
mobile/includes/fckeditor/editor/dialog/fck_checkbox.html
mobile/includes/fckeditor/editor/dialog/fck_colorselector.html
mobile/includes/fckeditor/editor/dialog/fck_docprops.html
mobile/includes/fckeditor/editor/dialog/fck_docprops/fck_document_preview.html
mobile/includes/fckeditor/editor/dialog/fck_flash.html
mobile/includes/fckeditor/editor/dialog/fck_flash/fck_flash.js
mobile/includes/fckeditor/editor/dialog/fck_flash/fck_flash_preview.html
mobile/includes/fckeditor/editor/dialog/fck_form.html
mobile/includes/fckeditor/editor/dialog/fck_hiddenfield.html
mobile/includes/fckeditor/editor/dialog/fck_image.html
mobile/includes/fckeditor/editor/dialog/fck_image/fck_image.js
mobile/includes/fckeditor/editor/dialog/fck_image/fck_image_preview.html
mobile/includes/fckeditor/editor/dialog/fck_link.html
mobile/includes/fckeditor/editor/dialog/fck_link/fck_link.js
mobile/includes/fckeditor/editor/dialog/fck_listprop.html
mobile/includes/fckeditor/editor/dialog/fck_paste.html
mobile/includes/fckeditor/editor/dialog/fck_radiobutton.html
mobile/includes/fckeditor/editor/dialog/fck_replace.html
mobile/includes/fckeditor/editor/dialog/fck_select.html
mobile/includes/fckeditor/editor/dialog/fck_select/fck_select.js
mobile/includes/fckeditor/editor/dialog/fck_smiley.html
mobile/includes/fckeditor/editor/dialog/fck_source.html
mobile/includes/fckeditor/editor/dialog/fck_specialchar.html
mobile/includes/fckeditor/editor/dialog/fck_spellerpages.html
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/blank.html
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css
mobile/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js
mobile/includes/fckeditor/editor/dialog/fck_table.html
mobile/includes/fckeditor/editor/dialog/fck_tablecell.html
mobile/includes/fckeditor/editor/dialog/fck_template.html
mobile/includes/fckeditor/editor/dialog/fck_textarea.html
mobile/includes/fckeditor/editor/dialog/fck_textfield.html
mobile/includes/fckeditor/editor/dtd/fck_dtd_test.html
mobile/includes/fckeditor/editor/dtd/fck_xhtml10strict.js
mobile/includes/fckeditor/editor/dtd/fck_xhtml10transitional.js
mobile/includes/fckeditor/editor/fckdebug.html
mobile/includes/fckeditor/editor/fckdialog.html
mobile/includes/fckeditor/editor/fckeditor.html
mobile/includes/fckeditor/editor/fckeditor.original.html
mobile/includes/fckeditor/editor/filemanager/browser/default/browser.css
mobile/includes/fckeditor/editor/filemanager/browser/default/browser.html
mobile/includes/fckeditor/editor/filemanager/browser/default/frm.html
mobile/includes/fckeditor/editor/filemanager/browser/default/frmactualfolder.html
mobile/includes/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html
mobile/includes/fckeditor/editor/filemanager/browser/default/frmfolders.html
mobile/includes/fckeditor/editor/filemanager/browser/default/frmresourceslist.html
mobile/includes/fckeditor/editor/filemanager/browser/default/frmresourcetype.html
mobile/includes/fckeditor/editor/filemanager/browser/default/frmupload.html
mobile/includes/fckeditor/editor/filemanager/browser/default/js/common.js
mobile/includes/fckeditor/editor/filemanager/browser/default/js/fckxml.js
mobile/includes/fckeditor/editor/filemanager/connectors/php/.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/_more.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/basexml.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/commands.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/config.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/connector.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/io.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/phpcompat.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/upload.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/upload_more.php
mobile/includes/fckeditor/editor/filemanager/connectors/php/util.php
mobile/includes/fckeditor/editor/images/anchor.gif
mobile/includes/fckeditor/editor/images/arrow_ltr.gif
mobile/includes/fckeditor/editor/images/arrow_rtl.gif
mobile/includes/fckeditor/editor/images/smiley/msn/angel_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/angry_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/broken_heart.gif
mobile/includes/fckeditor/editor/images/smiley/msn/cake.gif
mobile/includes/fckeditor/editor/images/smiley/msn/confused_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/cry_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/devil_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/embaressed_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/envelope.gif
mobile/includes/fckeditor/editor/images/smiley/msn/heart.gif
mobile/includes/fckeditor/editor/images/smiley/msn/kiss.gif
mobile/includes/fckeditor/editor/images/smiley/msn/lightbulb.gif
mobile/includes/fckeditor/editor/images/smiley/msn/omg_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/regular_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/sad_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/shades_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/teeth_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/thumbs_down.gif
mobile/includes/fckeditor/editor/images/smiley/msn/thumbs_up.gif
mobile/includes/fckeditor/editor/images/smiley/msn/tounge_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif
mobile/includes/fckeditor/editor/images/smiley/msn/wink_smile.gif
mobile/includes/fckeditor/editor/images/spacer.gif
mobile/includes/fckeditor/editor/js/fckadobeair.js
mobile/includes/fckeditor/editor/js/fckeditorcode_gecko.js
mobile/includes/fckeditor/editor/js/fckeditorcode_ie.js
mobile/includes/fckeditor/editor/lang/en.js
mobile/includes/fckeditor/editor/lang/zh-cn.js
mobile/includes/fckeditor/editor/lang/zh.js
mobile/includes/fckeditor/editor/skins/default/fck_dialog.css
mobile/includes/fckeditor/editor/skins/default/fck_dialog_ie6.js
mobile/includes/fckeditor/editor/skins/default/fck_editor.css
mobile/includes/fckeditor/editor/skins/default/fck_strip.gif
mobile/includes/fckeditor/fckconfig.js
mobile/includes/fckeditor/fckeditor.cfc
mobile/includes/fckeditor/fckeditor.js
mobile/includes/fckeditor/fckeditor.php
mobile/includes/fckeditor/fckeditor_php4.php
mobile/includes/fckeditor/fckeditor_php5.php
mobile/includes/fckeditor/fckpackager.xml
mobile/includes/fckeditor/fckstyles.xml
mobile/includes/fckeditor/fcktemplates.xml
mobile/includes/fckeditor/license.txt
mobile/includes/inc_constant.php
mobile/includes/init.php
mobile/includes/init_supplier.php
mobile/includes/kindeditor/examples/auto-height.html
mobile/includes/kindeditor/examples/colorpicker.html
mobile/includes/kindeditor/examples/custom-plugin.html
mobile/includes/kindeditor/examples/custom-theme.html
mobile/includes/kindeditor/examples/default.html
mobile/includes/kindeditor/examples/dialog.html
mobile/includes/kindeditor/examples/dynamic-load.html
mobile/includes/kindeditor/examples/file-dialog.html
mobile/includes/kindeditor/examples/file-manager.html
mobile/includes/kindeditor/examples/filter-mode.html
mobile/includes/kindeditor/examples/image-dialog.html
mobile/includes/kindeditor/examples/index.css
mobile/includes/kindeditor/examples/index.html
mobile/includes/kindeditor/examples/jquery-ui.html
mobile/includes/kindeditor/examples/jquery.html
mobile/includes/kindeditor/examples/mootools.html
mobile/includes/kindeditor/examples/multi-image-dialog.html
mobile/includes/kindeditor/examples/multi-language.html
mobile/includes/kindeditor/examples/newline.html
mobile/includes/kindeditor/examples/node.html
mobile/includes/kindeditor/examples/paste-type.html
mobile/includes/kindeditor/examples/qqstyle.html
mobile/includes/kindeditor/examples/readonly.html
mobile/includes/kindeditor/examples/simple.html
mobile/includes/kindeditor/examples/total.html
mobile/includes/kindeditor/examples/uploadbutton.html
mobile/includes/kindeditor/examples/url-type.html
mobile/includes/kindeditor/examples/word-count.html
mobile/includes/kindeditor/kindeditor-all-min.js
mobile/includes/kindeditor/kindeditor-all.js
mobile/includes/kindeditor/kindeditor-min.js
mobile/includes/kindeditor/kindeditor.js
mobile/includes/kindeditor/lang/ar.js
mobile/includes/kindeditor/lang/en.js
mobile/includes/kindeditor/lang/zh_CN.js
mobile/includes/kindeditor/lang/zh_TW.js
mobile/includes/kindeditor/license.txt
mobile/includes/kindeditor/php/JSON.php
mobile/includes/kindeditor/php/demo.php
mobile/includes/kindeditor/php/file_manager_json.php
mobile/includes/kindeditor/php/file_manager_json1.php
mobile/includes/kindeditor/php/upload_json.php
mobile/includes/kindeditor/php/upload_json1.php
mobile/includes/kindeditor/plugins/anchor/anchor.js
mobile/includes/kindeditor/plugins/autoheight/autoheight.js
mobile/includes/kindeditor/plugins/baidumap/baidumap.js
mobile/includes/kindeditor/plugins/baidumap/index.html
mobile/includes/kindeditor/plugins/baidumap/map.html
mobile/includes/kindeditor/plugins/clearhtml/clearhtml.js
mobile/includes/kindeditor/plugins/code/code.js
mobile/includes/kindeditor/plugins/code/prettify.css
mobile/includes/kindeditor/plugins/code/prettify.js
mobile/includes/kindeditor/plugins/emoticons/emoticons.js
mobile/includes/kindeditor/plugins/emoticons/images/0.gif
mobile/includes/kindeditor/plugins/emoticons/images/1.gif
mobile/includes/kindeditor/plugins/emoticons/images/10.gif
mobile/includes/kindeditor/plugins/emoticons/images/100.gif
mobile/includes/kindeditor/plugins/emoticons/images/101.gif
mobile/includes/kindeditor/plugins/emoticons/images/102.gif
mobile/includes/kindeditor/plugins/emoticons/images/103.gif
mobile/includes/kindeditor/plugins/emoticons/images/104.gif
mobile/includes/kindeditor/plugins/emoticons/images/105.gif
mobile/includes/kindeditor/plugins/emoticons/images/106.gif
mobile/includes/kindeditor/plugins/emoticons/images/107.gif
mobile/includes/kindeditor/plugins/emoticons/images/108.gif
mobile/includes/kindeditor/plugins/emoticons/images/109.gif
mobile/includes/kindeditor/plugins/emoticons/images/11.gif
mobile/includes/kindeditor/plugins/emoticons/images/110.gif
mobile/includes/kindeditor/plugins/emoticons/images/111.gif
mobile/includes/kindeditor/plugins/emoticons/images/112.gif
mobile/includes/kindeditor/plugins/emoticons/images/113.gif
mobile/includes/kindeditor/plugins/emoticons/images/114.gif
mobile/includes/kindeditor/plugins/emoticons/images/115.gif
mobile/includes/kindeditor/plugins/emoticons/images/116.gif
mobile/includes/kindeditor/plugins/emoticons/images/117.gif
mobile/includes/kindeditor/plugins/emoticons/images/118.gif
mobile/includes/kindeditor/plugins/emoticons/images/119.gif
mobile/includes/kindeditor/plugins/emoticons/images/12.gif
mobile/includes/kindeditor/plugins/emoticons/images/120.gif
mobile/includes/kindeditor/plugins/emoticons/images/121.gif
mobile/includes/kindeditor/plugins/emoticons/images/122.gif
mobile/includes/kindeditor/plugins/emoticons/images/123.gif
mobile/includes/kindeditor/plugins/emoticons/images/124.gif
mobile/includes/kindeditor/plugins/emoticons/images/125.gif
mobile/includes/kindeditor/plugins/emoticons/images/126.gif
mobile/includes/kindeditor/plugins/emoticons/images/127.gif
mobile/includes/kindeditor/plugins/emoticons/images/128.gif
mobile/includes/kindeditor/plugins/emoticons/images/129.gif
mobile/includes/kindeditor/plugins/emoticons/images/13.gif
mobile/includes/kindeditor/plugins/emoticons/images/130.gif
mobile/includes/kindeditor/plugins/emoticons/images/131.gif
mobile/includes/kindeditor/plugins/emoticons/images/132.gif
mobile/includes/kindeditor/plugins/emoticons/images/133.gif
mobile/includes/kindeditor/plugins/emoticons/images/134.gif
mobile/includes/kindeditor/plugins/emoticons/images/14.gif
mobile/includes/kindeditor/plugins/emoticons/images/15.gif
mobile/includes/kindeditor/plugins/emoticons/images/16.gif
mobile/includes/kindeditor/plugins/emoticons/images/17.gif
mobile/includes/kindeditor/plugins/emoticons/images/18.gif
mobile/includes/kindeditor/plugins/emoticons/images/19.gif
mobile/includes/kindeditor/plugins/emoticons/images/2.gif
mobile/includes/kindeditor/plugins/emoticons/images/20.gif
mobile/includes/kindeditor/plugins/emoticons/images/21.gif
mobile/includes/kindeditor/plugins/emoticons/images/22.gif
mobile/includes/kindeditor/plugins/emoticons/images/23.gif
mobile/includes/kindeditor/plugins/emoticons/images/24.gif
mobile/includes/kindeditor/plugins/emoticons/images/25.gif
mobile/includes/kindeditor/plugins/emoticons/images/26.gif
mobile/includes/kindeditor/plugins/emoticons/images/27.gif
mobile/includes/kindeditor/plugins/emoticons/images/28.gif
mobile/includes/kindeditor/plugins/emoticons/images/29.gif
mobile/includes/kindeditor/plugins/emoticons/images/3.gif
mobile/includes/kindeditor/plugins/emoticons/images/30.gif
mobile/includes/kindeditor/plugins/emoticons/images/31.gif
mobile/includes/kindeditor/plugins/emoticons/images/32.gif
mobile/includes/kindeditor/plugins/emoticons/images/33.gif
mobile/includes/kindeditor/plugins/emoticons/images/34.gif
mobile/includes/kindeditor/plugins/emoticons/images/35.gif
mobile/includes/kindeditor/plugins/emoticons/images/36.gif
mobile/includes/kindeditor/plugins/emoticons/images/37.gif
mobile/includes/kindeditor/plugins/emoticons/images/38.gif
mobile/includes/kindeditor/plugins/emoticons/images/39.gif
mobile/includes/kindeditor/plugins/emoticons/images/4.gif
mobile/includes/kindeditor/plugins/emoticons/images/40.gif
mobile/includes/kindeditor/plugins/emoticons/images/41.gif
mobile/includes/kindeditor/plugins/emoticons/images/42.gif
mobile/includes/kindeditor/plugins/emoticons/images/43.gif
mobile/includes/kindeditor/plugins/emoticons/images/44.gif
mobile/includes/kindeditor/plugins/emoticons/images/45.gif
mobile/includes/kindeditor/plugins/emoticons/images/46.gif
mobile/includes/kindeditor/plugins/emoticons/images/47.gif
mobile/includes/kindeditor/plugins/emoticons/images/48.gif
mobile/includes/kindeditor/plugins/emoticons/images/49.gif
mobile/includes/kindeditor/plugins/emoticons/images/5.gif
mobile/includes/kindeditor/plugins/emoticons/images/50.gif
mobile/includes/kindeditor/plugins/emoticons/images/51.gif
mobile/includes/kindeditor/plugins/emoticons/images/52.gif
mobile/includes/kindeditor/plugins/emoticons/images/53.gif
mobile/includes/kindeditor/plugins/emoticons/images/54.gif
mobile/includes/kindeditor/plugins/emoticons/images/55.gif
mobile/includes/kindeditor/plugins/emoticons/images/56.gif
mobile/includes/kindeditor/plugins/emoticons/images/57.gif
mobile/includes/kindeditor/plugins/emoticons/images/58.gif
mobile/includes/kindeditor/plugins/emoticons/images/59.gif
mobile/includes/kindeditor/plugins/emoticons/images/6.gif
mobile/includes/kindeditor/plugins/emoticons/images/60.gif
mobile/includes/kindeditor/plugins/emoticons/images/61.gif
mobile/includes/kindeditor/plugins/emoticons/images/62.gif
mobile/includes/kindeditor/plugins/emoticons/images/63.gif
mobile/includes/kindeditor/plugins/emoticons/images/64.gif
mobile/includes/kindeditor/plugins/emoticons/images/65.gif
mobile/includes/kindeditor/plugins/emoticons/images/66.gif
mobile/includes/kindeditor/plugins/emoticons/images/67.gif
mobile/includes/kindeditor/plugins/emoticons/images/68.gif
mobile/includes/kindeditor/plugins/emoticons/images/69.gif
mobile/includes/kindeditor/plugins/emoticons/images/7.gif
mobile/includes/kindeditor/plugins/emoticons/images/70.gif
mobile/includes/kindeditor/plugins/emoticons/images/71.gif
mobile/includes/kindeditor/plugins/emoticons/images/72.gif
mobile/includes/kindeditor/plugins/emoticons/images/73.gif
mobile/includes/kindeditor/plugins/emoticons/images/74.gif
mobile/includes/kindeditor/plugins/emoticons/images/75.gif
mobile/includes/kindeditor/plugins/emoticons/images/76.gif
mobile/includes/kindeditor/plugins/emoticons/images/77.gif
mobile/includes/kindeditor/plugins/emoticons/images/78.gif
mobile/includes/kindeditor/plugins/emoticons/images/79.gif
mobile/includes/kindeditor/plugins/emoticons/images/8.gif
mobile/includes/kindeditor/plugins/emoticons/images/80.gif
mobile/includes/kindeditor/plugins/emoticons/images/81.gif
mobile/includes/kindeditor/plugins/emoticons/images/82.gif
mobile/includes/kindeditor/plugins/emoticons/images/83.gif
mobile/includes/kindeditor/plugins/emoticons/images/84.gif
mobile/includes/kindeditor/plugins/emoticons/images/85.gif
mobile/includes/kindeditor/plugins/emoticons/images/86.gif
mobile/includes/kindeditor/plugins/emoticons/images/87.gif
mobile/includes/kindeditor/plugins/emoticons/images/88.gif
mobile/includes/kindeditor/plugins/emoticons/images/89.gif
mobile/includes/kindeditor/plugins/emoticons/images/9.gif
mobile/includes/kindeditor/plugins/emoticons/images/90.gif
mobile/includes/kindeditor/plugins/emoticons/images/91.gif
mobile/includes/kindeditor/plugins/emoticons/images/92.gif
mobile/includes/kindeditor/plugins/emoticons/images/93.gif
mobile/includes/kindeditor/plugins/emoticons/images/94.gif
mobile/includes/kindeditor/plugins/emoticons/images/95.gif
mobile/includes/kindeditor/plugins/emoticons/images/96.gif
mobile/includes/kindeditor/plugins/emoticons/images/97.gif
mobile/includes/kindeditor/plugins/emoticons/images/98.gif
mobile/includes/kindeditor/plugins/emoticons/images/99.gif
mobile/includes/kindeditor/plugins/emoticons/images/static.gif
mobile/includes/kindeditor/plugins/filemanager/filemanager.js
mobile/includes/kindeditor/plugins/filemanager/images/file-16.gif
mobile/includes/kindeditor/plugins/filemanager/images/file-64.gif
mobile/includes/kindeditor/plugins/filemanager/images/folder-16.gif
mobile/includes/kindeditor/plugins/filemanager/images/folder-64.gif
mobile/includes/kindeditor/plugins/filemanager/images/go-up.gif
mobile/includes/kindeditor/plugins/flash/flash.js
mobile/includes/kindeditor/plugins/image/image.js
mobile/includes/kindeditor/plugins/image/images/align_left.gif
mobile/includes/kindeditor/plugins/image/images/align_right.gif
mobile/includes/kindeditor/plugins/image/images/align_top.gif
mobile/includes/kindeditor/plugins/image/images/refresh.png
mobile/includes/kindeditor/plugins/insertfile/insertfile.js
mobile/includes/kindeditor/plugins/lineheight/lineheight.js
mobile/includes/kindeditor/plugins/link/link.js
mobile/includes/kindeditor/plugins/map/map.html
mobile/includes/kindeditor/plugins/map/map.js
mobile/includes/kindeditor/plugins/media/media.js
mobile/includes/kindeditor/plugins/multiimage/images/image.png
mobile/includes/kindeditor/plugins/multiimage/images/select-files-en.png
mobile/includes/kindeditor/plugins/multiimage/images/select-files-zh_CN.png
mobile/includes/kindeditor/plugins/multiimage/images/swfupload.swf
mobile/includes/kindeditor/plugins/multiimage/multiimage.js
mobile/includes/kindeditor/plugins/pagebreak/pagebreak.js
mobile/includes/kindeditor/plugins/plainpaste/plainpaste.js
mobile/includes/kindeditor/plugins/preview/preview.js
mobile/includes/kindeditor/plugins/quickformat/quickformat.js
mobile/includes/kindeditor/plugins/table/table.js
mobile/includes/kindeditor/plugins/template/html/1.html
mobile/includes/kindeditor/plugins/template/html/2.html
mobile/includes/kindeditor/plugins/template/html/3.html
mobile/includes/kindeditor/plugins/template/template.js
mobile/includes/kindeditor/plugins/wordpaste/wordpaste.js
mobile/includes/kindeditor/themes/common/anchor.gif
mobile/includes/kindeditor/themes/common/blank.gif
mobile/includes/kindeditor/themes/common/flash.gif
mobile/includes/kindeditor/themes/common/loading.gif
mobile/includes/kindeditor/themes/common/media.gif
mobile/includes/kindeditor/themes/common/rm.gif
mobile/includes/kindeditor/themes/default/background.png
mobile/includes/kindeditor/themes/default/default.css
mobile/includes/kindeditor/themes/default/default.png
mobile/includes/kindeditor/themes/qq/editor.gif
mobile/includes/kindeditor/themes/qq/qq.css
mobile/includes/kindeditor/themes/simple/simple.css
mobile/includes/lib.debug.php
mobile/includes/lib_article.php
mobile/includes/lib_base.php
mobile/includes/lib_chat.php
mobile/includes/lib_clips.php
mobile/includes/lib_code.php
mobile/includes/lib_comment.php
mobile/includes/lib_common.php
mobile/includes/lib_compositor.php
mobile/includes/lib_getdata.php
mobile/includes/lib_goods.php
mobile/includes/lib_insert.php
mobile/includes/lib_license.php
mobile/includes/lib_main.php
mobile/includes/lib_order.php
mobile/includes/lib_passport.php
mobile/includes/lib_payment.php
mobile/includes/lib_sms.php
mobile/includes/lib_splitword_www_68ecshop_com.php
mobile/includes/lib_supplier_common.php
mobile/includes/lib_time.php
mobile/includes/lib_transaction.php
mobile/includes/lib_transaction_1.php
mobile/includes/lib_uc.php
mobile/includes/lib_v_user.php
mobile/includes/lib_validate_record.php
mobile/includes/lib_weixintong.php
mobile/includes/modules/convert/shopex46.php
mobile/includes/modules/convert/shopex47.php
mobile/includes/modules/convert/shopex48.php
mobile/includes/modules/cron/auto_manage.php
mobile/includes/modules/cron/ipdel.php
mobile/includes/modules/integrates/discuz55.php
mobile/includes/modules/integrates/dvbbs.php
mobile/includes/modules/integrates/ecshop.php
mobile/includes/modules/integrates/integrate.php
mobile/includes/modules/integrates/phpbb.php
mobile/includes/modules/integrates/phpwind6.php
mobile/includes/modules/integrates/ucenter.php
mobile/includes/modules/integrates/vbb.php
mobile/includes/modules/payment/alipay.php
mobile/includes/modules/payment/balance.php
mobile/includes/modules/payment/bank.php
mobile/includes/modules/payment/cod.php
mobile/includes/modules/payment/unionpay.php
mobile/includes/modules/payment/unionpay/PM_700000000000001_acp.pfx
mobile/includes/modules/payment/unionpay/SDKConfig.php
mobile/includes/modules/payment/weixin.php
mobile/includes/modules/payment/weixin/SDKRuntimeException.php
mobile/includes/modules/payment/weixin/WxPayPubHelper.php
mobile/includes/modules/payment/wxpay/WxPay.Api.php
mobile/includes/modules/payment/wxpay/WxPay.Config.php
mobile/includes/modules/payment/wxpay/WxPay.Data.php
mobile/includes/modules/payment/wxpay/WxPay.Exception.php
mobile/includes/modules/payment/wxpay/WxPay.JsApiPay.php
mobile/includes/modules/payment/wxpay/WxPay.Notify.php
mobile/includes/modules/payment/wxpay/WxPay.PayNotifyCallBack.php
mobile/includes/modules/payment/wxpay/cert/apiclient_cert.pem
mobile/includes/modules/payment/wxpay/cert/apiclient_key.pem
mobile/includes/modules/payment/wxpay/log.php
mobile/includes/modules/payment/wxpay/logs/2017-09-12.log
mobile/includes/modules/payment/wxpay_h5.php
mobile/includes/modules/shipping/bestex.php
mobile/includes/modules/shipping/cac.php
mobile/includes/modules/shipping/city_express.php
mobile/includes/modules/shipping/deppon.php
mobile/includes/modules/shipping/ems.php
mobile/includes/modules/shipping/flat.php
mobile/includes/modules/shipping/fpd.php
mobile/includes/modules/shipping/post_express.php
mobile/includes/modules/shipping/post_mail.php
mobile/includes/modules/shipping/presswork.php
mobile/includes/modules/shipping/qfkd.php
mobile/includes/modules/shipping/sf_express.php
mobile/includes/modules/shipping/sto_express.php
mobile/includes/modules/shipping/ttkd.php
mobile/includes/modules/shipping/yd_express.php
mobile/includes/modules/shipping/yto.php
mobile/includes/modules/shipping/zjs.php
mobile/includes/modules/shipping/zto.php
mobile/includes/patch/includes_admin_template_restore_backup.php
mobile/includes/patch/includes_cls_template_fetch_str.php
mobile/includes/patch/includes_cls_template_get_val.php
mobile/includes/patch/includes_cls_template_select.php
mobile/includes/patch/includes_cls_template_smarty_prefilter_preCompile.php
mobile/includes/patch/includes_lib.debug_pre.php
mobile/includes/phpqrcode.php
mobile/includes/prince/lib_common.php
mobile/includes/prince/pintuan.php
mobile/includes/shopex_json.php
mobile/includes/website/alipay.php
mobile/includes/website/cls_http.php
mobile/includes/website/jntoo.php
mobile/includes/website/oath2.class.php
mobile/includes/website/qq.php
mobile/includes/website/tb_callback.php
mobile/includes/website/tb_index.php
mobile/includes/website/weibo.php
mobile/index.php
mobile/index_bestgoods.php
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/lang/en.js
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/lang/zh-cn.js
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/lang/zh-tw.js
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/readme.txt
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/skin/WdatePicker.css
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/skin/datePicker.gif
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/skin/default/datepicker.css
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/skin/default/img.gif
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/skin/whyGreen/bg.jpg
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/skin/whyGreen/datepicker.css
mobile/js/My97DatePicker/#U5f00#U53d1#U5305/skin/whyGreen/img.gif
mobile/js/My97DatePicker/My97DatePicker.htm
mobile/js/My97DatePicker/WdatePicker.js
mobile/js/My97DatePicker/calendar.js
mobile/js/My97DatePicker/config.js
mobile/js/My97DatePicker/lang/en.js
mobile/js/My97DatePicker/lang/zh-cn.js
mobile/js/My97DatePicker/lang/zh-tw.js
mobile/js/My97DatePicker/skin/WdatePicker.css
mobile/js/My97DatePicker/skin/datePicker.gif
mobile/js/My97DatePicker/skin/default/datepicker.css
mobile/js/My97DatePicker/skin/default/img.gif
mobile/js/My97DatePicker/skin/whyGreen/bg.jpg
mobile/js/My97DatePicker/skin/whyGreen/datepicker.css
mobile/js/My97DatePicker/skin/whyGreen/img.gif
mobile/js/auto_complete.js
mobile/js/calendar.php
mobile/js/calendar/active-bg.gif
mobile/js/calendar/calendar.css
mobile/js/calendar/calendar.js
mobile/js/calendar/dark-bg.gif
mobile/js/calendar/hover-bg.gif
mobile/js/calendar/menuarrow.gif
mobile/js/calendar/normal-bg.gif
mobile/js/calendar/rowhover-bg.gif
mobile/js/calendar/status-bg.gif
mobile/js/calendar/title-bg.gif
mobile/js/chat/b64.js
mobile/js/chat/chat.js
mobile/js/chat/md5.js
mobile/js/chat/sha1.js
mobile/js/chat/strophe.js
mobile/js/chat/webchat.js
mobile/js/common.js
mobile/js/compare.js
mobile/js/global.js
mobile/js/helpmenu.js
mobile/js/index.js
mobile/js/jquery-1.6.2.min.js
mobile/js/jquery.easing.1.3.js
mobile/js/jquery.json.js
mobile/js/jquery.min.js
mobile/js/jquery.more.js
mobile/js/jquery_email.js
mobile/js/lefttime.js
mobile/js/myship.js
mobile/js/order_pickpoint.js
mobile/js/region.js
mobile/js/register.js
mobile/js/script.js
mobile/js/shopping_flow.js
mobile/js/showdiv.js
mobile/js/tagbox.js
mobile/js/transport.js
mobile/js/transport.org.js
mobile/js/user.js
mobile/js/utils.js
mobile/kuaidi/kuaidi.php
mobile/kuaidi_list.php
mobile/languages/zh_cn/admin/account_log.php
mobile/languages/zh_cn/admin/admin_logs.php
mobile/languages/zh_cn/admin/ads.php
mobile/languages/zh_cn/admin/affiliate.php
mobile/languages/zh_cn/admin/affiliate_ck.php
mobile/languages/zh_cn/admin/agency.php
mobile/languages/zh_cn/admin/area_manage.php
mobile/languages/zh_cn/admin/article.php
mobile/languages/zh_cn/admin/article_auto.php
mobile/languages/zh_cn/admin/articlecat.php
mobile/languages/zh_cn/admin/attention_list.php
mobile/languages/zh_cn/admin/attribute.php
mobile/languages/zh_cn/admin/auction.php
mobile/languages/zh_cn/admin/bonus.php
mobile/languages/zh_cn/admin/brand.php
mobile/languages/zh_cn/admin/captcha_manage.php
mobile/languages/zh_cn/admin/card.php
mobile/languages/zh_cn/admin/category.php
mobile/languages/zh_cn/admin/check_file_priv.php
mobile/languages/zh_cn/admin/cloud.php
mobile/languages/zh_cn/admin/comment_manage.php
mobile/languages/zh_cn/admin/common.php
mobile/languages/zh_cn/admin/convert.php
mobile/languages/zh_cn/admin/cron.php
mobile/languages/zh_cn/admin/database.php
mobile/languages/zh_cn/admin/distrib_goods.php
mobile/languages/zh_cn/admin/distrib_order.php
mobile/languages/zh_cn/admin/distributor.php
mobile/languages/zh_cn/admin/ebao_commend.php
mobile/languages/zh_cn/admin/edit_languages.php
mobile/languages/zh_cn/admin/email_list.php
mobile/languages/zh_cn/admin/exchange_goods.php
mobile/languages/zh_cn/admin/favourable.php
mobile/languages/zh_cn/admin/fckfile_manage.php
mobile/languages/zh_cn/admin/filecheck.php
mobile/languages/zh_cn/admin/flashplay.php
mobile/languages/zh_cn/admin/flow_stats.php
mobile/languages/zh_cn/admin/friend_link.php
mobile/languages/zh_cn/admin/gen_goods_script.php
mobile/languages/zh_cn/admin/get_password.php
mobile/languages/zh_cn/admin/goods.php
mobile/languages/zh_cn/admin/goods_auto.php
mobile/languages/zh_cn/admin/goods_batch.php
mobile/languages/zh_cn/admin/goods_booking.php
mobile/languages/zh_cn/admin/goods_export.php
mobile/languages/zh_cn/admin/goods_type.php
mobile/languages/zh_cn/admin/group_buy.php
mobile/languages/zh_cn/admin/index.php
mobile/languages/zh_cn/admin/integrate.php
mobile/languages/zh_cn/admin/license.php
mobile/languages/zh_cn/admin/log_action.php
mobile/languages/zh_cn/admin/magazine_list.php
mobile/languages/zh_cn/admin/mail_template.php
mobile/languages/zh_cn/admin/message.php
mobile/languages/zh_cn/admin/navigator.php
mobile/languages/zh_cn/admin/order.php
mobile/languages/zh_cn/admin/pack.php
mobile/languages/zh_cn/admin/package.php
mobile/languages/zh_cn/admin/payment.php
mobile/languages/zh_cn/admin/picture_batch.php
mobile/languages/zh_cn/admin/pintuan.php
mobile/languages/zh_cn/admin/plugins.php
mobile/languages/zh_cn/admin/priv_action.php
mobile/languages/zh_cn/admin/privilege.php
mobile/languages/zh_cn/admin/reg_fields.php
mobile/languages/zh_cn/admin/repay.php
mobile/languages/zh_cn/admin/role.php
mobile/languages/zh_cn/admin/search_log.php
mobile/languages/zh_cn/admin/shipping.php
mobile/languages/zh_cn/admin/shipping_area.php
mobile/languages/zh_cn/admin/shop_config.php
mobile/languages/zh_cn/admin/shophelp.php
mobile/languages/zh_cn/admin/shopinfo.php
mobile/languages/zh_cn/admin/sitemap.php
mobile/languages/zh_cn/admin/sms.php
mobile/languages/zh_cn/admin/snatch.php
mobile/languages/zh_cn/admin/sql.php
mobile/languages/zh_cn/admin/statistic.php
mobile/languages/zh_cn/admin/suppliers.php
mobile/languages/zh_cn/admin/suppliers_goods.php
mobile/languages/zh_cn/admin/tag_manage.php
mobile/languages/zh_cn/admin/template.php
mobile/languages/zh_cn/admin/topic.php
mobile/languages/zh_cn/admin/user_account.php
mobile/languages/zh_cn/admin/user_account_manage.php
mobile/languages/zh_cn/admin/user_grade.php
mobile/languages/zh_cn/admin/user_msg.php
mobile/languages/zh_cn/admin/user_rank.php
mobile/languages/zh_cn/admin/users.php
mobile/languages/zh_cn/admin/view_sendlist.php
mobile/languages/zh_cn/admin/virtual_card.php
mobile/languages/zh_cn/admin/vote.php
mobile/languages/zh_cn/admin/webcollect.php
mobile/languages/zh_cn/admin/website.php
mobile/languages/zh_cn/admin/wholesale.php
mobile/languages/zh_cn/calendar.php
mobile/languages/zh_cn/common.php
mobile/languages/zh_cn/convert/shopex46.php
mobile/languages/zh_cn/convert/shopex47.php
mobile/languages/zh_cn/convert/shopex48.php
mobile/languages/zh_cn/cron/auto_manage.php
mobile/languages/zh_cn/cron/ipdel.php
mobile/languages/zh_cn/demo.php
mobile/languages/zh_cn/payment/alipay.php
mobile/languages/zh_cn/payment/balance.php
mobile/languages/zh_cn/payment/bank.php
mobile/languages/zh_cn/payment/cappay.php
mobile/languages/zh_cn/payment/chinabank.php
mobile/languages/zh_cn/payment/cncard.php
mobile/languages/zh_cn/payment/cod.php
mobile/languages/zh_cn/payment/express.php
mobile/languages/zh_cn/payment/ips.php
mobile/languages/zh_cn/payment/kuaiqian.php
mobile/languages/zh_cn/payment/paypal.php
mobile/languages/zh_cn/payment/paypal_ec.php
mobile/languages/zh_cn/payment/post.php
mobile/languages/zh_cn/payment/shenzhou.php
mobile/languages/zh_cn/payment/tenpay.php
mobile/languages/zh_cn/payment/tenpayc2c.php
mobile/languages/zh_cn/payment/udpay.php
mobile/languages/zh_cn/payment/unionpay.php
mobile/languages/zh_cn/payment/weixin.php
mobile/languages/zh_cn/payment/wxpay_h5.php
mobile/languages/zh_cn/payment/yeepayszx.php
mobile/languages/zh_cn/shipping/bestex.php
mobile/languages/zh_cn/shipping/cac.php
mobile/languages/zh_cn/shipping/city_express.php
mobile/languages/zh_cn/shipping/deppon.php
mobile/languages/zh_cn/shipping/ems.php
mobile/languages/zh_cn/shipping/flat.php
mobile/languages/zh_cn/shipping/fpd.php
mobile/languages/zh_cn/shipping/post_express.php
mobile/languages/zh_cn/shipping/post_mail.php
mobile/languages/zh_cn/shipping/presswork.php
mobile/languages/zh_cn/shipping/qfkd.php
mobile/languages/zh_cn/shipping/sf_express.php
mobile/languages/zh_cn/shipping/sto_express.php
mobile/languages/zh_cn/shipping/ttkd.php
mobile/languages/zh_cn/shipping/yd_express.php
mobile/languages/zh_cn/shipping/yto.php
mobile/languages/zh_cn/shipping/zjs.php
mobile/languages/zh_cn/shipping/zto.php
mobile/languages/zh_cn/shopping_flow.php
mobile/languages/zh_cn/user.php
mobile/login.php
mobile/map.php
mobile/message.php
mobile/mobile-setting.php
mobile/myship.php
mobile/order.php
mobile/package.php
mobile/pay/ajax_url.php
mobile/pay/alipay.config.php
mobile/pay/alipayapi.php
mobile/pay/cacert.pem
mobile/pay/images/alipay.gif
mobile/pay/images/new-btn-fixed.png
mobile/pay/includes/cls_exchange.php
mobile/pay/includes/cls_google_sitemap.php
mobile/pay/includes/cls_phpzip.php
mobile/pay/includes/cls_sql_dump.php
mobile/pay/includes/inc_menu.php
mobile/pay/includes/inc_priv.php
mobile/pay/includes/init.php
mobile/pay/includes/lib_goods.php
mobile/pay/includes/lib_main.php
mobile/pay/includes/lib_template.php
mobile/pay/index.php
mobile/pay/lib/alipay_core.function.php
mobile/pay/lib/alipay_md5.function.php
mobile/pay/lib/alipay_notify.class.php
mobile/pay/lib/alipay_rsa.function.php
mobile/pay/lib/alipay_submit.class.php
mobile/pay/log.txt
mobile/pay/pay.php
mobile/pay/readme.txt
mobile/pay/result_url.php
mobile/pick_out.php
mobile/pintuan.php
mobile/pm.php
mobile/pocking.php
mobile/pre_sale.php
mobile/pro_mobile.php
mobile/pro_search.php
mobile/qrcode.png
mobile/quotation.php
mobile/receive.php
mobile/region.php
mobile/register.php
mobile/respond.php
mobile/robots.txt
mobile/search.php
mobile/searchindex.php
mobile/security.php
mobile/send.php
mobile/share.php
mobile/share_goods.php
mobile/sitemaps.php
mobile/sms.php
mobile/sms/sms.js
mobile/sms/sms.php
mobile/snatch.php
mobile/sound/msg.wav
mobile/sound/notice.wav
mobile/store/css/dianpu.css
mobile/store/images/1.jpg
mobile/store/images/arrow_left.png
mobile/store/images/erweima.jpg
mobile/store/images/guanzhu.png
mobile/store/images/icon1.png
mobile/store/images/icon10.png
mobile/store/images/icon11.png
mobile/store/images/icon12.png
mobile/store/images/icon13.png
mobile/store/images/icon14.png
mobile/store/images/icon15.png
mobile/store/images/icon16.png
mobile/store/images/icon18.png
mobile/store/images/icon19.png
mobile/store/images/icon2.png
mobile/store/images/icon20.png
mobile/store/images/icon21.png
mobile/store/images/icon22.png
mobile/store/images/icon23.png
mobile/store/images/icon24.png
mobile/store/images/icon3.png
mobile/store/images/icon31.png
mobile/store/images/icon34.png
mobile/store/images/icon4.png
mobile/store/images/icon5.png
mobile/store/images/icon6.png
mobile/store/images/icon7.png
mobile/store/images/icon8.png
mobile/store/images/icon9.png
mobile/store/images/icon_logo2.png
mobile/store/images/pub_goods.png
mobile/store/images/pub_main.png
mobile/store/images/search.png
mobile/store/images/stars1.png
mobile/store/images/stars2.png
mobile/store/images/top.png
mobile/store/js/category.js
mobile/store/js/jquery.nicescroll.min.js
mobile/store/js/run_common-min.js
mobile/stores.php
mobile/supplier.php
mobile/supplier.png
mobile/supplier/back.php
mobile/supplier/data/captcha/captcha_bg1.gif
mobile/supplier/data/captcha/captcha_bg1.jpg
mobile/supplier/data/captcha/captcha_bg2.gif
mobile/supplier/data/captcha/captcha_bg2.jpg
mobile/supplier/data/captcha/captcha_bg3.gif
mobile/supplier/data/captcha/captcha_bg3.jpg
mobile/supplier/data/captcha/captcha_bg4.gif
mobile/supplier/data/captcha/captcha_bg4.jpg
mobile/supplier/data/captcha/captcha_bg5.gif
mobile/supplier/data/captcha/captcha_bg5.jpg
mobile/supplier/data/config.php
mobile/supplier/goods_stock.php
mobile/supplier/images/alert_error_icon.png
mobile/supplier/images/alert_normal_icon.png
mobile/supplier/images/arrow_down.png
mobile/supplier/images/back.png
mobile/supplier/images/bt_ico1b.png
mobile/supplier/images/bufenfahuo.png
mobile/supplier/images/bus_icon_128.png
mobile/supplier/images/c_checkbox_off.png
mobile/supplier/images/c_checkbox_on.png
mobile/supplier/images/car_icon_128.png
mobile/supplier/images/check.png
mobile/supplier/images/clear.png
mobile/supplier/images/close.png
mobile/supplier/images/delete_icon_16.png
mobile/supplier/images/dianpu.png
mobile/supplier/images/dingdanicon.png
mobile/supplier/images/email_icon.png
mobile/supplier/images/fahuo.png
mobile/supplier/images/fahuo_list.png
mobile/supplier/images/fahuo_will.png
mobile/supplier/images/icon_radio.png
mobile/supplier/images/index.png
mobile/supplier/images/indexbg.jpg
mobile/supplier/images/joe_03.png
mobile/supplier/images/location.png
mobile/supplier/images/logo.png
mobile/supplier/images/logo1.png
mobile/supplier/images/logoff_icon.png
mobile/supplier/images/menu_list_icon.png
mobile/supplier/images/n1.png
mobile/supplier/images/n2.png
mobile/supplier/images/n3.png
mobile/supplier/images/n4.png
mobile/supplier/images/n5.png
mobile/supplier/images/n6.png
mobile/supplier/images/order_search.png
mobile/supplier/images/orderbg.png
mobile/supplier/images/phone.png
mobile/supplier/images/pwd.gif
mobile/supplier/images/pwd.png
mobile/supplier/images/quehuo.png
mobile/supplier/images/search.png
mobile/supplier/images/sys_error_msg_icon.png
mobile/supplier/images/sys_normal_msg_icon.png
mobile/supplier/images/sys_question_msg_icon.png
mobile/supplier/images/toTop.png
mobile/supplier/images/tuichuicon.png
mobile/supplier/images/tuihuo.png
mobile/supplier/images/tuihuo_new.png
mobile/supplier/images/tuikuan.png
mobile/supplier/images/tuikuan_new.png
mobile/supplier/images/user.gif
mobile/supplier/images/user.png
mobile/supplier/images/user_icon.png
mobile/supplier/images/user_right.png
mobile/supplier/images/walk_icon_128.png
mobile/supplier/images/x_icon.png
mobile/supplier/images/xiala.gif
mobile/supplier/images/xiala.png
mobile/supplier/images/xiala_up.gif
mobile/supplier/images/xiala_up.png
mobile/supplier/images/yongjinicon.png
mobile/supplier/images/zhifu_will.png
mobile/supplier/includes/cls_captcha.php
mobile/supplier/includes/cls_ecshop.php
mobile/supplier/includes/cls_error.php
mobile/supplier/includes/cls_exchange.php
mobile/supplier/includes/cls_iconv.php
mobile/supplier/includes/cls_image.php
mobile/supplier/includes/cls_json.php
mobile/supplier/includes/cls_mysql.php
mobile/supplier/includes/cls_session.php
mobile/supplier/includes/cls_smtp.php
mobile/supplier/includes/cls_template.php
mobile/supplier/includes/cls_transport.php
mobile/supplier/includes/inc_constant.php
mobile/supplier/includes/init.php
mobile/supplier/includes/lib.debug.php
mobile/supplier/includes/lib_base.php
mobile/supplier/includes/lib_common.php
mobile/supplier/includes/lib_goods.php
mobile/supplier/includes/lib_main.php
mobile/supplier/includes/lib_order.php
mobile/supplier/includes/lib_rebate.php
mobile/supplier/includes/lib_supplier_common.php
mobile/supplier/includes/lib_supplier_common_wap.php
mobile/supplier/includes/lib_time.php
mobile/supplier/includes/modules/shipping/bestex.php
mobile/supplier/includes/modules/shipping/cac.php
mobile/supplier/includes/modules/shipping/city_express.php
mobile/supplier/includes/modules/shipping/deppon.php
mobile/supplier/includes/modules/shipping/ems.php
mobile/supplier/includes/modules/shipping/flat.php
mobile/supplier/includes/modules/shipping/fpd.php
mobile/supplier/includes/modules/shipping/post_express.php
mobile/supplier/includes/modules/shipping/post_mail.php
mobile/supplier/includes/modules/shipping/presswork.php
mobile/supplier/includes/modules/shipping/qfkd.php
mobile/supplier/includes/modules/shipping/sf_express.php
mobile/supplier/includes/modules/shipping/sto_express.php
mobile/supplier/includes/modules/shipping/ttkd.php
mobile/supplier/includes/modules/shipping/yd_express.php
mobile/supplier/includes/modules/shipping/yto.php
mobile/supplier/includes/modules/shipping/zjs.php
mobile/supplier/includes/modules/shipping/zto.php
mobile/supplier/index.php
mobile/supplier/js/fx.js
mobile/supplier/js/fx_methods.js
mobile/supplier/js/intimidatetime.js
mobile/supplier/js/intimidatetime.zh_CN.js
mobile/supplier/js/main.js
mobile/supplier/js/mobile.js
mobile/supplier/js/region.js
mobile/supplier/js/touch.js
mobile/supplier/js/zalert.js
mobile/supplier/js/zcontent.js
mobile/supplier/js/zepto.min.js
mobile/supplier/js/zextra_methods.js
mobile/supplier/js/znavi.js
mobile/supplier/js/zprogress.js
mobile/supplier/js/zscroll.js
mobile/supplier/js/zscrolltotop.js
mobile/supplier/languages/zh_cn/admin/shipping.php
mobile/supplier/languages/zh_cn/back.php
mobile/supplier/languages/zh_cn/common.php
mobile/supplier/languages/zh_cn/log_action.php
mobile/supplier/languages/zh_cn/order.php
mobile/supplier/languages/zh_cn/supplier_order.php
mobile/supplier/languages/zh_cn/user_msg.php
mobile/supplier/navigate.php
mobile/supplier/order.php
mobile/supplier/privilege.php
mobile/supplier/region.php
mobile/supplier/styles/intimidatetime.css
mobile/supplier/styles/main.css
mobile/supplier/styles/zalert.css
mobile/supplier/styles/zprogress.css
mobile/supplier/styles/zscrolltotop.css
mobile/supplier/supplier_order.php
mobile/supplier/supplier_rebate.php
mobile/supplier/temp/compiled/back_info.htm.php
mobile/supplier/temp/compiled/back_list.htm.php
mobile/supplier/temp/compiled/back_refund.htm.php
mobile/supplier/temp/compiled/delivery_info.htm.php
mobile/supplier/temp/compiled/delivery_list.htm.php
mobile/supplier/temp/compiled/get_password.htm.php
mobile/supplier/temp/compiled/goods_stock_list.htm.php
mobile/supplier/temp/compiled/html_header.htm.php
mobile/supplier/temp/compiled/index.htm.php
mobile/supplier/temp/compiled/login.htm.php
mobile/supplier/temp/compiled/menu_list.htm.php
mobile/supplier/temp/compiled/message.htm.php
mobile/supplier/temp/compiled/msg_add.htm.php
mobile/supplier/temp/compiled/navigate.htm.php
mobile/supplier/temp/compiled/order_delivery_info.htm.php
mobile/supplier/temp/compiled/order_info.htm.php
mobile/supplier/temp/compiled/order_list.htm.php
mobile/supplier/temp/compiled/order_menu_list.htm.php
mobile/supplier/temp/compiled/order_operate.htm.php
mobile/supplier/temp/compiled/order_step.htm.php
mobile/supplier/temp/compiled/page.htm.php
mobile/supplier/temp/compiled/page_footer.htm.php
mobile/supplier/temp/compiled/page_header.htm.php
mobile/supplier/temp/compiled/page_header_index.htm.php
mobile/supplier/temp/compiled/static_div.htm.php
mobile/supplier/temp/compiled/supplier_rebate_list.htm.php
mobile/supplier/temp/static_caches/shop_config.php
mobile/supplier/temp/static_caches/supplier_shop_config1.php
mobile/supplier/temp/static_caches/supplier_shop_config2.php
mobile/supplier/temp/static_caches/supplier_shop_config5.php
mobile/supplier/templates/back_info.htm
mobile/supplier/templates/back_list.htm
mobile/supplier/templates/back_refund.htm
mobile/supplier/templates/delivery_info.htm
mobile/supplier/templates/delivery_list.htm
mobile/supplier/templates/get_password.htm
mobile/supplier/templates/goods_stock_list.htm
mobile/supplier/templates/html_header.htm
mobile/supplier/templates/index.htm
mobile/supplier/templates/login.htm
mobile/supplier/templates/menu_list.htm
mobile/supplier/templates/message.htm
mobile/supplier/templates/msg_add.htm
mobile/supplier/templates/navigate.htm
mobile/supplier/templates/order_delivery_info.htm
mobile/supplier/templates/order_info.htm
mobile/supplier/templates/order_list.htm
mobile/supplier/templates/order_menu_list.htm
mobile/supplier/templates/order_operate.htm
mobile/supplier/templates/order_refund.htm
mobile/supplier/templates/order_status_list.htm
mobile/supplier/templates/order_step.htm
mobile/supplier/templates/page.htm
mobile/supplier/templates/page_footer.htm
mobile/supplier/templates/page_header.htm
mobile/supplier/templates/page_header_index.htm
mobile/supplier/templates/static_div.htm
mobile/supplier/templates/supplier_rebate_info.htm
mobile/supplier/templates/supplier_rebate_list.htm
mobile/supplier/templates/supplier_rebate_view.htm
mobile/supplier/user.php
mobile/supplier/user_msg.php
mobile/supplier_about.php
mobile/supplier_activity.php
mobile/supplier_article.php
mobile/supplier_catalog.php
mobile/supplier_category.php
mobile/supplier_index.php
mobile/supplier_near.php
mobile/supplier_other.php
mobile/supplier_reg.php
mobile/supplier_search.php
mobile/tag_cloud.php
mobile/temp/backup/index.htm
mobile/temp/caches/e/freegoods_4094488E.php
mobile/temp/caches/f/index_40F756F0.php
mobile/temp/compiled/ad_position.lbi.php
mobile/temp/compiled/admin/index.htm.php
mobile/temp/compiled/admin/login.htm.php
mobile/temp/compiled/admin/menu.htm.php
mobile/temp/compiled/admin/pagefooter.htm.php
mobile/temp/compiled/admin/pageheader.htm.php
mobile/temp/compiled/admin/start.htm.php
mobile/temp/compiled/admin/top.htm.php
mobile/temp/compiled/brands.lbi.php
mobile/temp/compiled/cat_articles.lbi.php
mobile/temp/compiled/cat_goods.lbi.php
mobile/temp/compiled/footer_nav.lbi.php
mobile/temp/compiled/freegoods.dwt.php
mobile/temp/compiled/index.dwt.php
mobile/temp/compiled/index.htm
mobile/temp/compiled/index_ad.lbi.php
mobile/temp/compiled/index_best_goods_2.lbi.php
mobile/temp/compiled/index_icon.lbi.php
mobile/temp/compiled/page_header.lbi.php
mobile/temp/compiled/recommend_hot.lbi.php
mobile/temp/compiled/recommend_new.lbi.php
mobile/temp/compiled/recommend_promotion.lbi.php
mobile/temp/compiled/share.lbi.php
mobile/temp/compiled/supplier/article_list.htm.php
mobile/temp/compiled/supplier/auction_info.htm.php
mobile/temp/compiled/supplier/auction_list.htm.php
mobile/temp/compiled/supplier/back_list_2.htm.php
mobile/temp/compiled/supplier/bonus_by_user.htm.php
mobile/temp/compiled/supplier/bonus_list.htm.php
mobile/temp/compiled/supplier/bonus_type.htm.php
mobile/temp/compiled/supplier/bonus_type_info.htm.php
mobile/temp/compiled/supplier/booking_list.htm.php
mobile/temp/compiled/supplier/category_info.htm.php
mobile/temp/compiled/supplier/category_list.htm.php
mobile/temp/compiled/supplier/category_search.htm.php
mobile/temp/compiled/supplier/comment_list.htm.php
mobile/temp/compiled/supplier/customer_info.htm.php
mobile/temp/compiled/supplier/customer_list.htm.php
mobile/temp/compiled/supplier/delivery_list.htm.php
mobile/temp/compiled/supplier/drag.htm.php
mobile/temp/compiled/supplier/excel.htm.php
mobile/temp/compiled/supplier/favourable_info.htm.php
mobile/temp/compiled/supplier/favourable_list.htm.php
mobile/temp/compiled/supplier/flashplay_add.htm.php
mobile/temp/compiled/supplier/flashplay_list.htm.php
mobile/temp/compiled/supplier/get_pwd.htm.php
mobile/temp/compiled/supplier/gettaobaogoods.html.php
mobile/temp/compiled/supplier/goods_info.htm.php
mobile/temp/compiled/supplier/goods_list.htm.php
mobile/temp/compiled/supplier/goods_search.htm.php
mobile/temp/compiled/supplier/goods_sell_detail.htm.php
mobile/temp/compiled/supplier/goods_stats.htm.php
mobile/temp/compiled/supplier/goods_trash.htm.php
mobile/temp/compiled/supplier/index.htm.php
mobile/temp/compiled/supplier/login.htm.php
mobile/temp/compiled/supplier/menu.htm.php
mobile/temp/compiled/supplier/merge_order.htm.php
mobile/temp/compiled/supplier/message.htm.php
mobile/temp/compiled/supplier/navigator.htm.php
mobile/temp/compiled/supplier/order_comment_list.htm.php
mobile/temp/compiled/supplier/order_goods_info.htm.php
mobile/temp/compiled/supplier/order_info.htm.php
mobile/temp/compiled/supplier/order_list.htm.php
mobile/temp/compiled/supplier/order_print.html.php
mobile/temp/compiled/supplier/order_query.htm.php
mobile/temp/compiled/supplier/order_stats.htm.php
mobile/temp/compiled/supplier/order_templates.htm.php
mobile/temp/compiled/supplier/page.htm.php
mobile/temp/compiled/supplier/pagefooter.htm.php
mobile/temp/compiled/supplier/pageheader.htm.php
mobile/temp/compiled/supplier/pageheader_bd.htm.php
mobile/temp/compiled/supplier/pickup_point_batch_add.htm.php
mobile/temp/compiled/supplier/pickup_point_info.htm.php
mobile/temp/compiled/supplier/pickup_point_list.htm.php
mobile/temp/compiled/supplier/pre_sale_info.htm.php
mobile/temp/compiled/supplier/pre_sale_list.htm.php
mobile/temp/compiled/supplier/print_index.htm.php
mobile/temp/compiled/supplier/privilege_allot.htm.php
mobile/temp/compiled/supplier/privilege_info.htm.php
mobile/temp/compiled/supplier/privilege_list.htm.php
mobile/temp/compiled/supplier/refund_stats.htm.php
mobile/temp/compiled/supplier/sell_stats.htm.php
mobile/temp/compiled/supplier/shaidan_list.htm.php
mobile/temp/compiled/supplier/shaidan_search.htm.php
mobile/temp/compiled/supplier/shipping_area_info.htm.php
mobile/temp/compiled/supplier/shipping_area_list.htm.php
mobile/temp/compiled/supplier/shipping_list.htm.php
mobile/temp/compiled/supplier/shipping_template.htm.php
mobile/temp/compiled/supplier/shop_config.htm.php
mobile/temp/compiled/supplier/shop_config_form.htm.php
mobile/temp/compiled/supplier/shop_header.htm.php
mobile/temp/compiled/supplier/start.htm.php
mobile/temp/compiled/supplier/street_info.htm.php
mobile/temp/compiled/supplier/supplier_rebate_info.htm.php
mobile/temp/compiled/supplier/templates_list.htm.php
mobile/temp/compiled/supplier/third_customer_info.htm.php
mobile/temp/compiled/supplier/third_customer_list.htm.php
mobile/temp/compiled/supplier/top.htm.php
mobile/temp/compiled/supplier/virtual_goods_card_list.htm.php
mobile/temp/compiled/supplier/virtual_goods_info.htm.php
mobile/temp/compiled/supplier/virtual_goods_list.htm.php
mobile/temp/compiled/supplier/virtual_goods_search.htm.php
mobile/temp/compiled/supplier/virtual_validate.htm.php
mobile/temp/compiled/user_passport.dwt.php
mobile/temp/index.htm
mobile/temp/query_caches/index.htm
mobile/temp/query_caches/sqlcache_config_file_dae8ab5a1f0dde399eb31c9de5cfaffb.php
mobile/temp/static_caches/api_str.php
mobile/temp/static_caches/art_cat_pid_releate.php
mobile/temp/static_caches/cat_option_static.php
mobile/temp/static_caches/cat_pid_releate.php
mobile/temp/static_caches/index.htm
mobile/temp/static_caches/recommend_goods.php
mobile/temp/static_caches/shop_config.php
mobile/templates/article.html
mobile/templates/article_list.html
mobile/templates/brands.html
mobile/templates/buy.html
mobile/templates/cat_all.html
mobile/templates/category.html
mobile/templates/comment.html
mobile/templates/goods.html
mobile/templates/goods_img.html
mobile/templates/goods_list.html
mobile/templates/index.html
mobile/templates/login.html
mobile/templates/order.html
mobile/templates/order_done.html
mobile/templates/order_list.html
mobile/templates/search.html
mobile/templates/user.html
mobile/templates/user_passport.html
mobile/themesmobile/68ecshopcom_mobile/activity.dwt
mobile/themesmobile/68ecshopcom_mobile/article.dwt
mobile/themesmobile/68ecshopcom_mobile/article_cat.dwt
mobile/themesmobile/68ecshopcom_mobile/article_cat_list.dwt
mobile/themesmobile/68ecshopcom_mobile/article_pro.dwt
mobile/themesmobile/68ecshopcom_mobile/auction.dwt
mobile/themesmobile/68ecshopcom_mobile/auction_list.dwt
mobile/themesmobile/68ecshopcom_mobile/boot/css/bootstrap-theme.css
mobile/themesmobile/68ecshopcom_mobile/boot/css/bootstrap-theme.min.css
mobile/themesmobile/68ecshopcom_mobile/boot/css/bootstrap.css
mobile/themesmobile/68ecshopcom_mobile/boot/css/bootstrap.min.css
mobile/themesmobile/68ecshopcom_mobile/boot/css/style.css
mobile/themesmobile/68ecshopcom_mobile/boot/fonts/glyphicons-halflings-regular.eot
mobile/themesmobile/68ecshopcom_mobile/boot/fonts/glyphicons-halflings-regular.svg
mobile/themesmobile/68ecshopcom_mobile/boot/fonts/glyphicons-halflings-regular.ttf
mobile/themesmobile/68ecshopcom_mobile/boot/fonts/glyphicons-halflings-regular.woff
mobile/themesmobile/68ecshopcom_mobile/boot/js/bootstrap.js
mobile/themesmobile/68ecshopcom_mobile/boot/js/bootstrap.min.js
mobile/themesmobile/68ecshopcom_mobile/boot/js/jquery-1.9.0.js
mobile/themesmobile/68ecshopcom_mobile/brand.dwt
mobile/themesmobile/68ecshopcom_mobile/brand_list.dwt
mobile/themesmobile/68ecshopcom_mobile/catalog.dwt
mobile/themesmobile/68ecshopcom_mobile/category.dwt
mobile/themesmobile/68ecshopcom_mobile/chat.dwt
mobile/themesmobile/68ecshopcom_mobile/combo.js
mobile/themesmobile/68ecshopcom_mobile/comment_order.dwt
mobile/themesmobile/68ecshopcom_mobile/compare.dwt
mobile/themesmobile/68ecshopcom_mobile/css/activity.css
mobile/themesmobile/68ecshopcom_mobile/css/app.min.css
mobile/themesmobile/68ecshopcom_mobile/css/article.css
mobile/themesmobile/68ecshopcom_mobile/css/auction.css
mobile/themesmobile/68ecshopcom_mobile/css/auction_goods.css
mobile/themesmobile/68ecshopcom_mobile/css/brand_list.css
mobile/themesmobile/68ecshopcom_mobile/css/catalog.css
mobile/themesmobile/68ecshopcom_mobile/css/category.css
mobile/themesmobile/68ecshopcom_mobile/css/chat.css
mobile/themesmobile/68ecshopcom_mobile/css/ecsmart.css
mobile/themesmobile/68ecshopcom_mobile/css/exchange.css
mobile/themesmobile/68ecshopcom_mobile/css/exshangexin.css
mobile/themesmobile/68ecshopcom_mobile/css/flow.css
mobile/themesmobile/68ecshopcom_mobile/css/global_nav.css
mobile/themesmobile/68ecshopcom_mobile/css/goods.css
mobile/themesmobile/68ecshopcom_mobile/css/group_buy.css
mobile/themesmobile/68ecshopcom_mobile/css/iconfont.eot
mobile/themesmobile/68ecshopcom_mobile/css/iconfont.svg
mobile/themesmobile/68ecshopcom_mobile/css/iconfont.ttf
mobile/themesmobile/68ecshopcom_mobile/css/iconfont.woff
mobile/themesmobile/68ecshopcom_mobile/css/index.css
mobile/themesmobile/68ecshopcom_mobile/css/indexb.css
mobile/themesmobile/68ecshopcom_mobile/css/login.css
mobile/themesmobile/68ecshopcom_mobile/css/loginxin.css
mobile/themesmobile/68ecshopcom_mobile/css/photoswipe.css
mobile/themesmobile/68ecshopcom_mobile/css/pmgoods.css
mobile/themesmobile/68ecshopcom_mobile/css/pmpublic.css
mobile/themesmobile/68ecshopcom_mobile/css/pro_mobile.css
mobile/themesmobile/68ecshopcom_mobile/css/pt_1.css
mobile/themesmobile/68ecshopcom_mobile/css/pt_2.css
mobile/themesmobile/68ecshopcom_mobile/css/public.css
mobile/themesmobile/68ecshopcom_mobile/css/publicb.css
mobile/themesmobile/68ecshopcom_mobile/css/share.css
mobile/themesmobile/68ecshopcom_mobile/css/stores.css
mobile/themesmobile/68ecshopcom_mobile/css/style_jm.css
mobile/themesmobile/68ecshopcom_mobile/css/supplier.css
mobile/themesmobile/68ecshopcom_mobile/css/topic.css
mobile/themesmobile/68ecshopcom_mobile/css/user.css
mobile/themesmobile/68ecshopcom_mobile/css/v_shop.css
mobile/themesmobile/68ecshopcom_mobile/css/v_shop_list.css
mobile/themesmobile/68ecshopcom_mobile/css/v_user.css
mobile/themesmobile/68ecshopcom_mobile/css/vshop_footer.css
mobile/themesmobile/68ecshopcom_mobile/css/weixin.css
mobile/themesmobile/68ecshopcom_mobile/css/ziti.css
mobile/themesmobile/68ecshopcom_mobile/css4/ecsmart.css
mobile/themesmobile/68ecshopcom_mobile/dm299_h5.dwt
mobile/themesmobile/68ecshopcom_mobile/exchange_goods.dwt
mobile/themesmobile/68ecshopcom_mobile/exchange_list.dwt
mobile/themesmobile/68ecshopcom_mobile/flow - #U526f#U672c.dwt
mobile/themesmobile/68ecshopcom_mobile/flow-old.dwt
mobile/themesmobile/68ecshopcom_mobile/flow.dwt
mobile/themesmobile/68ecshopcom_mobile/freegoods.dwt
mobile/themesmobile/68ecshopcom_mobile/functions.php
mobile/themesmobile/68ecshopcom_mobile/gallery.dwt
mobile/themesmobile/68ecshopcom_mobile/goods.dwt
mobile/themesmobile/68ecshopcom_mobile/goods_taocan.dwt
mobile/themesmobile/68ecshopcom_mobile/goods_ziti.dwt
mobile/themesmobile/68ecshopcom_mobile/group_buy_goods.dwt
mobile/themesmobile/68ecshopcom_mobile/group_buy_list.dwt
mobile/themesmobile/68ecshopcom_mobile/images/HOT.png
mobile/themesmobile/68ecshopcom_mobile/images/Headlines.jpg
mobile/themesmobile/68ecshopcom_mobile/images/Thumbs.db
mobile/themesmobile/68ecshopcom_mobile/images/all.png
mobile/themesmobile/68ecshopcom_mobile/images/arrow_down.png
mobile/themesmobile/68ecshopcom_mobile/images/arrow_down_on.png
mobile/themesmobile/68ecshopcom_mobile/images/arrowright.png
mobile/themesmobile/68ecshopcom_mobile/images/brand.jpg
mobile/themesmobile/68ecshopcom_mobile/images/category/arrow_left.png
mobile/themesmobile/68ecshopcom_mobile/images/category/arrow_right.png
mobile/themesmobile/68ecshopcom_mobile/images/category/cangku_select.png
mobile/themesmobile/68ecshopcom_mobile/images/category/cart.png
mobile/themesmobile/68ecshopcom_mobile/images/category/cbx1.png
mobile/themesmobile/68ecshopcom_mobile/images/category/cbx2.png
mobile/themesmobile/68ecshopcom_mobile/images/category/close.png
mobile/themesmobile/68ecshopcom_mobile/images/category/close_div.png
mobile/themesmobile/68ecshopcom_mobile/images/category/fenlei_right.png
mobile/themesmobile/68ecshopcom_mobile/images/category/fenlei_shang.png
mobile/themesmobile/68ecshopcom_mobile/images/category/fenlei_xia.png
mobile/themesmobile/68ecshopcom_mobile/images/category/goods_fenge.png
mobile/themesmobile/68ecshopcom_mobile/images/category/gride.png
mobile/themesmobile/68ecshopcom_mobile/images/category/list.png
mobile/themesmobile/68ecshopcom_mobile/images/category/list_tab_down.png
mobile/themesmobile/68ecshopcom_mobile/images/category/list_top_ge.png
mobile/themesmobile/68ecshopcom_mobile/images/category/loader.gif
mobile/themesmobile/68ecshopcom_mobile/images/category/loading.png
mobile/themesmobile/68ecshopcom_mobile/images/category/search.png
mobile/themesmobile/68ecshopcom_mobile/images/category/search_sprite.png
mobile/themesmobile/68ecshopcom_mobile/images/category/select2.png
mobile/themesmobile/68ecshopcom_mobile/images/category/shou.png
mobile/themesmobile/68ecshopcom_mobile/images/category/souso.png
mobile/themesmobile/68ecshopcom_mobile/images/category/time.png
mobile/themesmobile/68ecshopcom_mobile/images/category/xiala.png
mobile/themesmobile/68ecshopcom_mobile/images/chat/others_pic.png
mobile/themesmobile/68ecshopcom_mobile/images/chat/sj.png
mobile/themesmobile/68ecshopcom_mobile/images/chat/sj1.png
mobile/themesmobile/68ecshopcom_mobile/images/chat/user_pic.png
mobile/themesmobile/68ecshopcom_mobile/images/close.png
mobile/themesmobile/68ecshopcom_mobile/images/cutp_08.png
mobile/themesmobile/68ecshopcom_mobile/images/detail-sprites.png
mobile/themesmobile/68ecshopcom_mobile/images/down.png
mobile/themesmobile/68ecshopcom_mobile/images/float_add.png
mobile/themesmobile/68ecshopcom_mobile/images/float_share.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/abbress.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/address.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/address2.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/b_checkbox_dis.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/b_checkbox_off.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/b_checkbox_on.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/black.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/c_cancel.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/c_checkbox_dis.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/c_checkbox_off.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/c_checkbox_on.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/dianpu.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/dingdan.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/done_sus.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/dp.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/empty_cart.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/flow_icon.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/flow_icon_order.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/fp.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/hui.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/iconfont-duihao.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/libao.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/loader.gif
mobile/themesmobile/68ecshopcom_mobile/images/flow/ps.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/qh.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/qt.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/shop-cart.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/shop_arrow.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/shop_arrow2.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/time.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/ye.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/yh.png
mobile/themesmobile/68ecshopcom_mobile/images/flow/zf.png
mobile/themesmobile/68ecshopcom_mobile/images/footer_navimg.png
mobile/themesmobile/68ecshopcom_mobile/images/goods/dian.png
mobile/themesmobile/68ecshopcom_mobile/images/goods/dianpu.jpg
mobile/themesmobile/68ecshopcom_mobile/images/goods/jia.png
mobile/themesmobile/68ecshopcom_mobile/images/goods/pub_goods.png
mobile/themesmobile/68ecshopcom_mobile/images/goods/right.png
mobile/themesmobile/68ecshopcom_mobile/images/goods/tongzhi.png
mobile/themesmobile/68ecshopcom_mobile/images/goods/ziti.png
mobile/themesmobile/68ecshopcom_mobile/images/icojiantou1.png
mobile/themesmobile/68ecshopcom_mobile/images/icon.png
mobile/themesmobile/68ecshopcom_mobile/images/iconfont-yiqiangguang.png
mobile/themesmobile/68ecshopcom_mobile/images/icosousuo.png
mobile/themesmobile/68ecshopcom_mobile/images/index.png
mobile/themesmobile/68ecshopcom_mobile/images/index_flow.png
mobile/themesmobile/68ecshopcom_mobile/images/index_r.png
mobile/themesmobile/68ecshopcom_mobile/images/jifen.png
mobile/themesmobile/68ecshopcom_mobile/images/jmpic/cart_pop_close.png
mobile/themesmobile/68ecshopcom_mobile/images/logo.gif
mobile/themesmobile/68ecshopcom_mobile/images/new_topup.png
mobile/themesmobile/68ecshopcom_mobile/images/phone.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_bg_v6_60302f7.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_btn_eb0075d.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_desc.jpg
mobile/themesmobile/68ecshopcom_mobile/images/pt_desc1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/pt_fail.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_icon_indexn_03.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_list_1.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_list_2.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_logo.jpg
mobile/themesmobile/68ecshopcom_mobile/images/pt_sanjiao.png
mobile/themesmobile/68ecshopcom_mobile/images/pt_success.png
mobile/themesmobile/68ecshopcom_mobile/images/pub_flow.png
mobile/themesmobile/68ecshopcom_mobile/images/pub_footer.png
mobile/themesmobile/68ecshopcom_mobile/images/pub_goods.png
mobile/themesmobile/68ecshopcom_mobile/images/pub_main.png
mobile/themesmobile/68ecshopcom_mobile/images/pub_user.png
mobile/themesmobile/68ecshopcom_mobile/images/rzs.png
mobile/themesmobile/68ecshopcom_mobile/images/screenshot.png
mobile/themesmobile/68ecshopcom_mobile/images/search.png
mobile/themesmobile/68ecshopcom_mobile/images/search_diapu.png
mobile/themesmobile/68ecshopcom_mobile/images/share.png
mobile/themesmobile/68ecshopcom_mobile/images/share_guide.png
mobile/themesmobile/68ecshopcom_mobile/images/star_rating.png
mobile/themesmobile/68ecshopcom_mobile/images/stars1.png
mobile/themesmobile/68ecshopcom_mobile/images/stars2.png
mobile/themesmobile/68ecshopcom_mobile/images/stars3.png
mobile/themesmobile/68ecshopcom_mobile/images/stars4.png
mobile/themesmobile/68ecshopcom_mobile/images/stars5.png
mobile/themesmobile/68ecshopcom_mobile/images/step_point.png
mobile/themesmobile/68ecshopcom_mobile/images/step_start.png
mobile/themesmobile/68ecshopcom_mobile/images/swype/Thumbs.db
mobile/themesmobile/68ecshopcom_mobile/images/swype/error.gif
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/001.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/002.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/003.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/004.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/005.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/006.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/007.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/008.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/009.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/full/Thumbs.db
mobile/themesmobile/68ecshopcom_mobile/images/swype/icons.png
mobile/themesmobile/68ecshopcom_mobile/images/swype/icons@2x.png
mobile/themesmobile/68ecshopcom_mobile/images/swype/loader.gif
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/001.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/002.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/003.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/004.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/005.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/006.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/007.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/008.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/009.jpg
mobile/themesmobile/68ecshopcom_mobile/images/swype/thumb/Thumbs.db
mobile/themesmobile/68ecshopcom_mobile/images/sx_hui.png
mobile/themesmobile/68ecshopcom_mobile/images/sx_red.png
mobile/themesmobile/68ecshopcom_mobile/images/sx_red_u.png
mobile/themesmobile/68ecshopcom_mobile/images/tel.png
mobile/themesmobile/68ecshopcom_mobile/images/time.png
mobile/themesmobile/68ecshopcom_mobile/images/top.png
mobile/themesmobile/68ecshopcom_mobile/images/topup.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Delete.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Delete1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Icon1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Icon2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Icon3.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Icon4.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Icon5.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Icon6.png
mobile/themesmobile/68ecshopcom_mobile/images/user/Icon8.png
mobile/themesmobile/68ecshopcom_mobile/images/user/abbress.png
mobile/themesmobile/68ecshopcom_mobile/images/user/add1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/add2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/add3.png
mobile/themesmobile/68ecshopcom_mobile/images/user/addr_top_bg.jpg
mobile/themesmobile/68ecshopcom_mobile/images/user/all.png
mobile/themesmobile/68ecshopcom_mobile/images/user/bonus_grey.png
mobile/themesmobile/68ecshopcom_mobile/images/user/bonus_white.png
mobile/themesmobile/68ecshopcom_mobile/images/user/ca1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/ca2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/ca3.png
mobile/themesmobile/68ecshopcom_mobile/images/user/ca4.png
mobile/themesmobile/68ecshopcom_mobile/images/user/ca5.png
mobile/themesmobile/68ecshopcom_mobile/images/user/ca6.png
mobile/themesmobile/68ecshopcom_mobile/images/user/d.jpg
mobile/themesmobile/68ecshopcom_mobile/images/user/dianpu.png
mobile/themesmobile/68ecshopcom_mobile/images/user/dingdan.png
mobile/themesmobile/68ecshopcom_mobile/images/user/done_sus.png
mobile/themesmobile/68ecshopcom_mobile/images/user/flow_icon_order.png
mobile/themesmobile/68ecshopcom_mobile/images/user/fonk.png
mobile/themesmobile/68ecshopcom_mobile/images/user/footer_navimg.png
mobile/themesmobile/68ecshopcom_mobile/images/user/geren.png
mobile/themesmobile/68ecshopcom_mobile/images/user/input-eye-off.png
mobile/themesmobile/68ecshopcom_mobile/images/user/input-eye-on.png
mobile/themesmobile/68ecshopcom_mobile/images/user/jifen.png
mobile/themesmobile/68ecshopcom_mobile/images/user/messages.png
mobile/themesmobile/68ecshopcom_mobile/images/user/on.png
mobile/themesmobile/68ecshopcom_mobile/images/user/order1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/order2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/order3.png
mobile/themesmobile/68ecshopcom_mobile/images/user/phone.png
mobile/themesmobile/68ecshopcom_mobile/images/user/pingjia1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/pingjia2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/pub_main.png
mobile/themesmobile/68ecshopcom_mobile/images/user/select2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shangchuan.png
mobile/themesmobile/68ecshopcom_mobile/images/user/share.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shehzi.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shouc.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shouc1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shouc2-1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shouc2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shouc3-1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/shouc3.png
mobile/themesmobile/68ecshopcom_mobile/images/user/star_rating.gif
mobile/themesmobile/68ecshopcom_mobile/images/user/tishi.png
mobile/themesmobile/68ecshopcom_mobile/images/user/up_down.png
mobile/themesmobile/68ecshopcom_mobile/images/user/user.png
mobile/themesmobile/68ecshopcom_mobile/images/user/user01.png
mobile/themesmobile/68ecshopcom_mobile/images/user/user03.png
mobile/themesmobile/68ecshopcom_mobile/images/user/user1.png
mobile/themesmobile/68ecshopcom_mobile/images/user/user2.png
mobile/themesmobile/68ecshopcom_mobile/images/user/user3.png
mobile/themesmobile/68ecshopcom_mobile/images/user/user68.jpg
mobile/themesmobile/68ecshopcom_mobile/images/user/user_right.png
mobile/themesmobile/68ecshopcom_mobile/images/user/userbg.png
mobile/themesmobile/68ecshopcom_mobile/images/user/xiangji.png
mobile/themesmobile/68ecshopcom_mobile/images/user68.jpg
mobile/themesmobile/68ecshopcom_mobile/images/user_btn.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/68ecshop_zc.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/Label0.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/Location.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/addr_top_bg.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/address_phone.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/arrow_left.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/arrow_right.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/b_checkbox_off.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/b_checkbox_on.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/back.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/back_hui.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bg_stock.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bg_storeroom5.gif
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bun1.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bun2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bun3.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bun4.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bun5.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/bun6.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/cart.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/cart_pop_close.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/close.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/detail-sprites.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/dui.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/er.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/erweima.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/fenlei_shang.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/fenlei_xia.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/footer_navimg.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/g1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/g2.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/gride.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/h1.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/h2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/h3.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/haibao.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/headbg.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/headbg.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/headbg2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/headbg3.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/ico_opt_check.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/icon1.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/icon2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/img1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/img2.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/index_logo.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/kong.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/l1-1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/l1-2.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/l1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/l2-1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/l2-2.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/l2.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/list.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/loader.gif
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/logo.gif
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/logo.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/logo1.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m1.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m10.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m3.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m4.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m5.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m6.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m7.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m8.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/m9.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/n1.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/n2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/n3.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/n4.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/n5.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/n6.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/pop.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/pub_goods.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/right.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/select2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/shanc.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/shop-cart.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/shop.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/shopbg.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/shou.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/store-enter.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/test.gif
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/tishi.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/topup.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/tx.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/user_nav_img.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/user_nav_img1.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/user_nav_imgright.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/userbg.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/userportrait.jpg
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v11.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v21.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v31.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v41.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v51.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v_1.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v_2.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v_shopbg.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/v_user.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/vfx_img.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/xiala.gif
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/xiugai.png
mobile/themesmobile/68ecshopcom_mobile/images/v-shop/ziying.jpg
mobile/themesmobile/68ecshopcom_mobile/images/weixin/QQ.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/bangding.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/bangding1.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/bangding2.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/phone.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/weibo.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/weixin.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/weixin1.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/weixin2.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/weixinimg.png
mobile/themesmobile/68ecshopcom_mobile/images/weixin/youxing.png
mobile/themesmobile/68ecshopcom_mobile/images/z3g_icon_share.png
mobile/themesmobile/68ecshopcom_mobile/images/ziti.png
mobile/themesmobile/68ecshopcom_mobile/img/arrow1.png
mobile/themesmobile/68ecshopcom_mobile/img/dian.png
mobile/themesmobile/68ecshopcom_mobile/img/find_pw_end.png
mobile/themesmobile/68ecshopcom_mobile/img/img0.png
mobile/themesmobile/68ecshopcom_mobile/img/img1.jpg
mobile/themesmobile/68ecshopcom_mobile/img/index.png
mobile/themesmobile/68ecshopcom_mobile/img/liulan.png
mobile/themesmobile/68ecshopcom_mobile/img/pw_step.png
mobile/themesmobile/68ecshopcom_mobile/img/user_center1.png
mobile/themesmobile/68ecshopcom_mobile/img/user_yz.png
mobile/themesmobile/68ecshopcom_mobile/img/zhifubao.png
mobile/themesmobile/68ecshopcom_mobile/index - backup.dwt
mobile/themesmobile/68ecshopcom_mobile/index-fenxiao-qq.dwt
mobile/themesmobile/68ecshopcom_mobile/index-less.dwt
mobile/themesmobile/68ecshopcom_mobile/index.dwt
mobile/themesmobile/68ecshopcom_mobile/js/6025851.min.js
mobile/themesmobile/68ecshopcom_mobile/js/TouchSlide.1.1.js
mobile/themesmobile/68ecshopcom_mobile/js/auction.js
mobile/themesmobile/68ecshopcom_mobile/js/category.js
mobile/themesmobile/68ecshopcom_mobile/js/custom.js
mobile/themesmobile/68ecshopcom_mobile/js/ecsmart.js
mobile/themesmobile/68ecshopcom_mobile/js/filter.min.js
mobile/themesmobile/68ecshopcom_mobile/js/headroom.min.js
mobile/themesmobile/68ecshopcom_mobile/js/jquery-1.6.2.min.js
mobile/themesmobile/68ecshopcom_mobile/js/jquery-1.9.1.min.js
mobile/themesmobile/68ecshopcom_mobile/js/jquery.js
mobile/themesmobile/68ecshopcom_mobile/js/jquery.min.js
mobile/themesmobile/68ecshopcom_mobile/js/jquery.mmenu.js
mobile/themesmobile/68ecshopcom_mobile/js/jquery.more.js
mobile/themesmobile/68ecshopcom_mobile/js/jquery.nicescroll.min.js
mobile/themesmobile/68ecshopcom_mobile/js/klass.min.js
mobile/themesmobile/68ecshopcom_mobile/js/lib-v1.js
mobile/themesmobile/68ecshopcom_mobile/js/mobile.js
mobile/themesmobile/68ecshopcom_mobile/js/modernizr.js
mobile/themesmobile/68ecshopcom_mobile/js/photoswipe.js
mobile/themesmobile/68ecshopcom_mobile/js/slider.js
mobile/themesmobile/68ecshopcom_mobile/js/touchslider.dev.js
mobile/themesmobile/68ecshopcom_mobile/js/validate/jquery.validate.js
mobile/themesmobile/68ecshopcom_mobile/js/validate/jquery.validate.min.js
mobile/themesmobile/68ecshopcom_mobile/js/validate/messages_zh.js
mobile/themesmobile/68ecshopcom_mobile/js/zepto.js
mobile/themesmobile/68ecshopcom_mobile/js/zepto.min.js
mobile/themesmobile/68ecshopcom_mobile/kuaidi_list.dwt
mobile/themesmobile/68ecshopcom_mobile/library/activity.lbi
mobile/themesmobile/68ecshopcom_mobile/library/activity_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/ad_position.lbi
mobile/themesmobile/68ecshopcom_mobile/library/add_booking.lbi
mobile/themesmobile/68ecshopcom_mobile/library/affiliate.lbi
mobile/themesmobile/68ecshopcom_mobile/library/arrive_notice.lbi
mobile/themesmobile/68ecshopcom_mobile/library/article_category_tree.lbi
mobile/themesmobile/68ecshopcom_mobile/library/auction.lbi
mobile/themesmobile/68ecshopcom_mobile/library/auction_jieshao.lbi
mobile/themesmobile/68ecshopcom_mobile/library/auction_process.lbi
mobile/themesmobile/68ecshopcom_mobile/library/bought_goods.lbi
mobile/themesmobile/68ecshopcom_mobile/library/bought_note_guide.lbi
mobile/themesmobile/68ecshopcom_mobile/library/bought_notes.lbi
mobile/themesmobile/68ecshopcom_mobile/library/brand_goods.lbi
mobile/themesmobile/68ecshopcom_mobile/library/brands.lbi
mobile/themesmobile/68ecshopcom_mobile/library/cat_articles.lbi
mobile/themesmobile/68ecshopcom_mobile/library/cat_filter.lbi
mobile/themesmobile/68ecshopcom_mobile/library/cat_goods.lbi
mobile/themesmobile/68ecshopcom_mobile/library/category_tree.lbi
mobile/themesmobile/68ecshopcom_mobile/library/choose_attr.lbi
mobile/themesmobile/68ecshopcom_mobile/library/choose_time.lbi
mobile/themesmobile/68ecshopcom_mobile/library/comments.lbi
mobile/themesmobile/68ecshopcom_mobile/library/comments_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/consignee.lbi
mobile/themesmobile/68ecshopcom_mobile/library/email_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/exchange_goods_detail.lbi
mobile/themesmobile/68ecshopcom_mobile/library/exchange_hot.lbi
mobile/themesmobile/68ecshopcom_mobile/library/exchange_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/favourable.lbi
mobile/themesmobile/68ecshopcom_mobile/library/footer_nav.lbi
mobile/themesmobile/68ecshopcom_mobile/library/footer_nav1.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_article.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_attrlinked.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_choose_attr.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_fittings.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_gallery.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_list_ajax.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_list_duli.lbi
mobile/themesmobile/68ecshopcom_mobile/library/goods_related.lbi
mobile/themesmobile/68ecshopcom_mobile/library/group_ad.lbi
mobile/themesmobile/68ecshopcom_mobile/library/group_buy.lbi
mobile/themesmobile/68ecshopcom_mobile/library/group_buy_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/help.lbi
mobile/themesmobile/68ecshopcom_mobile/library/index_ad.lbi
mobile/themesmobile/68ecshopcom_mobile/library/index_best_goods_2.lbi
mobile/themesmobile/68ecshopcom_mobile/library/index_icon.lbi
mobile/themesmobile/68ecshopcom_mobile/library/invoice_query.lbi
mobile/themesmobile/68ecshopcom_mobile/library/kuaidi.lbi
mobile/themesmobile/68ecshopcom_mobile/library/links.lbi
mobile/themesmobile/68ecshopcom_mobile/library/member_info.lbi
mobile/themesmobile/68ecshopcom_mobile/library/member_info1.lbi
mobile/themesmobile/68ecshopcom_mobile/library/menu.lbi
mobile/themesmobile/68ecshopcom_mobile/library/message_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/my_comments_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/new_articles.lbi
mobile/themesmobile/68ecshopcom_mobile/library/online.lbi
mobile/themesmobile/68ecshopcom_mobile/library/order_query.lbi
mobile/themesmobile/68ecshopcom_mobile/library/order_supplier_shipping.lbi
mobile/themesmobile/68ecshopcom_mobile/library/order_total.lbi
mobile/themesmobile/68ecshopcom_mobile/library/page_footer.lbi
mobile/themesmobile/68ecshopcom_mobile/library/page_header.lbi
mobile/themesmobile/68ecshopcom_mobile/library/pages.lbi
mobile/themesmobile/68ecshopcom_mobile/library/pickup.lbi
mobile/themesmobile/68ecshopcom_mobile/library/pre_sale_goods_gallery.lbi
mobile/themesmobile/68ecshopcom_mobile/library/pro_mobile_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/pro_pages.lbi
mobile/themesmobile/68ecshopcom_mobile/library/pro_search_goods.lbi
mobile/themesmobile/68ecshopcom_mobile/library/promotion_info.lbi
mobile/themesmobile/68ecshopcom_mobile/library/recommend_best.lbi
mobile/themesmobile/68ecshopcom_mobile/library/recommend_hot.lbi
mobile/themesmobile/68ecshopcom_mobile/library/recommend_new.lbi
mobile/themesmobile/68ecshopcom_mobile/library/recommend_promotion.lbi
mobile/themesmobile/68ecshopcom_mobile/library/relatetag.lbi
mobile/themesmobile/68ecshopcom_mobile/library/search_goods_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/search_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/share.lbi
mobile/themesmobile/68ecshopcom_mobile/library/shipping_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/shop_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/shop_list_ajax.lbi
mobile/themesmobile/68ecshopcom_mobile/library/snatch.lbi
mobile/themesmobile/68ecshopcom_mobile/library/snatch_price.lbi
mobile/themesmobile/68ecshopcom_mobile/library/stores_search_pager.lbi
mobile/themesmobile/68ecshopcom_mobile/library/top10.lbi
mobile/themesmobile/68ecshopcom_mobile/library/up_menu.lbi
mobile/themesmobile/68ecshopcom_mobile/library/ur_here.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_account.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_account_bonus.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_account_detail.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_account_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_account_recharge.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_account_withdraw.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_address.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_address_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_affiliate.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_book.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_collection.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_comments.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_message.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_nav.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_order.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_order_detail.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_order_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_profile.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_tag_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_track_packages.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_transform_points.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_vclogin.lbi
mobile/themesmobile/68ecshopcom_mobile/library/user_welcome.lbi
mobile/themesmobile/68ecshopcom_mobile/library/vote.lbi
mobile/themesmobile/68ecshopcom_mobile/library/vote_list.lbi
mobile/themesmobile/68ecshopcom_mobile/library/vshop_footer.lbi
mobile/themesmobile/68ecshopcom_mobile/libs.xml
mobile/themesmobile/68ecshopcom_mobile/map.dwt
mobile/themesmobile/68ecshopcom_mobile/message.dwt
mobile/themesmobile/68ecshopcom_mobile/message_board.dwt
mobile/themesmobile/68ecshopcom_mobile/myship.dwt
mobile/themesmobile/68ecshopcom_mobile/new.dwt
mobile/themesmobile/68ecshopcom_mobile/options.php
mobile/themesmobile/68ecshopcom_mobile/package.dwt
mobile/themesmobile/68ecshopcom_mobile/pick_out.dwt
mobile/themesmobile/68ecshopcom_mobile/pintuan_goods.dwt
mobile/themesmobile/68ecshopcom_mobile/pintuan_list.dwt
mobile/themesmobile/68ecshopcom_mobile/pintuan_user_list.dwt
mobile/themesmobile/68ecshopcom_mobile/pintuan_view.dwt
mobile/themesmobile/68ecshopcom_mobile/pre_sale_goods.dwt
mobile/themesmobile/68ecshopcom_mobile/pre_sale_list.dwt
mobile/themesmobile/68ecshopcom_mobile/pro_mobile.dwt
mobile/themesmobile/68ecshopcom_mobile/pro_search.dwt
mobile/themesmobile/68ecshopcom_mobile/quotation.dwt
mobile/themesmobile/68ecshopcom_mobile/receive.dwt
mobile/themesmobile/68ecshopcom_mobile/respond.dwt
mobile/themesmobile/68ecshopcom_mobile/search.dwt
mobile/themesmobile/68ecshopcom_mobile/search_store.dwt
mobile/themesmobile/68ecshopcom_mobile/searchindex.dwt
mobile/themesmobile/68ecshopcom_mobile/setting.js
mobile/themesmobile/68ecshopcom_mobile/shaidan_order.dwt
mobile/themesmobile/68ecshopcom_mobile/share.dwt
mobile/themesmobile/68ecshopcom_mobile/share_goods.dwt
mobile/themesmobile/68ecshopcom_mobile/snatch.dwt
mobile/themesmobile/68ecshopcom_mobile/stores.dwt
mobile/themesmobile/68ecshopcom_mobile/style.css
mobile/themesmobile/68ecshopcom_mobile/style1.css
mobile/themesmobile/68ecshopcom_mobile/supplier_city.dwt
mobile/themesmobile/68ecshopcom_mobile/supplier_map.dwt
mobile/themesmobile/68ecshopcom_mobile/tag_cloud.dwt
mobile/themesmobile/68ecshopcom_mobile/topic.dwt
mobile/themesmobile/68ecshopcom_mobile/topic1.dwt
mobile/themesmobile/68ecshopcom_mobile/topic2.dwt
mobile/themesmobile/68ecshopcom_mobile/topic3.dwt
mobile/themesmobile/68ecshopcom_mobile/topic4.dwt
mobile/themesmobile/68ecshopcom_mobile/user_clips.dwt
mobile/themesmobile/68ecshopcom_mobile/user_findPwd.dwt
mobile/themesmobile/68ecshopcom_mobile/user_passport.dwt
mobile/themesmobile/68ecshopcom_mobile/user_register.dwt
mobile/themesmobile/68ecshopcom_mobile/user_security.dwt
mobile/themesmobile/68ecshopcom_mobile/user_transaction.dwt
mobile/themesmobile/68ecshopcom_mobile/v_shop.dwt
mobile/themesmobile/68ecshopcom_mobile/v_shop_catelog.dwt
mobile/themesmobile/68ecshopcom_mobile/v_shop_list.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_catelog.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_dianpu.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_dianpu_detail.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_erweima.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_haibao.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_huiyuan.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_huiyuan_list.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_news.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_notes.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_shangsi.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_shouyi-qqq.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_shouyi.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_shouyimore.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_tixian.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_tixian_more.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_tixiandetail.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_tixianmore.dwt
mobile/themesmobile/68ecshopcom_mobile/v_user_tixiantwo.dwt
mobile/themesmobile/68ecshopcom_mobile/weixin_account.dwt
mobile/themesmobile/68ecshopcom_mobile/weixin_open.dwt
mobile/themesmobile/68ecshopcom_mobile/wholesale_list.dwt
mobile/themesmobile/dianpu/about.dwt
mobile/themesmobile/dianpu/activity.dwt
mobile/themesmobile/dianpu/article.dwt
mobile/themesmobile/dianpu/article_pro.dwt
mobile/themesmobile/dianpu/catalog.dwt
mobile/themesmobile/dianpu/category.dwt
mobile/themesmobile/dianpu/library/category_goods.lbi
mobile/themesmobile/dianpu/library/ghs_ad.lbi
mobile/themesmobile/dianpu/library/ghs_category.lbi
mobile/themesmobile/dianpu/library/ghs_info.lbi
mobile/themesmobile/dianpu/library/ghs_nav.lbi
mobile/themesmobile/dianpu/library/goods_list.lbi
mobile/themesmobile/dianpu/library/page_footer.lbi
mobile/themesmobile/dianpu/library/pages.lbi
mobile/themesmobile/dianpu/library/price_grade.lbi
mobile/themesmobile/dianpu/library/promotion_info.lbi
mobile/themesmobile/dianpu/library/recommend_best.lbi
mobile/themesmobile/dianpu/library/recommend_hot.lbi
mobile/themesmobile/dianpu/library/recommend_new.lbi
mobile/themesmobile/dianpu/library/recommend_promotion.lbi
mobile/themesmobile/dianpu/library/up_menu.lbi
mobile/themesmobile/dianpu/mall.dwt
mobile/themesmobile/dianpu/style.css
mobile/themesmobile/dianpu/supplier_catalog.dwt
mobile/themesmobile/dianpu1/activity.dwt
mobile/themesmobile/dianpu1/article.dwt
mobile/themesmobile/dianpu1/article_pro.dwt
mobile/themesmobile/dianpu1/catalog.dwt
mobile/themesmobile/dianpu1/category.dwt
mobile/themesmobile/dianpu1/library/category_goods.lbi
mobile/themesmobile/dianpu1/library/ghs_ad.lbi
mobile/themesmobile/dianpu1/library/ghs_category.lbi
mobile/themesmobile/dianpu1/library/ghs_info.lbi
mobile/themesmobile/dianpu1/library/ghs_nav.lbi
mobile/themesmobile/dianpu1/library/goods_list.lbi
mobile/themesmobile/dianpu1/library/page_footer.lbi
mobile/themesmobile/dianpu1/library/pages.lbi
mobile/themesmobile/dianpu1/library/price_grade.lbi
mobile/themesmobile/dianpu1/library/promotion_info.lbi
mobile/themesmobile/dianpu1/library/recommend_best.lbi
mobile/themesmobile/dianpu1/library/recommend_hot.lbi
mobile/themesmobile/dianpu1/library/recommend_new.lbi
mobile/themesmobile/dianpu1/library/recommend_promotion.lbi
mobile/themesmobile/dianpu1/library/up_menu.lbi
mobile/themesmobile/dianpu1/mall.dwt
mobile/themesmobile/dianpu1/style.css
mobile/themesmobile/dianpu1/supplier_catalog.dwt
mobile/themesmobile/dianpu2/activity.dwt
mobile/themesmobile/dianpu2/article.dwt
mobile/themesmobile/dianpu2/article_pro.dwt
mobile/themesmobile/dianpu2/catalog.dwt
mobile/themesmobile/dianpu2/category.dwt
mobile/themesmobile/dianpu2/library/category_goods.lbi
mobile/themesmobile/dianpu2/library/ghs_ad.lbi
mobile/themesmobile/dianpu2/library/ghs_category.lbi
mobile/themesmobile/dianpu2/library/ghs_info.lbi
mobile/themesmobile/dianpu2/library/ghs_nav.lbi
mobile/themesmobile/dianpu2/library/goods_list.lbi
mobile/themesmobile/dianpu2/library/page_footer.lbi
mobile/themesmobile/dianpu2/library/pages.lbi
mobile/themesmobile/dianpu2/library/price_grade.lbi
mobile/themesmobile/dianpu2/library/promotion_info.lbi
mobile/themesmobile/dianpu2/library/recommend_best.lbi
mobile/themesmobile/dianpu2/library/recommend_hot.lbi
mobile/themesmobile/dianpu2/library/recommend_new.lbi
mobile/themesmobile/dianpu2/library/recommend_promotion.lbi
mobile/themesmobile/dianpu2/library/up_menu.lbi
mobile/themesmobile/dianpu2/mall.dwt
mobile/themesmobile/dianpu2/style.css
mobile/themesmobile/dianpu2/supplier_catalog.dwt
mobile/themesmobile/dianpu3/activity.dwt
mobile/themesmobile/dianpu3/article.dwt
mobile/themesmobile/dianpu3/article_pro.dwt
mobile/themesmobile/dianpu3/catalog.dwt
mobile/themesmobile/dianpu3/category.dwt
mobile/themesmobile/dianpu3/library/category_goods.lbi
mobile/themesmobile/dianpu3/library/ghs_ad.lbi
mobile/themesmobile/dianpu3/library/ghs_category.lbi
mobile/themesmobile/dianpu3/library/ghs_info.lbi
mobile/themesmobile/dianpu3/library/ghs_nav.lbi
mobile/themesmobile/dianpu3/library/goods_list.lbi
mobile/themesmobile/dianpu3/library/page_footer.lbi
mobile/themesmobile/dianpu3/library/pages.lbi
mobile/themesmobile/dianpu3/library/price_grade.lbi
mobile/themesmobile/dianpu3/library/promotion_info.lbi
mobile/themesmobile/dianpu3/library/recommend_best.lbi
mobile/themesmobile/dianpu3/library/recommend_hot.lbi
mobile/themesmobile/dianpu3/library/recommend_new.lbi
mobile/themesmobile/dianpu3/library/recommend_promotion.lbi
mobile/themesmobile/dianpu3/library/up_menu.lbi
mobile/themesmobile/dianpu3/mall.dwt
mobile/themesmobile/dianpu3/style.css
mobile/themesmobile/dianpu3/supplier_catalog.dwt
mobile/themesmobile/dianpu4/activity.dwt
mobile/themesmobile/dianpu4/article.dwt
mobile/themesmobile/dianpu4/article_pro.dwt
mobile/themesmobile/dianpu4/catalog.dwt
mobile/themesmobile/dianpu4/category.dwt
mobile/themesmobile/dianpu4/library/category_goods.lbi
mobile/themesmobile/dianpu4/library/ghs_ad.lbi
mobile/themesmobile/dianpu4/library/ghs_category.lbi
mobile/themesmobile/dianpu4/library/ghs_info.lbi
mobile/themesmobile/dianpu4/library/ghs_nav.lbi
mobile/themesmobile/dianpu4/library/goods_list.lbi
mobile/themesmobile/dianpu4/library/page_footer.lbi
mobile/themesmobile/dianpu4/library/pages.lbi
mobile/themesmobile/dianpu4/library/price_grade.lbi
mobile/themesmobile/dianpu4/library/promotion_info.lbi
mobile/themesmobile/dianpu4/library/recommend_best.lbi
mobile/themesmobile/dianpu4/library/recommend_hot.lbi
mobile/themesmobile/dianpu4/library/recommend_new.lbi
mobile/themesmobile/dianpu4/library/recommend_promotion.lbi
mobile/themesmobile/dianpu4/library/up_menu.lbi
mobile/themesmobile/dianpu4/mall.dwt
mobile/themesmobile/dianpu4/style.css
mobile/themesmobile/dianpu4/supplier_catalog.dwt
mobile/themesmobile/dianpu5/activity.dwt
mobile/themesmobile/dianpu5/article.dwt
mobile/themesmobile/dianpu5/article_pro.dwt
mobile/themesmobile/dianpu5/catalog.dwt
mobile/themesmobile/dianpu5/category.dwt
mobile/themesmobile/dianpu5/library/category_goods.lbi
mobile/themesmobile/dianpu5/library/ghs_ad.lbi
mobile/themesmobile/dianpu5/library/ghs_category.lbi
mobile/themesmobile/dianpu5/library/ghs_info.lbi
mobile/themesmobile/dianpu5/library/ghs_nav.lbi
mobile/themesmobile/dianpu5/library/goods_list.lbi
mobile/themesmobile/dianpu5/library/page_footer.lbi
mobile/themesmobile/dianpu5/library/pages.lbi
mobile/themesmobile/dianpu5/library/price_grade.lbi
mobile/themesmobile/dianpu5/library/promotion_info.lbi
mobile/themesmobile/dianpu5/library/recommend_best.lbi
mobile/themesmobile/dianpu5/library/recommend_hot.lbi
mobile/themesmobile/dianpu5/library/recommend_new.lbi
mobile/themesmobile/dianpu5/library/recommend_promotion.lbi
mobile/themesmobile/dianpu5/library/up_menu.lbi
mobile/themesmobile/dianpu5/mall.dwt
mobile/themesmobile/dianpu5/style.css
mobile/themesmobile/dianpu5/supplier_catalog.dwt
mobile/themesmobile/dianpu6/activity.dwt
mobile/themesmobile/dianpu6/article.dwt
mobile/themesmobile/dianpu6/article_pro.dwt
mobile/themesmobile/dianpu6/catalog.dwt
mobile/themesmobile/dianpu6/category.dwt
mobile/themesmobile/dianpu6/library/category_goods.lbi
mobile/themesmobile/dianpu6/library/ghs_ad.lbi
mobile/themesmobile/dianpu6/library/ghs_category.lbi
mobile/themesmobile/dianpu6/library/ghs_info.lbi
mobile/themesmobile/dianpu6/library/ghs_nav.lbi
mobile/themesmobile/dianpu6/library/goods_list.lbi
mobile/themesmobile/dianpu6/library/page_footer.lbi
mobile/themesmobile/dianpu6/library/pages.lbi
mobile/themesmobile/dianpu6/library/price_grade.lbi
mobile/themesmobile/dianpu6/library/promotion_info.lbi
mobile/themesmobile/dianpu6/library/recommend_best.lbi
mobile/themesmobile/dianpu6/library/recommend_hot.lbi
mobile/themesmobile/dianpu6/library/recommend_new.lbi
mobile/themesmobile/dianpu6/library/recommend_promotion.lbi
mobile/themesmobile/dianpu6/library/up_menu.lbi
mobile/themesmobile/dianpu6/mall.dwt
mobile/themesmobile/dianpu6/style.css
mobile/themesmobile/dianpu6/supplier_catalog.dwt
mobile/topic.php
mobile/user.php
mobile/v_shop.php
mobile/v_shop_catelog.php
mobile/v_shop_list.php
mobile/v_user.php
mobile/v_user_catelog.php
mobile/v_user_dianpu.php
mobile/v_user_dianpu_detail.php
mobile/v_user_erweima.php
mobile/v_user_haibao.php
mobile/v_user_huiyuan.php
mobile/v_user_huiyuan_list.php
mobile/v_user_news.php
mobile/v_user_notes.php
mobile/v_user_shangsi.php
mobile/v_user_shouyi-qqq.php
mobile/v_user_shouyi.php
mobile/v_user_shouyimore.php
mobile/v_user_tixian.php
mobile/v_user_tixian_more.php
mobile/v_user_tixiandetail.php
mobile/v_user_tixianmore.php
mobile/validate.php
mobile/vote.php
mobile/weixin/act.php
mobile/weixin/act_prize.php
mobile/weixin/act_prize2.php
mobile/weixin/api.class.php
mobile/weixin/assets/acbg.jpg
mobile/weixin/assets/bg.jpg
mobile/weixin/assets/css.css
mobile/weixin/assets/egg.png
mobile/weixin/assets/egg2.png
mobile/weixin/assets/img1.png
mobile/weixin/assets/img2.png
mobile/weixin/assets/jquery.js
mobile/weixin/assets/title-bg.png
mobile/weixin/assets/y.png
mobile/weixin/auto_do.php
mobile/weixin/award_1.php
mobile/weixin/award_2.php
mobile/weixin/award_3.php
mobile/weixin/award_4.php
mobile/weixin/dzp/1.png
mobile/weixin/dzp/2.png
mobile/weixin/dzp/3.png
mobile/weixin/dzp/bg.png
mobile/weixin/dzp/jq.js
mobile/weixin/dzp/tit.png
mobile/weixin/dzp/y.png
mobile/weixin/ggk/css/activity-style.css
mobile/weixin/ggk/images/activity-lottery-2.png
mobile/weixin/ggk/images/activity-lottery-3.png
mobile/weixin/ggk/images/activity-lottery-bg.png
mobile/weixin/ggk/images/activity-lottery-bg2.jpg
mobile/weixin/ggk/images/activity-scratch-card-bannerbg.png
mobile/weixin/ggk/images/activity-scratch-card-bg.jpg
mobile/weixin/ggk/images/title-bg-brown.png
mobile/weixin/ggk/images/title-bg-green.png
mobile/weixin/ggk/js/alert.js
mobile/weixin/ggk/js/jquery.js
mobile/weixin/ggk/js/wScratchPad.js
mobile/weixin/index.php
mobile/weixin/index_new.php
mobile/weixin/kuaidi/config.php
mobile/weixin/login.php
mobile/weixin/natpay.php
mobile/weixin/oauth.php
mobile/weixin/redirect.php
mobile/weixin/wechat.class.php
mobile/weixin_account.php
mobile/weixin_login.php
mobile/weixin_open.php
mobile/weixindeposit.php
mobile/weixinpay.php
mobile/wholesale.php
mobile/wxjs/access_token.json
mobile/wxjs/jsapi_ticket.json
mobile/wxjs/jssdk.php
plugins/kuaidi100/kuaidi100_config.php
plugins/kuaidi100/kuaidi100_post.php
plugins/kuaidi100/snoopy.php
sms/sms.js
sms/sms.php
sound/msg.wav
sound/notice.wav
supplier/agency.php
supplier/article.php
supplier/attention_list.php
supplier/attr_img_upload.php
supplier/auction.php
supplier/back.php
supplier/bonus.php
supplier/category.php
supplier/check_file_priv.php
supplier/cloud.php
supplier/comment_manage.php
supplier/convert.php
supplier/cron.php
supplier/customer.php
supplier/ecshopfiles_bk.md5
supplier/email_list.php
supplier/excel.php
supplier/favourable.php
supplier/filecheck.php
supplier/flashplay.php
supplier/fonts/FontAwesome.otf
supplier/fonts/fontawesome-webfont.eot
supplier/fonts/fontawesome-webfont.svg
supplier/fonts/fontawesome-webfont.ttf
supplier/fonts/fontawesome-webfont.woff
supplier/fonts/fontawesome-webfont.woff2
supplier/getTaoBaoGoods.php
supplier/get_password.php
supplier/goods.php
supplier/goods_auto.php
supplier/goods_batch.php
supplier/goods_booking.php
supplier/goods_export.php
supplier/goods_purchase_rate.php
supplier/goods_sell_detail.php
supplier/goods_stats.php
supplier/goods_tag.php
supplier/help.php
supplier/help/zh_cn/ad_position.xml
supplier/help/zh_cn/admin_logs.xml
supplier/help/zh_cn/ads.xml
supplier/help/zh_cn/article.xml
supplier/help/zh_cn/articlecat.xml
supplier/help/zh_cn/attribute.xml
supplier/help/zh_cn/bonus.xml
supplier/help/zh_cn/bonus_type.xml
supplier/help/zh_cn/brand.xml
supplier/help/zh_cn/card.xml
supplier/help/zh_cn/category.xml
supplier/help/zh_cn/comment_manage.xml
supplier/help/zh_cn/database.xml
supplier/help/zh_cn/friend_link.xml
supplier/help/zh_cn/gift.xml
supplier/help/zh_cn/goods.xml
supplier/help/zh_cn/goods_batch.xml
supplier/help/zh_cn/goods_booking.xml
supplier/help/zh_cn/goods_type.xml
supplier/help/zh_cn/group_buy.xml
supplier/help/zh_cn/index.xml
supplier/help/zh_cn/integrate.xml
supplier/help/zh_cn/mail_template.xml
supplier/help/zh_cn/order.xml
supplier/help/zh_cn/pack.xml
supplier/help/zh_cn/payment.xml
supplier/help/zh_cn/plugins.xml
supplier/help/zh_cn/prc.xml
supplier/help/zh_cn/privilege.xml
supplier/help/zh_cn/repay.xml
supplier/help/zh_cn/shipping.xml
supplier/help/zh_cn/shipping_area.xml
supplier/help/zh_cn/shophelp.xml
supplier/help/zh_cn/shopinfo.xml
supplier/help/zh_cn/sms.xml
supplier/help/zh_cn/snatch.xml
supplier/help/zh_cn/tag_manage.xml
supplier/help/zh_cn/template.xml
supplier/help/zh_cn/user_account.xml
supplier/help/zh_cn/user_msg.xml
supplier/help/zh_cn/user_rank.xml
supplier/help/zh_cn/users.xml
supplier/help/zh_cn/vote.xml
supplier/images/UI.jpg
supplier/images/UI_20.png
supplier/images/ajax_loader.gif
supplier/images/allico.png
supplier/images/area_link.gif
supplier/images/arrow.gif
supplier/images/arrow_left.gif
supplier/images/arrow_right.gif
supplier/images/bg.jpg
supplier/images/bg2.png
supplier/images/bg_repx.gif
supplier/images/big_bgcolor.jpg
supplier/images/book_open.gif
supplier/images/btn_close.gif
supplier/images/btn_drop.gif
supplier/images/btn_maximize.gif
supplier/images/btn_minimize.gif
supplier/images/build.png
supplier/images/button1.gif
supplier/images/button_bg.gif
supplier/images/charts/MSColumn3D.swf
supplier/images/charts/MSLine.swf
supplier/images/charts/ScrollColumn2D.swf
supplier/images/charts/bar.swf
supplier/images/charts/column.swf
supplier/images/charts/column3d.swf
supplier/images/charts/line.swf
supplier/images/charts/pie3d.swf
supplier/images/charts/pipe.swf
supplier/images/close.gif
supplier/images/close.png
supplier/images/color_selecter.gif
supplier/images/comment_icon.png
supplier/images/confirm.gif
supplier/images/ecshop_logo.gif
supplier/images/ecshop_logo.png
supplier/images/empty.gif
supplier/images/filecheck.gif
supplier/images/header-profile.png
supplier/images/help_menu-b5.gif
supplier/images/help_menu-plus.gif
supplier/images/help_menu_list.png
supplier/images/icon1.png
supplier/images/icon2.png
supplier/images/icon_account.gif
supplier/images/icon_add.gif
supplier/images/icon_copy.gif
supplier/images/icon_docs.gif
supplier/images/icon_drop.gif
supplier/images/icon_edit.gif
supplier/images/icon_js.gif
supplier/images/icon_output.gif
supplier/images/icon_priv.gif
supplier/images/icon_search.gif
supplier/images/icon_send_bonus.gif
supplier/images/icon_title.gif
supplier/images/icon_trash.gif
supplier/images/icon_view.gif
supplier/images/import.png
supplier/images/information.gif
supplier/images/item-hd1.png
supplier/images/item-hd2.png
supplier/images/item-hd3.png
supplier/images/left_line.gif
supplier/images/loader.gif
supplier/images/login.png
supplier/images/login_bg.gif
supplier/images/login_bg.png
supplier/images/login_dl.jpg
supplier/images/login_dl.png
supplier/images/login_line.gif
supplier/images/loginbg.gif
supplier/images/loginbg.jpg
supplier/images/menu_arrow.gif
supplier/images/menu_arrowa.gif
supplier/images/menu_bottom.gif
supplier/images/menu_minus.gif
supplier/images/menu_plus.gif
supplier/images/menubg.gif
supplier/images/menuline.gif
supplier/images/midd.png
supplier/images/no.gif
supplier/images/notice.gif
supplier/images/numberico.png
supplier/images/online.swf
supplier/images/online.wav
supplier/images/picflag.gif
supplier/images/picnoflag.gif
supplier/images/profile_small.jpg
supplier/images/show_right.gif
supplier/images/sort_asc.gif
supplier/images/sort_desc.gif
supplier/images/stars0.gif
supplier/images/stars1.gif
supplier/images/stars2.gif
supplier/images/stars3.gif
supplier/images/stars4.gif
supplier/images/stars5.gif
supplier/images/stepnum.gif
supplier/images/th_bg.gif
supplier/images/thbg.gif
supplier/images/top_bg.gif
supplier/images/top_header.png
supplier/images/top_header_hover.png
supplier/images/top_line.gif
supplier/images/top_loader.gif
supplier/images/ui_17.png
supplier/images/warning.gif
supplier/images/warning_small.gif
supplier/images/xiaoguotu.JPG
supplier/images/yes.gif
supplier/includes/cls_exchange.php
supplier/includes/cls_google_sitemap.php
supplier/includes/cls_phpzip.php
supplier/includes/cls_sql_dump.php
supplier/includes/inc_menu.php
supplier/includes/inc_priv.php
supplier/includes/init.php
supplier/includes/lib_goods.php
supplier/includes/lib_main.php
supplier/includes/lib_template.php
supplier/index.php
supplier/js/category_selecter.js
supplier/js/chosen.jquery.min.js
supplier/js/colorselector.js
supplier/js/colorselector_topic.js
supplier/js/common.js
supplier/js/diyUpload/css/diyUpload.css
supplier/js/diyUpload/css/webuploader.css
supplier/js/diyUpload/images/bgblack.png
supplier/js/diyUpload/images/check_alt.png
supplier/js/diyUpload/images/x_alt.png
supplier/js/diyUpload/js/diyUpload.js
supplier/js/diyUpload/js/jquery.js
supplier/js/diyUpload/js/webuploader.html5only.min.js
supplier/js/echarts-all.js
supplier/js/jquery-1.6.1.js
supplier/js/jquery-1.6.2.min.js
supplier/js/jquery.bigcolorpicker.js
supplier/js/jquery.js
supplier/js/jquery.json.js
supplier/js/jquery.ztree.all-3.5.min.js
supplier/js/listtable.js
supplier/js/md5.js
supplier/js/selectbox.js
supplier/js/selectzone.js
supplier/js/selectzone_bd.js
supplier/js/syntaxHighlighter/shAutoloader.js
supplier/js/syntaxHighlighter/shBrushAS3.js
supplier/js/syntaxHighlighter/shBrushAppleScript.js
supplier/js/syntaxHighlighter/shBrushBash.js
supplier/js/syntaxHighlighter/shBrushCSharp.js
supplier/js/syntaxHighlighter/shBrushColdFusion.js
supplier/js/syntaxHighlighter/shBrushCpp.js
supplier/js/syntaxHighlighter/shBrushCss.js
supplier/js/syntaxHighlighter/shBrushDelphi.js
supplier/js/syntaxHighlighter/shBrushDiff.js
supplier/js/syntaxHighlighter/shBrushErlang.js
supplier/js/syntaxHighlighter/shBrushGroovy.js
supplier/js/syntaxHighlighter/shBrushJScript.js
supplier/js/syntaxHighlighter/shBrushJava.js
supplier/js/syntaxHighlighter/shBrushJavaFX.js
supplier/js/syntaxHighlighter/shBrushPerl.js
supplier/js/syntaxHighlighter/shBrushPhp.js
supplier/js/syntaxHighlighter/shBrushPlain.js
supplier/js/syntaxHighlighter/shBrushPowerShell.js
supplier/js/syntaxHighlighter/shBrushPython.js
supplier/js/syntaxHighlighter/shBrushRuby.js
supplier/js/syntaxHighlighter/shBrushSass.js
supplier/js/syntaxHighlighter/shBrushScala.js
supplier/js/syntaxHighlighter/shBrushSql.js
supplier/js/syntaxHighlighter/shBrushVb.js
supplier/js/syntaxHighlighter/shBrushXml.js
supplier/js/syntaxHighlighter/shCore.js
supplier/js/syntaxHighlighter/shLegacy.js
supplier/js/tab.js
supplier/js/todolist.js
supplier/js/topbar.js
supplier/js/transport_bd.js
supplier/js/validate/jquery.validate.js
supplier/js/validate/jquery.validate.min.js
supplier/js/validate/messages_zh.js
supplier/js/validator.js
supplier/navigator.php
supplier/order.php
supplier/order_comment.php
supplier/order_stats.php
supplier/pickup_point.php
supplier/pre_sale.php
supplier/privilege.php
supplier/refund_stats.php
supplier/repair_stats.php
supplier/returned_stats.php
supplier/sell_area_stats.php
supplier/sell_stats.php
supplier/shaidan.php
supplier/shipping.php
supplier/shipping_area.php
supplier/shop_config.php
supplier/shop_header.php
supplier/shophelp.php
supplier/shopinfo.php
supplier/sms_url.php
supplier/snatch.php
supplier/start_article.php
supplier/street.php
supplier/styles/bootstrap.min.css
supplier/styles/chosen/chosen-sprite.png
supplier/styles/chosen/chosen.css
supplier/styles/font-awesome.min.css
supplier/styles/general.css
supplier/styles/jquery.bigcolorpicker.css
supplier/styles/main.css
supplier/styles/store.css
supplier/styles/syntaxHighlighter/shCore.css
supplier/styles/syntaxHighlighter/shCoreDefault.css
supplier/styles/syntaxHighlighter/shCoreDjango.css
supplier/styles/syntaxHighlighter/shCoreEclipse.css
supplier/styles/syntaxHighlighter/shCoreEmacs.css
supplier/styles/syntaxHighlighter/shCoreFadeToGrey.css
supplier/styles/syntaxHighlighter/shCoreMDUltra.css
supplier/styles/syntaxHighlighter/shCoreMidnight.css
supplier/styles/syntaxHighlighter/shCoreRDark.css
supplier/styles/syntaxHighlighter/shThemeDefault.css
supplier/styles/syntaxHighlighter/shThemeDjango.css
supplier/styles/syntaxHighlighter/shThemeEclipse.css
supplier/styles/syntaxHighlighter/shThemeEmacs.css
supplier/styles/syntaxHighlighter/shThemeFadeToGrey.css
supplier/styles/syntaxHighlighter/shThemeMDUltra.css
supplier/styles/syntaxHighlighter/shThemeMidnight.css
supplier/styles/syntaxHighlighter/shThemeRDark.css
supplier/styles/zTree/img/diy/1_close.png
supplier/styles/zTree/img/diy/1_open.png
supplier/styles/zTree/img/diy/2.png
supplier/styles/zTree/img/diy/3.png
supplier/styles/zTree/img/diy/4.png
supplier/styles/zTree/img/diy/5.png
supplier/styles/zTree/img/diy/6.png
supplier/styles/zTree/img/diy/7.png
supplier/styles/zTree/img/diy/8.png
supplier/styles/zTree/img/diy/9.png
supplier/styles/zTree/img/line_conn.gif
supplier/styles/zTree/img/loading.gif
supplier/styles/zTree/img/zTreeStandard.gif
supplier/styles/zTree/img/zTreeStandard.png
supplier/styles/zTree/zTreeStyle.css
supplier/supplier.php
supplier/supplier_order.php
supplier/supplier_rank.php
supplier/supplier_rebate.php
supplier/supplier_rebate_1.php
supplier/template.php
supplier/templates/about_us.htm
supplier/templates/account_info.htm
supplier/templates/account_list.htm
supplier/templates/admin_logs.htm
supplier/templates/affiliate.htm
supplier/templates/affiliate_ck_list.htm
supplier/templates/affiliate_list.htm
supplier/templates/article_info.htm
supplier/templates/article_list.htm
supplier/templates/attention_list.htm
supplier/templates/auction_info.htm
supplier/templates/auction_list.htm
supplier/templates/auction_log.htm
supplier/templates/back_info.htm
supplier/templates/back_info_2.htm
supplier/templates/back_list.htm
supplier/templates/back_list_2.htm
supplier/templates/back_refund.htm
supplier/templates/batch_card_confirm.htm
supplier/templates/batch_card_info.htm
supplier/templates/bonus_by_goods.htm
supplier/templates/bonus_by_print.htm
supplier/templates/bonus_by_user.htm
supplier/templates/bonus_list.htm
supplier/templates/bonus_type.htm
supplier/templates/bonus_type_info.htm
supplier/templates/booking_info.htm
supplier/templates/booking_list.htm
supplier/templates/calculator.htm
supplier/templates/card_info.htm
supplier/templates/card_list.htm
supplier/templates/category_info.htm
supplier/templates/category_list.htm
supplier/templates/category_move.htm
supplier/templates/category_search.htm
supplier/templates/comment_info.htm
supplier/templates/comment_list.htm
supplier/templates/convert_main.htm
supplier/templates/customer_info.htm
supplier/templates/customer_list.htm
supplier/templates/delivery_info.htm
supplier/templates/delivery_list.htm
supplier/templates/drag.htm
supplier/templates/excel.htm
supplier/templates/favourable_info.htm
supplier/templates/favourable_list.htm
supplier/templates/file_priv.html
supplier/templates/filecheck.htm
supplier/templates/flashplay_add.htm
supplier/templates/flashplay_list.htm
supplier/templates/flow_stats.htm
supplier/templates/get_pwd.htm
supplier/templates/gettaobaogoods.html
supplier/templates/gettaobaogoodsview.html
supplier/templates/goods_auto.htm
supplier/templates/goods_batch_add.htm
supplier/templates/goods_batch_confirm.htm
supplier/templates/goods_batch_edit.htm
supplier/templates/goods_batch_select.htm
supplier/templates/goods_booking.php
supplier/templates/goods_export.htm
supplier/templates/goods_info.htm
supplier/templates/goods_list.htm
supplier/templates/goods_purchase_rate.htm
supplier/templates/goods_search.htm
supplier/templates/goods_sell_detail.htm
supplier/templates/goods_show_image.htm
supplier/templates/goods_stats.htm
supplier/templates/goods_tag_info.htm
supplier/templates/goods_tag_list.htm
supplier/templates/goods_trash.htm
supplier/templates/guest_stats.htm
supplier/templates/index.htm
supplier/templates/language_list.htm
supplier/templates/license.htm
supplier/templates/login.htm
supplier/templates/menu.htm
supplier/templates/merge_order.htm
supplier/templates/message.htm
supplier/templates/msg_add.htm
supplier/templates/msg_info.htm
supplier/templates/msg_list.htm
supplier/templates/navigator.htm
supplier/templates/navigator_add.htm
supplier/templates/optimize.htm
supplier/templates/order_comment_list.htm
supplier/templates/order_delivery_info.htm
supplier/templates/order_goods_info.htm
supplier/templates/order_info.htm
supplier/templates/order_list.htm
supplier/templates/order_operate.htm
supplier/templates/order_operate_info.htm
supplier/templates/order_query.htm
supplier/templates/order_stats.htm
supplier/templates/order_step.htm
supplier/templates/order_templates.htm
supplier/templates/page.htm
supplier/templates/pagefooter.htm
supplier/templates/pageheader.htm
supplier/templates/pageheader_bd.htm
supplier/templates/pickup_point_batch_add.htm
supplier/templates/pickup_point_info.htm
supplier/templates/pickup_point_list.htm
supplier/templates/pickup_point_upload_confirm.htm
supplier/templates/picture_batch.htm
supplier/templates/plugins.htm
supplier/templates/pre_sale_info.htm
supplier/templates/pre_sale_list.htm
supplier/templates/print.htm
supplier/templates/print_index.htm
supplier/templates/privilege_allot.htm
supplier/templates/privilege_info.htm
supplier/templates/privilege_list.htm
supplier/templates/product_info.htm
supplier/templates/rebate_order.htm
supplier/templates/rebate_order2.htm
supplier/templates/refund_stats.htm
supplier/templates/repair_stats.htm
supplier/templates/repay_info.htm
supplier/templates/replenish_info.htm
supplier/templates/replenish_list.htm
supplier/templates/report_pv.htm
supplier/templates/returned_stats.htm
supplier/templates/sell_area_stats.htm
supplier/templates/sell_stats.htm
supplier/templates/shaidan_info.htm
supplier/templates/shaidan_list.htm
supplier/templates/shaidan_search.htm
supplier/templates/shipping_area_info.htm
supplier/templates/shipping_area_list.htm
supplier/templates/shipping_list.htm
supplier/templates/shipping_template.htm
supplier/templates/shop_config.htm
supplier/templates/shop_config_form.htm
supplier/templates/shop_header.htm
supplier/templates/sitemap.htm
supplier/templates/start.htm
supplier/templates/start_article.htm
supplier/templates/start_bk.htm
supplier/templates/street_info.htm
supplier/templates/supplier_info.htm
supplier/templates/supplier_list.htm
supplier/templates/supplier_order_list1.htm
supplier/templates/supplier_order_list2.htm
supplier/templates/supplier_pageheader.htm
supplier/templates/supplier_rank.htm
supplier/templates/supplier_rank_info.htm
supplier/templates/supplier_rebate_info.htm
supplier/templates/supplier_rebate_list.htm
supplier/templates/supplier_rebate_view.htm
supplier/templates/suppliers_info.htm
supplier/templates/suppliers_list.htm
supplier/templates/template_library.htm
supplier/templates/template_setup.htm
supplier/templates/templates_backup.htm
supplier/templates/templates_list.htm
supplier/templates/third_customer_info.htm
supplier/templates/third_customer_list.htm
supplier/templates/top.htm
supplier/templates/virtual_card_change.htm
supplier/templates/virtual_goods_card_info.htm
supplier/templates/virtual_goods_card_list.htm
supplier/templates/virtual_goods_info.htm
supplier/templates/virtual_goods_list.htm
supplier/templates/virtual_goods_search.htm
supplier/templates/virtual_validate.htm
supplier/templates/visit_sold.htm
supplier/templates/wholesale_batch_info.htm
supplier/templates/wholesale_info.htm
supplier/templates/wholesale_list.htm
supplier/third_customer.php
supplier/user_msg.php
supplier/virtual_card.php
supplier/virtual_goods.php
supplier/virtual_goods_card.php
supplier/visit_sold.php
supplier/vote.php
supplier/wholesale.php
temp/backup/index.htm
temp/compiled/admin/goods_list.htm.php
temp/compiled/admin/goods_search.htm.php
temp/compiled/admin/goods_trash.htm.php
temp/compiled/admin/message.htm.php
temp/compiled/admin/order_goods_info.htm.php
temp/compiled/admin/order_list.htm.php
temp/compiled/admin/page.htm.php
temp/compiled/admin/pagefooter.htm.php
temp/compiled/admin/pageheader.htm.php
temp/compiled/supplier/category_info.htm.php
temp/compiled/supplier/category_list.htm.php
temp/compiled/supplier/category_search.htm.php
temp/compiled/supplier/drag.htm.php
temp/compiled/supplier/goods_info.htm.php
temp/compiled/supplier/goods_list.htm.php
temp/compiled/supplier/goods_search.htm.php
temp/compiled/supplier/index.htm.php
temp/compiled/supplier/login.htm.php
temp/compiled/supplier/menu.htm.php
temp/compiled/supplier/message.htm.php
temp/compiled/supplier/order_list.htm.php
temp/compiled/supplier/page.htm.php
temp/compiled/supplier/pagefooter.htm.php
temp/compiled/supplier/pageheader.htm.php
temp/compiled/supplier/pageheader_bd.htm.php
temp/compiled/supplier/shop_config.htm.php
temp/compiled/supplier/shop_config_form.htm.php
temp/compiled/supplier/start.htm.php
temp/compiled/supplier/street_info.htm.php
temp/compiled/supplier/top.htm.php
temp/index.htm
temp/query_caches/index.htm
temp/query_caches/sqlcache_config_file_a95cf7d7f41007d0e68879093acb8957.php
temp/static_caches/cat_option_static.php
temp/static_caches/cat_pid_releate.php
temp/static_caches/index.htm
temp/static_caches/shop_config.php |