计算回头率步骤
计算回头率方法
public function probability() { global $_INPUT; $ret = array(); $time = $_INPUT['date'] && preg_match('/^\d{4}-\d{2}\-\d{2}$/', $_INPUT['date']) ? strtotime($_INPUT['date']) : strtotime('today'); $today = $time; //该天时间头 $tomorrow = $time + 86400; //该天时间尾 $flag = 1; //是否进入比赛 $model = Model::getInstance('logs.fixedlog'); $paymodel = Model::getInstance('main.payment'); $stats = array(); $num = 0; //连续一周回头人数 $option = isset($_INPUT['app']) ? intval($_INPUT['app']) : 1; $interval = isset($_INPUT['period']) ? intval($_INPUT['period']) : 1; //时间区间一周 if($option == 1) { for($i = 0;$i <= $interval;$i++) { $res = $model->turnround($today,$tomorrow,$flag); //获取该天参加比赛的会员 $temp = array(); foreach($res as $value){ $inmatch = isset($value['inmatch']) ? json_decode($value['inmatch']) : array(); foreach($inmatch as $val) { if(!in_array($val, $temp)) { array_unshift($temp,$val); //去掉该天重复参加比赛会员 } } } $i==0 ? $total = count($temp) : ""; $temp = array_fill_keys($temp, $i); //把会员记录导入stats数组 foreach($temp as $k=>$v) { if(array_key_exists($k,$stats)) { //如果stats数组里面存着该会员ID,则尾部追加该登陆的每日号 $stats[$k] = $stats[$k].",".$v; } else { $stats[$k] = $v; } } $today = $today - 86400; //逐次改变每日号起止时间 $tomorrow = $tomorrow - 86400; } $strlen = ($interval+1)*2-1; foreach($stats as $v) { if(isset($v)) { strlen(trim($v)) == $strlen ? $num++ : $num; } } $ret['turnround']['all'] = $stats; $ret['turnround']['total'] = $total; $ret['turnround']['stats'] = count($stats); $ret['turnround']['num'] = $num; } else { $res = $model->turnround($today,$tomorrow,$flag); //获取该天参加比赛的会员 $temp = array(); foreach($res as $value){ $inmatch = isset($value['inmatch']) ? json_decode($value['inmatch']) : array(); foreach($inmatch as $val) { if(!in_array($val, $temp)) { array_unshift($temp,$val); //去掉该天重复参加比赛会员 } } } foreach($temp as $k=>$v) { $paystatus = $paymodel->hasCharge($v,$tomorrow,$today-1); isset($paystatus) && $paystatus['num']<>0 ? $num++ : ""; } $ret['payrate']['all'] = $temp; $ret['payrate']['total'] = count($temp); $ret['payrate']['num'] = $num; } return $this->ret($ret); }

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











1. The difference between Iterator and foreach is the polymorphic difference (the bottom layer of foreach is Iterator) Iterator is an interface type, it does not care about the type of collection or array; both for and foreach need to know the type of collection first, even the type of elements in the collection; 1. Why is it said that the bottom layer of foreach is the code written by Iterator: Decompiled code: 2. The difference between remove in foreach and iterator. First, look at the Alibaba Java Development Manual, but no error will be reported in case 1, and an error will be reported in case 2 (java. util.ConcurrentModificationException) first

The steps for PHP to determine the number of the foreach loop: 1. Create an array of "$fruits"; 2. Create a counter variable "$counter" with an initial value of 0; 3. Use "foreach" to loop through the array, and Increase the value of the counter variable in the loop body, and then output each element and their index; 4. Output the value of the counter variable outside the "foreach" loop to confirm which element the loop reaches.

The temp folder is our temporary file storage location. The system will save temporary files to this folder. If there are too many temporary files, especially when the temp folder is on the system disk, it is likely to affect the system running speed. We can solve the problem by changing the temp location. Let’s take a look below. Tutorial on changing the location of win7temp 1. First, right-click "Computer" and open "Properties" 2. Click "Advanced System Settings" on the left 3. Click "Environment Variables" below 4. Select "temp" and click "Edit" 5. Then change Just change the "Variable Value" to the path that needs to be changed.

In computers, temp means "temporary folder", which contains many temporary files; its function is to temporarily save the user's work results in the application to prevent losses caused by accidents. Deleting temp files can free up hard disk storage space, but it will be slower to open the application for the first time after deletion.

This article will explain in detail how PHP returns an array after key value flipping. The editor thinks it is quite practical, so I share it with you as a reference. I hope you can gain something after reading this article. PHP Key Value Flip Array Key value flip is an operation on an array that swaps the keys and values in the array to generate a new array with the original key as the value and the original value as the key. Implementation method In PHP, you can perform key-value flipping of an array through the following methods: array_flip() function: The array_flip() function is specially used for key-value flipping operations. It receives an array as argument and returns a new array with the keys and values swapped. $original_array=[
![How to Fix Processor Thermal Trip Error in Windows 11/10 [Fix]](https://img.php.cn/upload/article/000/000/164/168169038621890.png?x-oss-process=image/resize,m_fill,h_207,w_330)
Most of the devices, such as laptops and desktops, have been heavily used by young gamers and coders for a long time. The system sometimes hangs due to application overload. This forces users to shut down their systems. This mainly happens to players who install and play heavy games. When the system tries to boot after force shutdown, it throws an error on a black screen as shown below: Below are the warnings detected during this boot. These can be viewed in the settings on the event log page. Warning: Processor thermal trip. Press any key to continue. ..These types of warning messages are always thrown when the processor temperature of a desktop or laptop exceeds its threshold temperature. Listed below are the reasons why this happens on Windows systems. Many heavy applications are in
![Internal error: Unable to create temporary directory [Resolved]](https://img.php.cn/upload/article/000/000/164/168171504798267.png?x-oss-process=image/resize,m_fill,h_207,w_330)
Windows system allows users to install various types of applications on your system using executable/setup files. Recently, many Windows users have started complaining that they are receiving an error named INTERNALERROR:cannotCreateTemporaryDirectory on their systems while trying to install any application using an executable file. The problem is not limited to this but also prevents the users from launching any existing applications, which are also installed on the Windows system. Some possible reasons are listed below. Run the executable to install without granting administrator privileges. An invalid or different path was provided for the TMP variable. damaged system

temp is a temporary folder. In the path "C:\Documents and Settings\Administrator\Local Settings\", many temporary files are placed here, including favorites, temporary files for browsing web pages, editing files, etc.
