11月11日<br />上午:<br />解決使用者重複提交的問題,這裡建立一個表,這個表記錄交易時間和交易狀態和交易流水id,通過檢索這個表來判斷使用者是否重複提交了。</p><p>見表sql如下:<br />CREATE TABLE IF NOT EXISTS `paypalinfo` (<br /> `id` int(11) NOT NULL auto_increment,<br /> `userid` int(11) NOT NULL,<br /> `txn_id` varchar(50) NOT NULL,<br /> `payment_date` date NOT NULL,<br /> `paymentStatus` varchar(50) NOT NULL,<br /> PRIMARY KEY (`id`)<br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;<br />下午:<br />解決使用者重複提交的問題,這裡我修改過的地方,給趙堅,然後幫我上傳到伺服器並進行測試。</p><p>1、首先在網站根目錄下建立一個php_paypal目錄,上傳paypal必須的檔案到這個目錄,配置好paypal的環境</p><p>2、建立payTip.class.php和payTip.tpl檔案分別到Page目錄下和Template目錄下,作為提交給怕paypal的入口。</p><p>3、建立paySuccess.class.php和paySuccess.tpl檔案分別到Page目錄下和Template目錄下,作為善後處理常式。</p><p>4、在BLL目錄下的User.class.php<br />public function updatePaymentInfo($txn_id,$payment_date,$payment_status,$first_name,$last_name) {<br />$payed = DAL::getRow("SELECT * FROM paypalinfo WHERE txn_id='".$txn_id." and paymentStatus='Completed'");<br />if($payed<=0) {<br />DAL::insert("INSERT INTO paypalinfo(userid,txn_id,payment_date,paymentStatus) values(".$user->UserId.",".$txn_id.",'".$payment_date."','".$payment_status."')");<br />$user = DAL::getRow("SELECT * FROM users WHERE firstName='".$first_name."' and lastName='".$last_name."'");<br />$newRevaldate = date("Y-m-d H:i:s",(strtotime($user->renewaldate) + 90*(24*60*60)));<br />$results = DAL::update("UPDATE users SET renewaldate='".$newRevaldate."' WHERE firstName='".$first_name."' and lastName='".$last_name."'");<br />}<br />}<br />這裡的限制是,註冊aupair帳號的時候和註冊paypal帳號的時候要用實名,也就是要兩個帳號的姓氏和名字保持一致,因為更新的依據就是這個,而並不是userid。</p><p>這裡李總說的許可權控制是這樣來實現的:<br />BasePage.class.php中:</p><p>添加許可權控制商務邏輯:<br />if(Context::$session->Identity == 2) {//if the account blongs to an Aupair<br />if(!Context::$session->Payed) {//and the acount did not pay before or out of charge<br /> //and click some url which are limited to visit<br /> if ($cls != "Index" && $cls != "MessageBox" && $cls != "Register" && $cls != "Register2" && $cls != "Register3" && $cls != "Home" && $cls != "Find" && $cls != "AllFind" && $cls != "Profile" && $cls != "LoadUser" && $cls != "FindUsers" && $cls != "FindedAsA" && $cls != "FindedAsF" && $cls != "Statics" && $cls != "LostPwd" && $cls != "ABC" && $cls != "VisaRegulations" && $cls != "QuestionsAnswers" && $cls != "LoginB") {<br /> //and the url is just the five dinymic Page<br /> if ($cls == "EasyFind" || $cls == "Favorites" || $cls == "Messages" || $cls == "MyProfile" || $cls == "Statistics") {<br />//redirect to payTip.html<br />Context::$response->redirect ( 'payTip.html' );<br /> }<br /> }<br /> parent::__construct ();<br /> return;<br />}<br />}<br />修改setupSession方法為:</p><p>//##########payment limit<br />if($user->identity == 2) {//if the account blongs to an Aupair<br /> $thisDate = date ( "Y-m-d H:i:s" );<br /> $payed = strtotime($user->renewaldate) - strtotime($thisDate);<br /> if($payed > 0) {//if payed<br /> Context::$session->Payed=TRUE;<br /> }else {<br /> Context::$session->Payed=FALSE;<br /> }<br />}<br />//##########payment limit<br />其中:</p><p>if ($user != null && Context::$session->Logined = true)<br />是我修改的,這一原來不是這個樣子的,具體的我忘記了,總之和要表到的商務邏輯是和相反的。</p><p>在Login.tpl和loginB.tpl中的ajax傳回值中添加一個42,代表aupair註冊成功,但是未交費或者欠費,並跳轉到交費提示介面。</p><p>修改Index.class.php檔案中的onLogin方法,調整他的驗證順序,這裡還是有一個遺留問題,就是最後的那個review = 0,為什麼要加上那麼一個判斷。<br />登入的時候就有兩個入口,一個是login.tpl,另一個是loginB.tpl,登入的商務邏輯是:<br />1、使用者名稱密碼是否錯誤,或者說是使用者名稱/密碼是否存在<br />2、是否為管理員,是管理員,立即登入<br />3、如果不是不管理員,更新使用者登入時間<br />4、配置session資訊<br />5、查看使用者是否註冊完成第二步<br />6、查看使用者是否註冊完成第三步<br />7、查看是否為付費的aupair賬戶<br />8、review = 0的判斷,莫名其妙</p><p>整個系統只有兩個地方是用來登入的,驗證的邏輯放到了Index.class.php,那麼我刪除了Login.class.php和Login.class.php中的onlogin方法</p><p>詢問李總一個問題:<br />aupair在修改使用者資訊的時候有沒有一個審批的步驟,如果有的話,那麼當使用者砸審批過程中,是可以操作動態網頁面呢還是不可以?<br />這裡好現實不可以,因為這的</p><p>接受這個項目一個月了,現在才完全的搞清楚每一個欄位是用來做什麼的:<br />active<br />是使用者自己來控制的,管理員沒有控制他的介面和按鈕,這個欄位是用來控制使用者資訊是否可以被檢索到的關鍵:<br />active = 0使用者可以被檢索到</p><p>active = 1使用者資訊被自己鎖定,不被檢索到。</p><p>那麼,這要設定兩個地方:</p><p>第一個修改的地方,修改DelProfile.tpl檔案中的ajax中的一個判斷:<br />if(params.activate==1)//to de-active the user, so as you know the user is active now.<br />{<br />$('activate').innerHTML='<INPUT type="submit" onClick="AddPorfile();" value="'+params.button+'">';<br />}<br />else if(params.activate==0)//to de-active the user, so as you know the user is de-active now.<br />{<br />$('activate').innerHTML='<INPUT type="submit" onClick="DlePorfile();" value="'+params.buttonDe+'">';<br />}<br />為:<br />if(params.activate==0)//to de-active the user, so as you know the user is active now.<br />{<br />$('activate').innerHTML='<INPUT type="submit" onClick="DlePorfile();" value="'+params.buttonDe+'">';<br />}<br />else<br />{<br />$('activate').innerHTML='<INPUT type="submit" onClick="AddPorfile();" value="'+params.button+'">';<br />}<br />第二個修改的地方,修改aupair中的users表,將active欄位設定為預設值為0,不要出現null的情況</p><p>晚上:<br />發布</p><p>上傳步驟:</p><p>修改login.tpl 和 loginB.tpl</p><p>修改Pages/Index.class.php</p><p>修改Pages/BasePage.class.php<br />__construct方法和setupSession方法</p><p>上傳<br />php_paypal目錄,部署paypal。</p><p>上傳<br />template目錄下的paySuccess.tpl和payTip.tpl<br />Pages目錄下的paySuccess.class.php和payTip.class.php</p><p>建立表:<br />CREATE TABLE IF NOT EXISTS `paypalinfo` (<br /> `id` int(11) NOT NULL auto_increment,<br /> `userid` int(11) NOT NULL,<br /> `txn_id` varchar(50) NOT NULL,<br /> `payment_date` date NOT NULL,<br /> `paymentStatus` varchar(50) NOT NULL,<br /> PRIMARY KEY (`id`)<br />) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;<br />修改users表:<br />ALTER TABLE users ADD `renewaldate` timestamp NOT NULL default CURRENT_TIMESTAMP</p><p>修改php_paypal目錄下include目錄下Config.inc.php檔案中的兩個配置,具體代碼如下:<br />$paypal[site_url]="http://www.aupairjobs.co.uk/";<br />$paypal[success_url]="paySuccess.html";</p><p>測試:<br />可用,但是存在問題。<br />