Exemple #1
0
 $is_best = isset($_POST['is_best']) ? 1 : 0;
 $is_new = isset($_POST['is_new']) ? 1 : 0;
 $is_hot = isset($_POST['is_hot']) ? 1 : 0;
 $is_on_sale = isset($_POST['is_on_sale']) ? 1 : 0;
 $is_alone_sale = isset($_POST['is_alone_sale']) ? 1 : 0;
 $is_shipping = isset($_POST['is_shipping']) ? 1 : 0;
 $goods_number = isset($_POST['goods_number']) ? $_POST['goods_number'] : 0;
 $warn_number = isset($_POST['warn_number']) ? $_POST['warn_number'] : 0;
 $goods_type = isset($_POST['goods_type']) ? $_POST['goods_type'] : 0;
 $give_integral = isset($_POST['give_integral']) ? intval($_POST['give_integral']) : '-1';
 $rank_integral = isset($_POST['rank_integral']) ? intval($_POST['rank_integral']) : '-1';
 $suppliers_id = isset($_POST['suppliers_id']) ? intval($_POST['suppliers_id']) : '0';
 $goods_name_style = $_POST['goods_name_color'] . '+' . $_POST['goods_name_style'];
 $catgory_id = empty($_POST['cat_id']) ? '' : intval($_POST['cat_id']);
 $brand_id = empty($_POST['brand_id']) ? '' : intval($_POST['brand_id']);
 $goods_thumb = empty($goods_thumb) && !empty($_POST['goods_thumb_url']) && goods_parse_url($_POST['goods_thumb_url']) ? htmlspecialchars(trim($_POST['goods_thumb_url'])) : $goods_thumb;
 $goods_thumb = empty($goods_thumb) && isset($_POST['auto_thumb']) ? $goods_img : $goods_thumb;
 $goods_id = empty($_REQUEST[goods_id]) ? '' : intval($_REQUEST[goods_id]);
 /*add by hg for date 2014-03-26 商品所属代理商ID */
 $admin_id = $_SESSION['admin_id'];
 $adminRow = $db->getRow("select agency_user_id from " . $ecs->table('admin_user') . "where user_id = {$admin_id}");
 //print_r($adminRow);die;
 $admin_agency_id = $adminRow['agency_user_id'];
 /*end*/
 /* 入库 */
 $is_insert = 1;
 // ccx 后面加上去的,测试让他直接把供货商商品的信息直接插入到ecs_goods商品表当中
 /*ccx 判断ecs_goods 是否已经有了供货商商品的采购记录*/
 $sql = "SELECT COUNT(*) FROM " . $ecs->table('goods') . " WHERE goods_supplier_id = {$_REQUEST['goods_id']}";
 $goods_supplier_count = $db->getOne($sql);
 if ($goods_supplier_count == 0) {
Exemple #2
0
         $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, goods_name_style, goods_sn, " . "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " . "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " . "seller_note, goods_weight, goods_number, warn_number, integral, give_integral,is_special, is_best, is_new, is_hot, " . "is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, rank_integral, suppliers_id,admin_agency_id,wholesale_price,costing_price,start_num, goods_shipai,province_id,province_name,city_id,city_name,area_id,area_name, split_percent )" . "VALUES ('{$_POST['goods_name']}', '{$goods_name_style}', '{$goods_sn}', '{$catgory_id}', " . "'{$brand_id}', '{$shop_price}', '{$market_price}', '{$is_promote}','{$promote_price}', " . "'{$promote_start_date}', '{$promote_end_date}', '{$goods_img}', '{$goods_thumb}', '{$original_img}', " . "'{$_POST['keywords']}', '{$_POST['goods_brief']}', '{$_POST['seller_note']}', '{$goods_weight}', '{$goods_number}'," . " '{$warn_number}', '{$_POST['integral']}', '{$give_integral}','{$is_special}', '{$is_best}', '{$is_new}', '{$is_hot}', '{$is_on_sale}', '{$is_alone_sale}', {$is_shipping}, " . " '{$_POST['goods_desc']}', '" . gmtime() . "', '" . gmtime() . "', '{$goods_type}', '{$rank_integral}', '{$suppliers_id}','{$admin_agency_id}','{$wholesale_price}','{$costing_price}','{$start_num}', '{$_POST['goods_shipai']}',{$province_id},'{$province_name}',{$city_id},'{$city_name}',{$area_id},'{$area_name}', {$split_percent} )";
     } else {
         $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, goods_name_style, goods_sn, " . "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " . "promote_start_date, promote_end_date, goods_img, goods_thumb, original_img, keywords, goods_brief, " . "seller_note, goods_weight, goods_number, warn_number, integral, give_integral,is_special, is_new, is_hot, is_real, " . "is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral,admin_agency_id,  goods_shipai, split_percent )" . "VALUES ('{$_POST['goods_name']}', '{$goods_name_style}', '{$goods_sn}', '{$catgory_id}', " . "'{$brand_id}', '{$shop_price}', '{$market_price}', '{$is_promote}','{$promote_price}', " . "'{$promote_start_date}', '{$promote_end_date}', '{$goods_img}', '{$goods_thumb}', '{$original_img}', " . "'{$_POST['keywords']}', '{$_POST['goods_brief']}', '{$_POST['seller_note']}', '{$goods_weight}', '{$goods_number}'," . " '{$warn_number}', '{$_POST['integral']}', '{$give_integral}', '{$is_best}', '{$is_new}', '{$is_hot}', 0, '{$is_on_sale}', '{$is_alone_sale}', {$is_shipping}, " . " '{$_POST['goods_desc']}', '" . gmtime() . "', '" . gmtime() . "', '{$goods_type}', '{$code}', '{$rank_integral}', '{$admin_agency_id}', '{$_POST['goods_shipai']}', '{$split_percent}' )";
     }
 } else {
     /*add by hg for date 2014-03-26 判断代理商是否非法操作商品*/
     static_goods($_REQUEST['goods_id']);
     /*end*/
     /* 如果有上传图片,删除原来的商品图 */
     $sql = "SELECT goods_thumb, goods_img, original_img " . " FROM " . $ecs->table('goods') . " WHERE goods_id = '{$_REQUEST['goods_id']}'";
     $row = $db->getRow($sql);
     if ($proc_thumb && $goods_img && $row['goods_img'] && !goods_parse_url($row['goods_img'])) {
         @unlink(ROOT_PATH . $row['goods_img']);
         @unlink(ROOT_PATH . $row['original_img']);
     }
     if ($proc_thumb && $goods_thumb && $row['goods_thumb'] && !goods_parse_url($row['goods_thumb'])) {
         @unlink(ROOT_PATH . $row['goods_thumb']);
     }
     $sql = "UPDATE " . $ecs->table('goods') . " SET " . "goods_name = '{$_POST['goods_name']}', " . "goods_name_style = '{$goods_name_style}', " . "goods_sn = '{$goods_sn}', " . "cat_id = '{$catgory_id}', " . "brand_id = '{$brand_id}', " . "shop_price = '{$shop_price}', " . "market_price = '{$market_price}', " . "wholesale_price = '{$wholesale_price}', " . "costing_price = '{$costing_price}', " . "start_num = '{$start_num}', " . "is_promote = '{$is_promote}', " . "promote_price = '{$promote_price}', " . "promote_start_date = '{$promote_start_date}', " . "suppliers_id = '{$suppliers_id}', " . "split_percent = '{$split_percent}', " . "promote_end_date = '{$promote_end_date}', ";
     /* 如果有上传图片,需要更新数据库 */
     if ($goods_img) {
         $sql .= "goods_img = '{$goods_img}', original_img = '{$original_img}', ";
     }
     if ($goods_thumb) {
         $sql .= "goods_thumb = '{$goods_thumb}', ";
     }
     if ($code != '') {
         $sql .= "is_real=0, extension_code='{$code}', ";
     }
     if ($is_special && $province_id) {
         $sql .= "province_id = '{$province_id}', " . "province_name = '{$province_name}', " . "city_id = '{$city_id}', " . "city_name = '{$city_name}', " . "area_id = '{$area_id}', " . "area_name = '{$area_name}' ,";
Exemple #3
0
     } else {
         $sql = "INSERT INTO " . $ecs->table('goods') . " (goods_name, goods_name_style, goods_sn, " . "cat_id, brand_id, shop_price, market_price, is_promote, promote_price, " . "promote_start_date, promote_end_date, goods_img, goods_thumb, goods_middle, original_img, keywords, goods_brief, " . "seller_note, goods_weight, goods_number, warn_number, integral, give_integral, is_best, is_new, is_hot, is_real, " . "is_on_sale, is_alone_sale, is_shipping, goods_desc, add_time, last_update, goods_type, extension_code, rank_integral)" . "VALUES ('{$_POST['goods_name']}', '{$goods_name_style}', '{$goods_sn}', '{$catgory_id}', " . "'{$brand_id}', '{$shop_price}', '{$market_price}', '{$is_promote}','{$promote_price}', " . "'{$promote_start_date}', '{$promote_end_date}', '{$goods_img}', '{$goods_thumb}',  '{$goods_middle}', '{$original_img}', " . "'{$_POST['keywords']}', '{$_POST['goods_brief']}', '{$_POST['seller_note']}', '{$goods_weight}', '{$goods_number}'," . " '{$warn_number}', '{$_POST['integral']}', '{$give_integral}', '{$is_best}', '{$is_new}', '{$is_hot}', 0, '{$is_on_sale}', '{$is_alone_sale}', {$is_shipping}, " . " '{$_POST['goods_desc']}', '" . gmtime() . "', '" . gmtime() . "', '{$goods_type}', '{$code}', '{$rank_integral}')";
     }
 } else {
     /* 如果有上传图片,删除原来的商品图 */
     $sql = "SELECT goods_thumb, goods_middle,goods_img, original_img " . " FROM " . $ecs->table('goods') . " WHERE goods_id = '{$_REQUEST['goods_id']}'";
     $row = $db->getRow($sql);
     if ($proc_thumb && $goods_img && $row['goods_img'] && !goods_parse_url($row['goods_img'])) {
         @unlink(ROOT_PATH . $row['goods_img']);
         @unlink(ROOT_PATH . $row['original_img']);
         @unlink(ROOT_PATH . $row['middle_img']);
     }
     if ($proc_thumb && $goods_thumb && $row['goods_thumb'] && !goods_parse_url($row['goods_thumb'])) {
         @unlink(ROOT_PATH . $row['goods_thumb']);
     }
     if ($proc_middle && $goods_middle && $row['goods_middle'] && !goods_parse_url($row['goods_middle'])) {
         @unlink(ROOT_PATH . $row['goods_middle']);
     }
     $sql = "UPDATE " . $ecs->table('goods') . " SET " . "goods_name = '{$_POST['goods_name']}', " . "goods_name_style = '{$goods_name_style}', " . "goods_sn = '{$goods_sn}', " . "cat_id = '{$catgory_id}', " . "brand_id = '{$brand_id}', " . "shop_price = '{$shop_price}', " . "market_price = '{$market_price}', " . "is_promote = '{$is_promote}', " . "promote_price = '{$promote_price}', " . "promote_start_date = '{$promote_start_date}', " . "suppliers_id = '{$suppliers_id}', " . "promote_end_date = '{$promote_end_date}', ";
     /* 如果有上传图片,需要更新数据库 */
     if ($goods_img) {
         $sql .= "goods_img = '{$goods_img}', original_img = '{$original_img}', ";
     }
     if ($goods_thumb) {
         $sql .= "goods_thumb = '{$goods_thumb}', ";
     }
     if ($goods_middle) {
         $sql .= "goods_middle = '{$goods_middle}', ";
     }
     if ($code != '') {
         $sql .= "is_real=0, extension_code='{$code}', ";