init
This commit is contained in:
62
application/api/controller/Index.php
Normal file
62
application/api/controller/Index.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\Api;
|
||||
use think\Db;
|
||||
/**
|
||||
* 首页接口
|
||||
*/
|
||||
class Index extends Api
|
||||
{
|
||||
protected $noNeedLogin = ['*'];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
/**
|
||||
* 首页
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
exit();
|
||||
$mobile = '19123397891,18983232803,18100874425,18402300888,18723290293,13272679110,18502381971,18523881166,18696567826,18696519998,15523078058,18584585755,17623620828,18623452863,15696222758,13251315431,18581297078,13272881170,13002344877,13618259900,13290038820,15683594996,16623034699,13101259586,15523756271,13272722880,15523500575,18581190907,17623328238,17623083080';
|
||||
|
||||
$mobile_arr = explode(',',$mobile);
|
||||
|
||||
$res = Db::name('dudu')->select();
|
||||
foreach ($res as $key=>$value){
|
||||
$mobile_key = $value['id']%30;
|
||||
$mobile_key = $mobile_key == 0 ? 30 :$mobile_key;
|
||||
$value['F'] = $mobile_arr[$mobile_key - 1];
|
||||
|
||||
$time1 = mt_rand(10,17);
|
||||
$time2 = mt_rand(0,60);
|
||||
$time2 = $time2 < 10 ? '0'.$time2 : $time2;
|
||||
|
||||
$time3 = $this->getTime();
|
||||
|
||||
$time = $time1.':'.$time2.':'.$time3;
|
||||
$timee = $time1.':'.$time2.':'.($time3+5 < 10 ? '0'.($time3+5) : $time3 +5);
|
||||
|
||||
$value['W'] = $value['W'].' '.$time;
|
||||
$value['X'] = $value['X'].' '.$timee;
|
||||
|
||||
|
||||
Db::name('dudu')->where('id',$value['id'])->update(['F'=>$mobile_arr[$mobile_key-1],'W'=>$value['W'].' '.$time,'X'=>$value['X'].' '.$timee]);
|
||||
}
|
||||
|
||||
|
||||
$this->success('请求成功');
|
||||
}
|
||||
|
||||
public function getTime(){
|
||||
$time3 = mt_rand(0,60);
|
||||
if($time3 >= 54){
|
||||
$this->getTime();
|
||||
}
|
||||
$time3 = $time3 < 10 ? '0'.$time3 : $time3;
|
||||
return $time3;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user