| 123456789101112131415161718192021222324252627282930 |
- <?php
- namespace App\Models;
- use Illuminate\Support\Facades\DB;
- class OrderUrl extends BaseModel
- {
- protected $table="orderurl";
- public $timestamps = false;
- //按投注平台获取投注数
- function getUrlBet(){
- // $data=DB::table($this->table)->select(DB::raw('count(id) count'))->groupBy('url')->
- $time1=date('Y-m-d 00:00:00');//今日0时
- $time2=date('Y-m-d 23:59:59');//
- $timearea=[$time1,$time2];
- // $timearea=['2017-10-18 00:00:00','2017-10-18 23:59:59'];//测试数据
- $data=$this->select(DB::raw('count(id) as value,url as name'))->whereBetween('add_time',$timearea)->groupBy('url')->get();
- if(!$data){
- return array();//没有数据
- }
- return $data->toArray();
- }
- //总数今日
- function gettotal(){
- $time1=date('Y-m-d 00:00:00');//今日0时
- $time2=date('Y-m-d 23:59:59');//
- $timearea=[$time1,$time2];
- return $this->whereBetween('add_time',$timearea)->count();
- }
- }
|