1、登錄后若用戶未設置支付密碼,且該用戶零錢余額大於0,則進入app首頁時進行設置支付密碼提醒;
2、支付密碼的設置與錯誤提醒同之前支付密碼設置流程;
3、點擊下方不在提醒,則不在彈出此彈窗;
4、點擊取消,則在點擊取消按鈕第二天00:00開始計算,7天后的第一次登錄則重新在用戶進入app首頁時出現此彈窗(無論此時用戶零錢余額是否大於0都要提醒);
5、用戶設置支付密碼成功,吐司提示“設置成功”;
設置支付密碼規則:
1、不要和登錄密碼一致(提示文案:不要和登錄密碼一致);
2、連續數字,重復數字不可設置(提示文案:支付密碼過於簡單);
3、用戶設置支付密碼,點擊確定判斷是否屬於上面兩種情況,若屬於則進行攔截,並在“再次輸入支付密碼”文案后顯示相應提示;
連續數字定義:
密碼中數字連續遞增或遞減,如:012345,987654;
重復數字定義:
密碼六位數字完全相同,如:111111;
1、輸入支付密碼的彈窗,如果第一次輸入錯誤則彈出“重試/忘記密碼”彈窗,點擊重試返回輸入支付密碼彈窗,點擊忘記密碼進入驗證碼輸入彈窗;
2、驗證碼5分鍾有效,若驗證碼彈窗中驗證碼輸入錯誤,則提示輸入錯誤,並清空輸入框;
3、若重試超過五次,則將重試按鈕換成返回,提示文案如原型,點擊返回關閉輸入支付密碼彈窗,並在五分鍾內用戶再次有付款的動作,攔截用戶並做出同樣的彈窗提示,五分中后點擊用戶再次有支付動作時可輸入支付密碼;
4、若五分鍾后第六次輸入錯誤,則彈窗中已錯誤次數變為“6”次,重試時間變為“10”分鍾。以此類推,“7”次——“30”分鍾,“8”次——“1小時”,“9”次——“24”小時,此后每次輸入錯誤加“24小時”;
5、該試錯攔截流程同樣適用於登錄流程,若密碼錯誤5次以上,吐司提示“密碼已輸錯5次,請5分鍾后重試”五分鍾內用戶再次點擊登錄,做出相同的提示,五分鍾后可正常登錄,若用戶再次輸入錯誤,則參考Note4中的規則對用戶予以提示;
6、用戶如果成功登錄一次,則再次登錄時,試錯流程刷新,重新開始記錄輸入錯誤次數;
/** * @title 判斷是否可以設置支付密碼--彈出設置支付密碼彈窗 * @return {"status":"0","errorCode":"0","msg":"成功","result":true} * @example PaySet.isSetPayPasswd? 調用參數:{"method":"PaySet.isSetPayPasswd","username":"17721355111","check_code":"123456"} * @return_param_explain result:true彈出、false不彈出 * @method POST * @author 鄒柯 */ public function isSetPayPasswd(){ /* * 1、登錄后若用戶未設置支付密碼,且該用戶零錢余額大於0,則進入app首頁時進行設置支付密碼提醒; * 2、點擊取消,則在點擊取消按鈕第二天00:00開始計算,7天后的第一次登錄則重新在用戶進入app首頁時出現此彈窗(無論此時用戶零錢余額是否大於0都要提醒) */ $user_id=session('user.user_id'); if(empty($user_id)){ return false; } $customer = M('customer'); $c_where['user_id']=$user_id; $c_info = $customer->where($c_where)->field('balance,securitycode')->find(); $pps_info=$this->isLoginTime($user_id); if(empty($c_info['securitycode']) && $c_info['balance']> 0 && $pps_info==true){ return true; } return false; } //判斷登錄時間 public function isLoginTime($user_id){ $pay_passwd_set=M('pay_passwd_set'); $pps_where['user_id']=$user_id; $pps_where['type']=1; $pps_info=$pay_passwd_set->field('status,update_time')->where($pps_where)->find(); if(empty($pps_info)){ return true; } $dat=$pps_info['update_time']; $date=date("Y-m-d 00:00:00",strtotime("$dat +1day")); $time=date("Y-m-d H:i:s",strtotime( "$date +8day")); $now_time=date("Y-m-d H:i:s",time()); if($pps_info['status']==1 && ($now_time > $time)){ return true; } return false; } /** * @title 設置支付密碼--不再提醒 * @param status 是 int 是否再次提醒(1取消、2不在提醒) * @return {"status":"0","errorCode":"0","msg":"成功","result":true} * @example PaySet.setNotice? 調用參數:{"method":"PaySet.setNotice","username":"17721355111","check_code":"123456","status":"1"} * @method POST * @author 鄒柯 */ public function setNotice($res){ $user_id=session('user.user_id'); if(empty($user_id)){ return true; } $status=$res['status']; $time=date("Y-m-d H:i:s",time()); $pay_passwd_set=M('pay_passwd_set'); $pps_where['user_id']=$user_id; $pps_where['type']=1; $pps_info=$pay_passwd_set->field('status,update_time')->where($pps_where)->find(); if(empty($pps_info)){ $pps_data=[ 'user_id'=>$user_id, 'status'=>$status, 'update_time'=>$time, 'type'=>1, ]; $res=$pay_passwd_set->data($pps_data)->add(); }else{ $pps_data=[ 'status'=>$status, 'update_time'=>$time ]; $pps_where['user_id']=$user_id; $pps_where['type']=1; $res=$pay_passwd_set->data($pps_data)->where($pps_where)->save(); } if(!$res){ E("10001","設置失敗"); } return true; } //密碼設置規則 //1、不要和登錄密碼一致; //2、連續數字,重復數字不可設置; public function setPasswdRule($user_id,$securitycode){ //先判斷是否和登錄密碼一致 $user=M('user'); $u_where['user_id']=$user_id; $user_info=$user->field('password')->where($u_where)->find(); if(md5($securitycode)==$user_info['password']){ return array("status"=>1,"msg"=>"不要和登錄密碼一致","result"=>null); } //判斷是否是重復數字 $securitycode_array=str_split($securitycode); if (1 == count(array_unique($securitycode_array))) { return array("status"=>1,"msg"=>"支付密碼過於簡單","result"=>null); } //判斷是否是連續數字 $res=$this->getconsecutive($securitycode_array,6); if($res==false){ return array("status"=>1,"msg"=>"支付密碼過於簡單","result"=>null); } return true; } //判斷是否是連續數字 public function getconsecutive($arr,$n){ $temp = array(); foreach($arr as $k =>$v){ while($k<$n){ $temp[$k] = $v+$k; $k++; } $arr_str=implode(",",$arr); $temp_str=implode(",",$temp); if($arr_str===$temp_str){ return false; } return true; } } //支付時輸入支付密碼錯誤的處理 //$type 1支付密碼 2登錄密碼 public function tipByPayPasswdError($user_id,$type){ //更新輸入錯誤的次數 $pay_passwd_set=M('pay_passwd_set'); if($type==2){ $user=M('user'); $u_where['username']=$user_id; $user_info=$user->field('user_id')->where($u_where)->find(); $user_id=$user_info['user_id']; } $pps_where['user_id']=$user_id; $pps_where['type']=$type; $count=$pay_passwd_set->where($pps_where)->count(); if($count <= 0){ $time=date("Y-m-d H:i:s",time()); $pps_data=[ 'user_id'=>$user_id, 'status'=>1, 'update_time'=>$time, 'type'=>$type ]; $pay_passwd_set->data($pps_data)->add(); } $pay_passwd_set->where($pps_where)->setInc("pay_passwd_nums",1); //查詢總共輸錯的次數 $pps_info=$pay_passwd_set->where($pps_where)->getField("pay_passwd_nums"); /* * 若五分鍾后第六次輸入錯誤,則彈窗中已錯誤次數變為“6”次,重試時間變為“10”分鍾。 * 以此類推,“7”次——“30”分鍾,“8”次——“1小時”,“9”次——“24”小時,此后每次輸入錯誤加“24小時”; */ if($pps_info>=5){ switch($pps_info){ case 5: $time="5分鍾"; $repay_time=date("Y-m-d H:i:s",strtotime("+5 minute")); break; case 6: $time="10分鍾"; $repay_time=date("Y-m-d H:i:s",strtotime("+10 minute")); break; case 7: $time="30分鍾"; $repay_time=date("Y-m-d H:i:s",strtotime("+30 minute")); break; case 8: $time="1小時"; $repay_time=date("Y-m-d H:i:s",strtotime("+1 hour")); break; default: if($pps_info>=9){ $n=$pps_info-8; } $last=$n*24; $time=$last."小時"; $repay_time=date("Y-m-d H:i:s",strtotime("+$last hour")); break; } //更新可以再次輸入支付密碼的時間 $pay_passwd_set->where($pps_where)->data(["repay_time"=>$repay_time])->save(); if($type==1){ $msg="支付密碼輸入不正確,已錯誤".$pps_info."次,請點擊忘記密碼進行找回或".$time."后重試"; }else{ $msg="密碼已輸錯".$pps_info."次,請".$time."后重試"; } return array("status"=>1,"errorCode"=>"105", "msg"=>$msg,"result"=>null); } return true; } //支付密碼輸入成功,更新支付密碼輸入錯誤次數為0 //$type 1支付密碼 2登錄密碼 public function setPayPasswdNums($user_id,$type){ $pay_passwd_set=M('pay_passwd_set'); if($type==2){ $user=M('user'); $u_where['username']=$user_id; $user_info=$user->field('user_id')->where($u_where)->find(); $user_id=$user_info['user_id']; } $pps_where['user_id']=$user_id; $pps_where['type']=$type; $pps_data=[ 'pay_passwd_nums'=>0, 'update_time'=>date("Y-m-d H:i:s"), 'repay_time'=>date("Y-m-d H:i:s") ]; $pay_passwd_set->where($pps_where)->data($pps_data)->save(); return true; }
CREATE TABLE `lc_pay_passwd_set` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` bigint(20) DEFAULT NULL COMMENT '用戶id', `status` tinyint(1) DEFAULT NULL COMMENT '提醒狀態(1取消、2不在提醒)', `update_time` datetime DEFAULT NULL COMMENT '更新時間', `pay_passwd_nums` int(2) NOT NULL DEFAULT '0' COMMENT '支付密碼輸入次數', `repay_time` datetime DEFAULT NULL COMMENT '再次可以輸入的時間', `type` tinyint(1) DEFAULT NULL COMMENT '輸入密碼類型(1-支付密碼、2登錄密碼)', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8 COMMENT='支付密碼設置--提醒';