<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<%link="person_favoriteadd.asp?checks="&request("checks")&""%>
<!--#include file="checkpmember.asp" -->
<!--#include file="flagandexpend.asp" -->
<%'是否可收藏职位
If CheckPFlag("Plimits",0)=False then
	response.write "<script language=javascript>alert('您所在的会员组不能收藏职位，请联系网站客服进行升级！');location.href='javascript:history.back()';</script>"
	response.end()
end if
checks=trim(request("checks"))
set rs=Server.CreateObject("Adodb.Recordset")
hires=split(checks,",")
t=0 '成功收藏数
for i=0 to ubound(hires)
	id=trim(hires(i))
	sql="select hire_id,hire_comname,hire_place,hire_cmember from JOB_C_hire where hire_id="&id
	rs.open sql,conn,1,1
	hireid=rs("hire_id")
	comname=rs("hire_comname")
	place=rs("hire_place")
	cmember=rs("hire_cmember")
	rs.close
	sql="select * from JOB_P_myfavorite where myfavorite_hireid="&hireid&" and myfavorite_pmember='"&pmember_login&"'" '存入收藏夹
	rs.open sql,conn,3,3
	if rs.eof then
		If CheckPFlag("Plimits",1)=False then
			If CheckPFlag("Pdianshus",0)=False then
				response.write "<script language=javascript>alert('恭喜您成功收藏"&t&"个职位！\n由于您收藏的数量已达到上限（或无可用点数），暂不能继续收藏，如需继续收藏请联系网站客服进行升级！');location.href='javascript:window.close()';</script>"
				response.end()
			else
				Call PayLog(pmember_login,1,"收藏"&comname&"发布的“"&place&"”职位扣点",Group_Pdianshus(0),0)
			end if
		else
			Call PayLog(pmember_login,1,"收藏"&comname&"发布的“"&place&"”职位",0,0)
		end if
	rs.addnew
	rs("myfavorite_hireid")=hireid
	rs("myfavorite_comname")=comname
	rs("myfavorite_place")=place
	rs("myfavorite_pmember")=pmember_login
	rs("myfavorite_cmember")=cmember
	rs("myfavorite_date")=now()
	rs.update
	'修改收藏的职位数量
	if Pmyfavoritenums="" or isnull(Pmyfavoritenums) then
		conn.execute("update JOB_Member set Member_myfavoritenums=1,Member_activedate='"&now()&"' where member_login='"&pmember_login&"' and Member_typeid=1")
	else
		if CheckPFlag("Climits",1)=False Or Group_Plimits(1)=0 then
			conn.execute("update JOB_Member set Member_myfavoritenums=Member_myfavoritenums+1,Member_activedate='"&now()&"' where member_login='"&pmember_login&"' and Member_typeid=1")
		else
			conn.execute("update JOB_Member set Member_myfavoritenums=Member_myfavoritenums+1,Member_myfavoritenum=Member_myfavoritenum-1,Member_activedate='"&now()&"' where member_login='"&pmember_login&"' and Member_typeid=1")
		end if
	end if
	t=t+1 '记录成功数
	Call IncomeIntegral(pmember_login,1,-Group_Pintegrals(0))
	end if
	rs.close
next
set rs=nothing
conn.close
set conn=nothing
response.write("<script language=javascript>alert('恭喜您成功收藏"&t&"个职位，"&ubound(hires)+1-t&"个重复！');location.href='javascript:window.close()';</script>")
response.end
%>