SourceCode/jiouosdp/Scripts/Cars/Cart.js
(开头部分) 13KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
(function ($) {
var car_cookie = "car-cookie-name1606281";
var car_sumbit_cookie = "car_sumbit_cookie-car-cookie-name1606281";
var expires = 1;
jQuery.cart = {
//不存在时添加,存在时会更新(quantity=0时删除)
add: function (productguid, productname, price, marketprice, quantity, pic, inventory, groupguid) {
var len = arguments.length;
switch (len) {
case 7:
var car = $.cookie(car_cookie);
if (car != undefined && car != null) {
var oldproduct = JSON.parse(car);
var isexit = false;
var i = 0;
$.each(oldproduct.product, function () {
if (this.productguid == productguid) {
isexit = true
this.productname = productname;//修改
this.price = price;//修改
this.marketprice = marketprice;//修改
this.quantity = parseFloat(this.quantity) + parseFloat(quantity);//修改
this.pic = pic;//修改
this.inventory = inventory;
if (quantity == 0) {//删除
oldproduct.product.splice(i, 1);
}
return;
}
i++;
});
//不存在时添加
if (isexit == false) {
var product = { "productguid": productguid, "productname": productname, "price": price, "marketprice": marketprice, "quantity": quantity, "price": price, "pic": pic, "inventory": inventory };
oldproduct.product.push(product);
}
$.cookie(car_cookie, JSON.stringify(oldproduct), { expires: expires, path: '/' });
}
else {
var product = { "product": [{ "productguid": productguid, "productname": productname, "price": price, "marketprice": marketprice, "quantity": quantity, "price": price, "pic": pic, "inventory": inventory }] };
$.cookie(car_cookie, JSON.stringify(product), { expires: expires, path: '/' });
}
break;
case 8:
var car = $.cookie(car_cookie);
if (car != undefined && car != null) {
var oldproduct = JSON.parse(car);
var isexit = false;
var i = 0;
$.each(oldproduct.product, function () {
if (this.productguid == productguid && this.groupguid == groupguid) {
isexit = true
this.productname = productname;//修改
this.price = price;//修改
this.marketprice = marketprice;//修改
this.quantity = parseFloat(this.quantity) + parseFloat(quantity);//修改
this.pic = pic;//修改
this.inventory = inventory;
if (quantity == 0) {//删除
oldproduct.product.splice(i, 1);
后面还有 233 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。