💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
:-: 淘宝导入 文件路径:shop/controllers/Seller/Goods/TBImportCtl.php; ###### 导入csv文件 商品分类: <select name="sgcate_id[]" class="sgcategory"> <option value="0"><?=__('请选择')?>...</option> <?php if (!empty($shop_goods_cat_rows)){ ?> <?php foreach ($shop_goods_cat_rows as $shop_goods_cat_id => $shop_goods_cat_data) { ?> <option data-parent_id="<?= $shop_goods_cat_data['parent_id'] ?>" value="<?= $shop_goods_cat_id ?>"><?= $shop_goods_cat_data['shop_goods_cat_name'] ?></option> <?php } ?> <?php } else { ?> <option value="-1"><?=__('暂无分类')?>...</option> <?php } ?> </select> $.get(SITE_URL + '?ctl=Seller_Goods_Cat&met=cat&typ=json', {cat_id: cat_id}, function(data){ if (data.status == 200) { //没有数据 if(data.data.length === 0){ return false; } var option_rows = [], cat_data = data.data; if (change) { option_rows.push("<option value='0'>请选择</option>"); } for (var i = 0; i < cat_data.length; i++) { option_rows.push("<option value=" + cat_data[i].cat_id + ">" + cat_data[i].cat_name + "</option>"); } if (change){ //first create select if (option_rows.length > 0) { //default first goods_cat $("#gc_id").val(cat_data[0].cat_id), $("#cat_name").val(cat_data[0].cat_name); var next_deep = deep + 1; $("span[nctype=gc" + next_deep + "]").append("<select data-deep=" + next_deep + ">" + option_rows.join("") + "</select>"); } } else { $select.append(option_rows.join("")); } } else { Public.tips.error(data.msg); } }) 所在地: function getDistrictList(province_id, change) { change && $("#city_id").remove(); if ($.inArray(province_id, [1, 2, 9, 22]) != -1) return; $.get(SITE_URL + '?ctl=Base_District&met=district&pid=0&typ=json', {pid: province_id}, function (data) { if (data.status == 200) { var district_data = data.data.items, district_row = []; for ( var i=0; i<district_data.length; i++ ) { district_row.push("<option value=" + district_data[i].district_id + ">" + district_data[i].district_name + "</option>"); } district_row = district_row.join(""); if (change) { $('#province_id').after("<select id='city_id'>" + district_row + "</select>"); } else { $('#province_id').append(district_row); } } else { Public.tips.error(data.msg) } }); } 新增分类: $('#add_sgcategory').on('click', function () { $(".sgcategory:last").after($(".sgcategory:last").clone(true).val(0)); }); 文件上传: 上传路径:shop/controllers/UploadCtl.php; 方法名:uploadGoodsExcel(); ##### 上传商品图片 实例化 uploader = WebUploader.create({ pick: { id: '#filePicker', label: '点击选择图片' }, formData: { uid: 123 }, dnd: '#dndArea', paste: '#uploader', chunked: false, chunkSize: 512 * 1024, accept: { title: 'taobaoImage', extensions: "tbi,jpg" }, swf: BASE_URL + '/shop/static/common/js/Uploader.swf', server: SITE_URL + "?ctl=Upload&action=uploadTaoBaoImage&typ=json", fileVal: 'upfile', // 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候,把图片打开。 disableGlobalDnd: true, fileNumLimit: 300, fileSizeLimit: 200 * 1024 * 1024, // 200 M fileSingleSizeLimit: 50 * 1024 * 1024 // 50 M }); 上传路径:shop/controllers/UploadCtl.php; 方法名:uploadTaoBaoImage() // 生成上传实例对象并完成上传 $up = new Yf_Uploader($field_name, $config, "upload"); //修改goods_common表 $goodsCommonModel->editCommon($common_id, array("common_image" => $image_url)); //修改goods_image $goodsImagesModel->editImages( $images_id, array("images_image" => $image_url) ); //修改goods_base $goodsBaseModel->editBase($goods_id, $update_goods_data, false);