|
@@ -11,6 +11,7 @@ namespace App\Http\Controllers\Admin\Base;
|
|
|
|
|
|
use App\Http\Controllers\Admin\Controller;
|
|
use App\Http\Controllers\Admin\Controller;
|
|
use App\Models\AdminUserModel;
|
|
use App\Models\AdminUserModel;
|
|
|
|
+use App\Models\AlbumAgentModel;
|
|
use App\Models\AlbumStatisticalModel;
|
|
use App\Models\AlbumStatisticalModel;
|
|
use App\Models\AlbumUserModel;
|
|
use App\Models\AlbumUserModel;
|
|
use App\Models\AlbumWatchRecord;
|
|
use App\Models\AlbumWatchRecord;
|
|
@@ -44,21 +45,44 @@ class IndexController extends Controller
|
|
}
|
|
}
|
|
return view('admin.base.index.index',compact('menus'));
|
|
return view('admin.base.index.index',compact('menus'));
|
|
}
|
|
}
|
|
- function welcome() {
|
|
|
|
- $time = mktime(24,60,60,date('m'),date('d'),date('Y'));
|
|
|
|
|
|
+ function welcome()
|
|
|
|
+ {
|
|
|
|
+ $time = mktime(24, 60, 60, date('m'), date('d'), date('Y'));
|
|
$day = '[';
|
|
$day = '[';
|
|
$count = '[';
|
|
$count = '[';
|
|
- for($i=15;$i>=1;$i--){
|
|
|
|
- $startTime = $time-$i*86400;
|
|
|
|
- $day .= "\"".date('m-d',$startTime)."\",";
|
|
|
|
- $start_time = date('Y-m-d H:i:s',$startTime);
|
|
|
|
- $end_time = date('Y-m-d H:i:s',$startTime+86400);
|
|
|
|
|
|
+ for ($i = 15; $i >= 1; $i --) {
|
|
|
|
+ $startTime = $time - $i * 86400;
|
|
|
|
+ $day .= "\"" . date('m-d', $startTime) . "\",";
|
|
|
|
+ $start_time = date('Y-m-d H:i:s', $startTime);
|
|
|
|
+ $end_time = date('Y-m-d H:i:s', $startTime + 86400);
|
|
$num = AlbumWatchRecord::where([['store_id',$this->getStoreId()],['created_at','>=',$start_time],['created_at','<=',$end_time],['action',4]])->groupBy('open_id')->count();
|
|
$num = AlbumWatchRecord::where([['store_id',$this->getStoreId()],['created_at','>=',$start_time],['created_at','<=',$end_time],['action',4]])->groupBy('open_id')->count();
|
|
- $count .= $num.",";
|
|
|
|
|
|
+ $count .= $num . ",";
|
|
|
|
+ }
|
|
|
|
+ $agents = AlbumAgentModel::where('status', 1)->get()->toArray();
|
|
|
|
+ $data = array();
|
|
|
|
+ $geoCoordMap = (object)[];
|
|
|
|
+ foreach ($agents as $key => $val) {
|
|
|
|
+ $count_all = AlbumWatchRecord::where([
|
|
|
|
+ ['agent_id', $val['id']],
|
|
|
|
+ ['store_id', $this->getStoreId()]
|
|
|
|
+ ])->groupBy('open_id')->count();
|
|
|
|
+ $data[] = (object)[
|
|
|
|
+ 'name' => $val['realname'],
|
|
|
|
+ 'value' => $count_all
|
|
|
|
+ ];
|
|
|
|
+ $name = $val['realname'];
|
|
|
|
+ $geoCoordMap->$name = [$val['lon'], $val['lat']];
|
|
}
|
|
}
|
|
- $day = substr($day,0,strlen($day)-1).']';
|
|
|
|
- $count = substr($count,0,strlen($count)-1).']';
|
|
|
|
- return view('admin.base.index.welcome',['day'=>$day,'count'=>$count]);
|
|
|
|
|
|
+ $data = json_encode($data);
|
|
|
|
+ $geoCoordMap = json_encode($geoCoordMap);
|
|
|
|
+ $day = substr($day, 0, strlen($day) - 1) . ']';
|
|
|
|
+ $count = substr($count, 0, strlen($count) - 1) . ']';
|
|
|
|
+ return view('admin.base.index.welcome', [
|
|
|
|
+ 'day' => $day,
|
|
|
|
+ 'count' => $count,
|
|
|
|
+ 'data' => $data,
|
|
|
|
+ 'geoCoordMap' => $geoCoordMap
|
|
|
|
+ ]);
|
|
}
|
|
}
|
|
|
|
|
|
public function getData(Request $request)
|
|
public function getData(Request $request)
|