require_once 'dbconnect_utf.php';
require_once '../init.php';
session_start();
require_once 'token_handle.php';
require_once './api/getimgbaseurl.php';
$imgbaseurl=getImgBaseUrl();
//echo $token.", ";
//echo "uid ".$tokenArr[3]." , ";
//
//
//echo ";System maintenece";
//
//exit();
?>
我的收藏 - 乐木几var _hmt = _hmt || [];_hmt.push(['_setCustomVar', 4, 'yihaodian', 'yihaodian', 1 ]);
$uid=$_SESSION['uid'];
function getProductInfo($pid){
$sql=sprintf("select * from blog_article where aid=%d",$pid);
$q=mysql_query($sql);
$row=mysql_fetch_array($q);
return $row;
}
function getcollection($uid){
$sql=sprintf("select * from blog_collection where user_id=%d order by id desc",$uid);
$q=mysql_query($sql);
$row2=array();
while($row=mysql_fetch_array($q)){
$row2[]=$row;
}
return $row2;
}
$collection=getcollection($uid);
$pro=array();
foreach($collection as $c){
$temp=getProductInfo($c['pid']);
if($temp){
$pro[$c['pid']]=$temp;
$pro[$c['pid']]['id']=$c['id'];
}
}
$str='';
foreach($pro as $p){
$str.='
'.$p['subject'].'
'.$p['F_Price'].'
'.($p['oldprice']?$p['oldprice']:($p['F_Price']+10)).'
}
if($pro){
echo $str;
}
else{
echo '
}
?>
buy_car('.cartBtn');//点击购物车按钮
function deleteProduct(a) {
$.ajax({
url:"ajaxAddCart.php",
type: "GET",
data:{"id":a,"act":"delcollection"},
dataTypea:'text',
success:function(e){
// alert(e);
if(e==1){
window.location.href="mycollection.php";
}else{
alert("失败");
}
},
error:
function(){
alert("error");
}
});
}
$(function() {
//点击 删除 弹框
// $('dl .delRedBtn').click(function(){
// if($(this).closest('dl').hasClass('out') == false){
// $('.tipMask, .tip').show();
// fSetAlertTipPosition('#canclOdr');
// }
// });
//点击 否 关闭 取消订单 弹框
$('#noCancl').click(function() {
$('.tipMask, .tip').hide();
});
});
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write("
//搜索自动提示
sechSgst();
function check(){
//保存搜索词
saveSearchHistory();
var keyword=document.getElementById("keywordfoot").value;
keyword = keyword.replace(/\s/gi,"");
if(keyword==""){
// alert("搜索关键字不能为空");
return false;
}
url = "/mw/search?keyword="+keyword;
commonStatistics('',"linkPosition","bottomsearch",url);
}
//埋点统计公共方法
function commonStatistics(formName,typekey,typevalue,locationUrl){
var posetype="1";
if(typekey=='linkPosition') {
posetype ="1";
}else if(typekey=='buttonPosition'){
posetype ="2";
}else if(typekey=='pmId'){
posetype = "3";
}
addTrackPositionToCookie(posetype,typevalue);
if(locationUrl != null && locationUrl != ''){
window.location = locationUrl;
}else{
gotracker(posetype,typevalue,null);
}
}
//在与用户相关的链接后面加随机数
var myDate = new Date();
var now=myDate.getTime();
//我的购物车
var obj=document.getElementById("mycart");
if(obj!=null){
var href="/mw/cart?et="+now+"&er="+getRandomString(10);
obj.setAttribute('href', href);
}
//我的1号店
obj=document.getElementById("mystore");
if(obj!=null){
var href="/mw/mycenter?et="+now+"&er="+getRandomString(10);
obj.setAttribute('href', href);
}
//面包屑我的1号店
obj=document.getElementById("crumbsmystore");
if(obj!=null){
var href="/mw/mycenter?et="+now+"&er="+getRandomString(10);
obj.setAttribute('href', href);
}
//切换省份
obj=document.getElementById("changeprovince");
if(obj!=null){
var href="/mw/provice?et="+now+"&er="+getRandomString(10);
obj.setAttribute('href', href);
}
//1号商城订单
obj=document.getElementById("mallorder");
if(obj!=null){
var href=document.getElementById("mallorder").getAttribute("href")+"&et="+now+"&er="+getRandomString(10);
obj.setAttribute('href', href);
}
var wuserId = null;
userinfo();
function userinfo(){
var myDate = new Date();
var now=myDate.getTime();
$.ajax({
type: "POST",
url: "/mw/indexinfo?et="+now+"&er="+getRandomString(10),
data: "",
dataType : "",
success: function(backdata) {
var data = backdata;
var data = backdata.split("∑");
if(data[0]!=null&&data[0]!=''){
$("#qj").append(data[0]);
$("#qj").show();
}
$("#bquantity").append(data[1]);
$("#cprovincename").append(data[2]);
if(data[0] !=""){
$("#searchBtn").click();
}
//data[4]:token data[5]:sharetokenflag
if(data[4]== null || data[4]== "null" ){
data[4] ="";
}
if(data[5]== null || data[5]== "null" ){
data[5] ="";
}
if(data[4] !="" &&$('#logstatus').hasClass('noLog')){ //区分用户登录状态,登录后在我的1号店图标上加勾
$('#logstatus').removeClass('noLog');
}
}
});
}
/*
清空
* */
function clearcollection(){
$.ajax({
url:"ajaxAddCart.php",
type: "GET",
data:{"cartid":1,"act":"clearcollection"},
dataType:'text',
success:function(e){
if(e==1){
window.location.href="mycollection.php";
}else{
alert("删除失败");
}
},
error:
function(){
alert("error");
}
});
}
function getCookie(name)
{
var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
if(arr=document.cookie.match(reg)){
return (arr[2]);
}
else{
return "";
}
}
function success_jsonpCallback(param){
//alert(param);
}
//清除yhdcomefromwebsite这个cookie
function backwap(url)
{
debugger;
delCookie("yhdcomefromwebsite");
window.location.href =url+"?websiteflag=true";
}
function delCookie(name){//为了删除指定名称的cookie,可以将其过期时间设定为一个过去的时间
var date = new Date();
date.setTime(date.getTime() - 10000);
document.cookie = name + "=a; expires=" + date.toGMTString();
}
//保存用户搜索历史记录
function saveSearchHistory(){
var keyword=document.getElementById("keywordfoot").value.toString();
//将用户的搜索关键词保存到local storage中 ,不支持则保存到cookie中 ,最多保留20个 ,去重,且过滤掉空字符串
var shistory="";
var arrhistory="";
if(window.localStorage){
if(window.localStorage.getItem("historykeyword")!=null){
shistory = window.localStorage.getItem("historykeyword");
arrhistory = window.localStorage.getItem("historykeyword").split("|");
}
}else{
if(getCookie("historykeyword")!=null){
shistory = getCookie("historykeyword");
arrhistory = getCookie("historykeyword").split("|");
}
}
var isdiff = 0;
if(arrhistory!=""&&arrhistory.length>0){
$.each(arrhistory,function(index,item){
if(keyword==item){
isdiff = 1;
}
});
}
keyword=keyword.replace(/(^\s*)|(\s*$)/g, "");
if(keyword==""){ //搜索历史过滤空字符串
isdiff = 1;
}
if(isdiff==0){
if(arrhistory!=""&&arrhistory.length==20){
arrhistory.splice(0,1);
shistory = arrhistory.join("|");
shistory+="|"+keyword;
}else{
if(arrhistory.length<1){
shistory+=keyword;
}else{
shistory+="|"+keyword;
}
}
if(window.localStorage){
window.localStorage.setItem("historykeyword",shistory);
}else{
setCookie("historykeyword",shistory);
}
}
}
//在与用户相关的链接后面加随机数
var myDate = new Date();
var now = myDate.getTime();
var obj = document.getElementById("yhdfav");
if (obj != null) {
var aHref = obj.getAttribute('href');
aHref = aHref + "&et=" + now + "&er=" + getRandomString(10), obj
.setAttribute('href', aHref);
}
obj = document.getElementById("mallfav");
if (obj != null) {
var aHref = obj.getAttribute('href');
aHref = aHref + "&et=" + now + "&er=" + getRandomString(10), obj
.setAttribute('href', aHref);
}
function addcart(pmId, buyNum) {
var now = new Date();
/* commonStatistics('', 'buttonPosition', 'addcart', '');
commonStatistics("","pmId",pmId,""); */
addcartStatistics(pmId);
$(".ins p").text("");
$.ajax({
type : "POST",
url : "/mw/buyproduct/" + pmId + "/" + buyNum + "?now=" + now,
data : "",
dataType : "",
success : function(backdata) {
$(".ins p").text(backdata);
if (backdata == '添加购物车成功!') {
fAddCartNum(); // 加入成功后数量才变化
}
}
});
}
function changeMyFavState(flag, top, content1, content2) {
var flagTag = document.getElementById(flag);
var topFlag = document.getElementById(top);
var contentFlag1s = document.querySelectorAll(content1);
var contentFlag2s = document.querySelectorAll(content2);
if (flagTag != null) {
var flagValue = flagTag.value;
if (flagValue == 1) {
//可编辑状态
if (topFlag != null) {
topFlag.innerHTML = "完成";
}
if (contentFlag1s != null) {
for ( var i = 0; i < contentFlag1s.length; i++) {
contentFlag1s[i].style.display = "none";
}
}
if (contentFlag2s != null) {
for ( var i = 0; i < contentFlag2s.length; i++) {
contentFlag2s[i].style.display = "block";
}
}
flagTag.value = 2;
} else if (flagValue == 2) {
//可完成状态
if (topFlag != null) {
topFlag.innerHTML = "编辑";
}
if (contentFlag1s != null) {
for ( var i = 0; i < contentFlag1s.length; i++) {
contentFlag1s[i].style.display = "block";
}
}
if (contentFlag2s != null) {
for ( var i = 0; i < contentFlag2s.length; i++) {
contentFlag2s[i].style.display = "none";
}
}
flagTag.value = 1;
}
}
}
// $(function(){
//点击 删除 弹框
// $('dl .delRedBtn').click(function(){
// if($(this).closest('dl').hasClass('out') == false){
// $('.tipMask, .tip').show();
// fSetAlertTipPosition('#canclOdr');
// $('#deleteCertain').setAttribute("href","");
// }
// });
//点击 否 关闭 取消订单 弹框
// $('#noCancl').click(function(){
// $('.tipMask, .tip').hide();
// });
//});
一键复制
编辑
Web IDE
原始数据
按行查看
历史