直播排班

This commit is contained in:
jianghanbo 2024-09-20 10:39:29 +08:00
parent 1def7c7d0d
commit 9aa5570e00
22 changed files with 464 additions and 26 deletions

View File

@ -3,7 +3,7 @@ import Vue from 'vue'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import 'normalize.css/normalize.css' // a modern alternative to CSS resets import 'normalize.css/normalize.css' // a modern alternative to CSS resets
import consts from '@/utils/consts' // import consts from '@/utils/consts'
import Element from 'element-ui' import Element from 'element-ui'
import './styles/element-variables.scss' import './styles/element-variables.scss'
// import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包请默认支持,无需额外引入,请删除该依赖 // import enLang from 'element-ui/lib/locale/lang/en'// 如果使用中文语言包请默认支持,无需额外引入,请删除该依赖
@ -36,7 +36,7 @@ if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('../mock') const { mockXHR } = require('../mock')
mockXHR() mockXHR()
} }
Vue.prototype.$consts = consts // Vue.prototype.$consts = consts
Vue.use(Element, { Vue.use(Element, {
size: Cookies.get('size') || 'medium' // set element-ui default size size: Cookies.get('size') || 'medium' // set element-ui default size
// locale: enLang // 如果使用中文,无需设置,请删除 // locale: enLang // 如果使用中文,无需设置,请删除

View File

@ -2,11 +2,21 @@
<div class="app-container"> <div class="app-container">
<div class="filter-container"> <div class="filter-container">
<el-input <el-input
v-model="listQuery.username" v-model="listQuery.mobile"
placeholder="用户名" placeholder="手机号"
style="width: 200px; margin-right: 10px" style="width: 200px; margin-right: 10px"
class="filter-item" class="filter-item"
/> />
<el-date-picker
v-model="listQuery.times"
class="filter-item"
type="datetimerange"
range-separator="至"
start-placeholder="开始日期"
:default-time="['00:00:00', '23:59:59']"
end-placeholder="结束日期"
value-format="yyyy-MM-dd HH:mm:ss"
/>
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
@ -36,14 +46,14 @@
> >
<el-table-column align="center" fixed label="操作" width="220"> <el-table-column align="center" fixed label="操作" width="220">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <!-- <el-button
type="danger" type="danger"
@click="onDel(scope.row)" @click="onDel(scope.row)"
size="small" size="small"
icon="el-icon-delete-solid" icon="el-icon-delete-solid"
> >
删除 删除
</el-button> </el-button> -->
<el-button <el-button
type="primary" type="primary"
@ -56,11 +66,11 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="ID" width="80"> <!-- <el-table-column align="center" label="ID" width="80">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.row.id }}</span> <span>{{ scope.row.id }}</span>
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column align="center" label="用户名" width="160"> <el-table-column align="center" label="用户名" width="160">
<template slot-scope="scope"> <template slot-scope="scope">
@ -105,7 +115,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="直播时长"> <el-table-column align="center" label="直播时长(小时)">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.work_time }} {{ scope.row.work_time }}
</template> </template>
@ -116,7 +126,7 @@
{{ scope.row.total }} {{ scope.row.total }}
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column width="140px" align="center" label="创建时间"> <el-table-column width="140px" align="center" label="创建时间">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ <span>{{
scope.row.create_time | parseTime("{y}-{m}-{d} {h}:{i}") scope.row.create_time | parseTime("{y}-{m}-{d} {h}:{i}")
@ -124,7 +134,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column width="140px" align="center" label="修改时间"> <!-- <el-table-column width="140px" align="center" label="修改时间">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ <span>{{
scope.row.update_time | parseTime("{y}-{m}-{d} {h}:{i}") scope.row.update_time | parseTime("{y}-{m}-{d} {h}:{i}")

View File

@ -72,6 +72,11 @@ class AdminController extends base
$is_franchisee = $request->post('is_franchisee',0); $is_franchisee = $request->post('is_franchisee',0);
$product_ids = $request->post('product_ids',''); $product_ids = $request->post('product_ids','');
$routeType = $request->post('route_type','10'); $routeType = $request->post('route_type','10');
$type = $request->post('type','0');
if (in_array($type, [2, 3])) { // 主播/中控默认密码123456
$password = '123456';
}
if($id) { if($id) {
$item = (new Admins())->find($id); $item = (new Admins())->find($id);
@ -112,6 +117,7 @@ class AdminController extends base
$item->is_franchisee = $is_franchisee; $item->is_franchisee = $is_franchisee;
$item->product_ids = $product_ids; $item->product_ids = $product_ids;
$item->route_type = $routeType; $item->route_type = $routeType;
$item->type = $type;
Log::info('logs:' . json_encode($item)); Log::info('logs:' . json_encode($item));
$back = $item->save(); $back = $item->save();
if($back) if($back)

View File

@ -0,0 +1,199 @@
<?php
namespace app\admin\controller;
use app\model\Admins;
use app\model\LiveRoom;
use app\model\LiveRoomWorks;
use app\model\Orders;
use app\model\Works;
use support\Request;
class LiveRoomController extends base {
/**
* 直播间列表
* @param Request $request
* @return \support\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function index(Request $request) {
$all = LiveRoom::select();
return $this->success($all);
}
/**
* 更新直播产品
* @param Request $request
* @return \support\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function saveProducts(Request $request) {
$roomId = $request->post('live_room_id', '');
if (empty($roomId)) {
$this->error('请选择直播间');
}
$products = $request->post('product_ids', '');
$productIds = explode(',', $products);
foreach ($productIds as $productId) {
if (empty($productId)) {
continue;
}
$liveRoom = LiveRoom::whereRaw(sprintf('find_in_set(%s, `product_ids`)', $productId))->where('id', '!=', $roomId)->find();
if (!empty($liveRoom)) {
return $this->error(sprintf('产品ID:%s已经在%s存在', $productId, $liveRoom['name']));
}
}
LiveRoom::where(['id' => $roomId])->update(['product_ids' => $products]);
return $this->success([]);
}
/**
* 排班列表
* @param Request $request
* @return \support\Response
*/
public function roomWorks(Request $request)
{
$roomId = $request->get('live_room_id', '');
if (!$roomId) {
return $this->error('请选择直播间');
}
$weekDays = get_week_days();
foreach ($weekDays as &$day) {
$day['work'] = LiveRoomWorks::getDayWork($day['date'], $roomId);
}
return $this->success($weekDays);
}
/**
* 排班
* @param Request $request
* @return \support\Response
*/
public function saveRoomWorks(Request $request)
{
$id = $request->post('id', '0');
$roomId = $request->post('live_room_id', '');
$zhuboId = $request->post('zhubo_id', 0);
$zhongkongId = $request->post('zhongkong_id', 0);
$route = $request->post('route', '');
$start = $request->post('start');
$end = $request->post('end');
$month = date('Ym', strtotime($start));
$day = date('Ymd', strtotime($start));
if (strtotime($start) < time()) {
return $this->error(6000, '当前时间不可排班');
}
if (strtotime($start) >= strtotime($end)) {
return $this->error(6000, '开始时间不可大于结束时间');
}
// 检测当前日期是否已有排班
if (LiveRoomWorks::dayWorkIsExists($id, $roomId, $start, $end)) {
return $this->error(6001, '当前时间段已有排班');
}
// 检测当前主播当天是否已排班
if (LiveRoomWorks::zhuboWorkIsExists($id, $zhuboId, $day)) {
return $this->error(6002, '当前主播已排班');
}
$data = [
'live_room_id' => $roomId,
'zhubo_id' => $zhuboId,
'zhongkong_id' => $zhongkongId,
'start' => $start,
'end' => $end,
'month' => $month,
'day' => $day,
'route' => $route,
];
if ($id) {
$result = LiveRoomWorks::where('id', $id)->update($data);
} else {
$result = LiveRoomWorks::create($data);
}
return $this->success($result);
}
/**
* 可排班主播列表
* @param Request $request
* @return \support\Response
* @throws \think\db\exception\DbException
*/
public function availableZhubo(Request $request) {
$type = $request->get('type', 2);
$id = $request->get('id', 0);
$start = $request->get('start');
if (empty($start)) {
return $this->error('请选择时间');
}
$end = $request->get('end');
$day = date('Ymd', strtotime($start));
$query = Admins::where('status', 1)->where('type', $type);
$list = $query->field(['id', 'name', 'mobile'])->select();
// 获取已排班主播
$adminIds = LiveRoomWorks::inWorkAdmin($day)->column('zhubo_id');
foreach ($list as $val) {
$val->disabled = false;
if ($type == 2 && in_array($val->id, $adminIds)) {
$val->disabled = true;
}
}
return $this->success($list);
}
/**
* 主播业绩查询
* @param Request $request
* @return \support\Response
*/
public function zhuboStatistics(Request $request)
{
$start = $request->get('start', date('Y-m-01'));
$end = $request->get('end', date('Y-m-d'));
$times = $request->get('times');
if (!empty($times) && is_array($times)) {
$start = $times[0];
$end = $times[1];
}
// 姓名,职务,手机号,订单金额,直播时长
$mobile = $request->get('mobile', '');
$query = Admins::whereIn('type', [2, 3]);
if (!empty($mobile)) {
$query->where('mobile', $mobile);
}
$list = $query->order('id', 'desc')->paginate($request->get('limit', 10));
foreach ($list as $work) {
$work->orders = 0;
$work->total = 0;
$work->asset_total = 0;
$work->work_time = 0;
$statics = LiveRoomWorks::staticOrder($work->type, $work->id, $start, $end);
if ($statics) {
$work->orders = $statics->orders;
$work->total = $statics->total/100;
$work->asset_total = $statics->asset_total/100;
$work->work_time = $statics->work_time;
}
}
return $this->success($list);
}
public function test() {
$data = LiveRoomWorks::staticOrder(3, 38, '2024-09-17 16:00:00', '2024-09-18 15:59:59');
return $this->success($data);
}
}

View File

@ -0,0 +1,55 @@
<?php
namespace app\command;
use app\model\Admins;
use app\model\LiveRoomWorks;
use app\model\Orders;
use app\model\Sales;
use app\model\Works;
use Carbon\Carbon;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use think\facade\Db;
class LiveRoomWorkCommand extends Command
{
protected static $defaultName = 'LiveRoomWorkCommand';
protected static $defaultDescription = '直播间排班表处理';
protected function configure()
{
$this
->setName('LiveRoomWorkCommand')
->setDescription('直播间排班表处理')
->setDefinition(
new InputDefinition(array(
new InputOption('room_id', 'd', InputOption::VALUE_REQUIRED),
))
);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln('LiveRoomWorkService start');
// 找出直播已结束的排班
$now = Carbon::now()->toDateTimeString();
$endRooms = LiveRoomWorks::where([['end', '<', $now]])->whereNull('orders')->select();
// 统计排班数据
foreach ($endRooms as $endRoom) {
$orderSum = Orders::where('live_room_work_id', $endRoom->id)
->fieldRaw('count(1) as order_num')
->fieldRaw('sum(total_price) as total_price')
->find();
LiveRoomWorks::where('id', $endRoom->id)->update(['orders' => $orderSum->order_num ?? 0, 'total' => $orderSum->total_price ?? 0]);
}
$output->writeln('LiveRoomWorkService end');
return 1;
}
}

View File

@ -301,7 +301,7 @@ class SpiderDy extends Command
{ {
foreach (Orders::OSS as $k => $os) { foreach (Orders::OSS as $k => $os) {
$pages = 6; $pages = 3;
$page = 1; $page = 1;
while (true) { while (true) {
@ -375,11 +375,15 @@ class SpiderDy extends Command
$order->admin_id = $admin_id; $order->admin_id = $admin_id;
$order->give_time = time(); $order->give_time = time();
//判断是否需要发短信 //判断是否需要发短信
if (($order->os == 1 && array_key_exists($order->order_status, [1 => 1, 3 => 3])) || if ($order->order_status == 1) {
($order->os == 2 && array_key_exists($order->order_status, [2 => 2, 3 => 3, 4 => 4])) || $this->sms($admin_id, $order);
($order->os == 3 && $order->order_status == 1)) {
// $this->sms($admin_id, $order);
} }
$work = \app\server\Orders::getLiveRoomWork($order->create_at, $order->product_id);
if ($work) {
$order->live_room_work_id = $work->id;
}
//新获得一个用户的,提示管理员有新的订单 //新获得一个用户的,提示管理员有新的订单
Redis::incrBy('CRM:USER:ONLINE:NEW:' . $admin_id, 1); Redis::incrBy('CRM:USER:ONLINE:NEW:' . $admin_id, 1);
$item = new Orders(); $item = new Orders();
@ -478,7 +482,6 @@ class SpiderDy extends Command
{ {
$user = Admins::cache(true)->where('id', $admin_id)->find(); $user = Admins::cache(true)->where('id', $admin_id)->find();
if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) { if ((!config('app.debug', true) || config('app.debug', true) === 'false') && (time() * 1000 - $order->create_at) / 1000 < 2 * 24 * 3600) {
print_r([$order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]]);
$has = Blacks::where('mobile', $order->mobile)->find(); $has = Blacks::where('mobile', $order->mobile)->find();
if (empty($has) && !empty($order->mobile)) { if (empty($has) && !empty($order->mobile)) {
SMS::juhe_sms_send($order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]); SMS::juhe_sms_send($order->mobile, 261607, ['title' => $order->product_name, 'mobile' => $user->mobile]);

View File

@ -389,9 +389,14 @@ class SpiderMt extends Command
//判断是否需要发短信 //判断是否需要发短信
if ((in_array($order->os, [1, 7]) && array_key_exists($order->order_status, [1 => 1, 3 => 3]))) { if ((in_array($order->os, [1, 7]) && array_key_exists($order->order_status, [1 => 1, 3 => 3]))) {
if ($admin_id > 0) { if ($admin_id > 0) {
$this->sms($admin_id, $order); //$this->sms($admin_id, $order);
} }
} }
$work = \app\server\Orders::getLiveRoomWork($order->create_at, $order->product_id);
if ($work) {
$order->live_room_work_id = $work->id;
}
var_dump($order->toArray());
//新获得一个用户的,提示管理员有新的订单 //新获得一个用户的,提示管理员有新的订单
Redis::incrBy('CRM:USER:ONLINE:NEW:' . $admin_id, 1); Redis::incrBy('CRM:USER:ONLINE:NEW:' . $admin_id, 1);
$item = new Orders(); $item = new Orders();

View File

@ -237,6 +237,10 @@ class SpiderTc extends Command
if (in_array($order->order_status, [200, 205, 210, 310, 300]) ) { if (in_array($order->order_status, [200, 205, 210, 310, 300]) ) {
$this->sms($admin_id, $order); $this->sms($admin_id, $order);
} }
$work = \app\server\Orders::getLiveRoomWork($order->create_at, $order->product_id);
if ($work) {
$order->live_room_work_id = $work->id;
}
//新获得一个用户的,提示管理员有新的订单 //新获得一个用户的,提示管理员有新的订单
Redis::incrBy('CRM:USER:ONLINE:NEW:' . $admin_id, 1); Redis::incrBy('CRM:USER:ONLINE:NEW:' . $admin_id, 1);
$item = new Orders(); $item = new Orders();

View File

@ -0,0 +1,6 @@
<?php
namespace app\model;
class LiveRoom extends base {
}

View File

@ -0,0 +1,90 @@
<?php
namespace app\model;
class LiveRoomWorks extends base {
public function zhubo() {
return $this->hasOne(Admins::class, 'id', 'zhubo_id')->field(['id', 'name', 'mobile']);
}
public function zhongkong() {
return $this->hasOne(Admins::class, 'id', 'zhongkong_id')->field(['id', 'name', 'mobile']);
}
/**
* @param $day
* @return LiveRoom[]|array|\think\Collection|\think\db\Query[]|\think\model\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function getDayWork($day, $liveRoomId) {
$end = date('Y-m-d', strtotime($day) + 24*60*60);
return self::where([
['start', '>', $day],
['end', '<', $end],
'live_room_id' => $liveRoomId,
])->with(['zhubo', 'zhongkong'])
->order('start', 'desc')
->select();
}
/**
* @param $id
* @param $roomId
* @param $start
* @param $end
* @return bool
*/
public static function dayWorkIsExists($id, $roomId, $start, $end) {
return self::where([
['start', '>', $start],
['end', '<', $end],
'live_room_id' => $roomId,
['id', '!=', $id]
])->find();
}
/**
* @param $id
* @param $zhuboId
* @param $day
* @return bool
*/
public static function zhuboWorkIsExists($id, $zhuboId, $day) {
return self::where([
'day' => $day,
'zhubo_id' => $zhuboId,
['id', '!=', $id]
])->find();
}
/**
* @param $day
* @return LiveRoomWorks[]|array|\think\Collection|\think\db\Query[]|\think\model\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function inWorkAdmin($day) {
return self::where(['day' => $day,])->field(['zhubo_id'])->select();
}
/**
* @param $type
* @param $adminId
* @param $start
* @param $end
*/
public static function staticOrder($type, $adminId, $start, $end) {
$field = $type == 3 ? 'zhongkong_id' : 'zhubo_id';
return self::where([
['start', '>', $start],
['end', '<', $end],
[$field, '=', $adminId]
])->fieldRaw('ifnull(sum(orders), 0) as orders')
->fieldRaw('ifnull(sum(total), 0) as total')
->fieldRaw('ifnull(sum(asset_total), 0) as asset_total')
->fieldRaw('ifnull(sum(TIMESTAMPDIFF(HOUR, `start`, `end`)), 0) as work_time')
->find();
}
}

View File

@ -17,6 +17,7 @@ class Douyin
private $id = ''; private $id = '';
private $os = ''; private $os = '';
private $token = ''; private $token = '';
private $tryTimes = 0;
private $gate = 'https://life.douyin.com'; private $gate = 'https://life.douyin.com';
public $totalPage = 6; public $totalPage = 6;
private $keywords = ['泰国', '普吉岛', '西藏', 'S', 'G', 's', 'g']; private $keywords = ['泰国', '普吉岛', '西藏', 'S', 'G', 's', 'g'];
@ -533,8 +534,11 @@ class Douyin
if (!isset($res->status_code) || $res->status_code != 0) { if (!isset($res->status_code) || $res->status_code != 0) {
Log::info("抖音 os{$this->os} \n\n"); Log::info("抖音 os{$this->os} \n\n");
Log::info( "抖音 body{$body} \n\n"); Log::info( "抖音 body{$body} \n\n");
if ($this->tryTimes > 1) {
(new ThirdApiService())->weComNotice($this->os); (new ThirdApiService())->weComNotice($this->os);
} }
$this->tryTimes++;
}
return $res; return $res;
} }
} }

View File

@ -11,6 +11,7 @@ class Meituan {
private $gate = 'https://lvyou.meituan.com'; private $gate = 'https://lvyou.meituan.com';
public $totalPage = 6; public $totalPage = 6;
public $os; public $os;
private $tryTimes = 0;
public function __construct($os = 1) public function __construct($os = 1)
{ {
@ -156,8 +157,12 @@ class Meituan {
Log::info('os:' . $this->os); Log::info('os:' . $this->os);
Log::info('http:' . $http); Log::info('http:' . $http);
Log::info('body:' . $body); Log::info('body:' . $body);
if ($this->tryTimes > 1) {
(new ThirdApiService())->weComNotice($this->os); (new ThirdApiService())->weComNotice($this->os);
} }
$this->tryTimes++;
}
return $res; return $res;
} }
} }

View File

@ -6,6 +6,7 @@ use app\common\Error;
use app\model\Admins as AdminsModel; use app\model\Admins as AdminsModel;
use app\model\FilterMobiles; use app\model\FilterMobiles;
use app\model\Finances as FinancesModel; use app\model\Finances as FinancesModel;
use app\model\LiveRoomWorks;
use app\model\Orders as OrdersModel; use app\model\Orders as OrdersModel;
use support\Log; use support\Log;
use support\Redis; use support\Redis;
@ -216,4 +217,24 @@ class Orders {
return $order; return $order;
} }
/**
* @param int $orderCreateTime
* @param $productId
* @return array|mixed|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function getLiveRoomWork(int $orderCreateTime, $productId) {
$orderCreateDate = date('Y-m-d H:i:s', $orderCreateTime/1000);
$roomWork = LiveRoomWorks::join('live_room', 'live_room_works.live_room_id=live_room.id')
->where('live_room_works.start', '<', $orderCreateDate)
->where('live_room_works.end', '>', $orderCreateDate)
->whereRaw(sprintf('find_in_set(%s, live_room.`product_ids`)', $productId))
->field(['live_room_works.id'])
->find();
return $roomWork;
}
} }

View File

@ -273,7 +273,7 @@ class Tongcheng {
$res = json_decode($body); $res = json_decode($body);
if (!isset($res->code) || $res->code != 1000) { if (!isset($res->code) || $res->code != 1000) {
Log::info( "同城 body{$body} \n\n"); Log::info( "同城 body{$body} \n\n");
if ($this->tryTimes > 3) { if ($this->tryTimes > 1) {
(new ThirdApiService())->weComNotice($this->os); (new ThirdApiService())->weComNotice($this->os);
} }
$this->tryTimes++; $this->tryTimes++;

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.app-container[data-v-97931c7e]{position:relative;padding-bottom:60px}[data-v-97931c7e] .el-tabs__nav-wrap:after{display:none}.el-table[data-v-97931c7e],.filter-container[data-v-97931c7e]{padding-bottom:5px}[data-v-97931c7e] .el-row{height:50px;line-height:50px}.head_lable[data-v-97931c7e]{font-size:14px;color:#3d3d3d;font-weight:700;margin-right:10px}.scheduling_head[data-v-97931c7e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:28px}.scheduling_tab[data-v-97931c7e]{display:inline-block;padding:12px 28px;font-size:16px;border:1px solid #e2e2e2;border-radius:5px;cursor:pointer}.scheduling_tab+.scheduling_tab[data-v-97931c7e]{margin-left:10px}.active[data-v-97931c7e]{border-color:#1269ff}.el-icon-circle-plus[data-v-97931c7e]{color:#367af0;font-size:16px}.scheduling_tab_pana[data-v-97931c7e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.scheduling_tab_pana .table-list[data-v-97931c7e]{-ms-flex-preferred-size:14.3%;flex-basis:14.3%}.scheduling_tab_pana .table-list .table-list_item[data-v-97931c7e]{height:56px;background:#e4ecff;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid #d7ddeb;margin-right:-1px;margin-bottom:-1px}.scheduling_tab_pana .table-list .table-list_item .tit[data-v-97931c7e]{width:100%;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:space-evenly;-ms-flex-pack:space-evenly;justify-content:space-evenly}.scheduling_tab_pana .table-list .table-list-box[data-v-97931c7e]{padding:15px;font-size:14px;color:#fff;border:1px solid #d7ddeb;margin-right:-1px;margin-bottom:-1px}.scheduling_tab_pana .table-list .table-list-box .border[data-v-97931c7e]{padding:13px;background:#367af0;cursor:pointer}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-7ebb7cb9"],{"5c7c":function(t,e,n){"use strict";n.r(e);var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"app-container"},[n("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],staticStyle:{width:"100%"},attrs:{data:t.list,border:"",fit:"","highlight-current-row":""}},[n("el-table-column",{attrs:{align:"center",label:"ID",width:"60",prop:"id"}}),n("el-table-column",{attrs:{align:"center",label:"姓名",width:"80",prop:"username"}}),n("el-table-column",{attrs:{align:"center",label:"状态",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[0===e.row.isOnline?n("el-tag",{attrs:{type:"border-card"}},[t._v("下线")]):t._e(),1===e.row.isOnline?n("el-tag",{attrs:{type:"success"}},[t._v("在线")]):t._e(),2===e.row.isOnline?n("el-tag",{attrs:{type:"info"}},[t._v("没上线")]):t._e()]}}])}),n("el-table-column",{attrs:{align:"center",label:"是否分单",width:"100"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("el-switch",{attrs:{"active-value":1,"inactive-value":0},on:{change:function(n){return t.updateStatus(e.row)}},model:{value:e.row.isEndWork,callback:function(n){t.$set(e.row,"isEndWork",n)},expression:"scope.row.isEndWork"}})]}}])}),n("el-table-column",{attrs:{align:"center",label:"在线时长",width:"120"},scopedSlots:t._u([{key:"default",fn:function(e){return[t._v(" "+t._s(Math.floor((e.row.data?e.row.data.onlineTime:e.row.onlineTime)/60)||"--")+" 分钟 ")]}}])}),n("el-table-column",{attrs:{width:"138px",align:"center",label:"上线时间"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("span",[t._v(t._s(t._f("parseTime")(e.row.start_work_time,"{y}-{m}-{d} {h}:{i}")))])]}}])}),n("el-table-column",{attrs:{width:"138px",align:"center",label:"停止分单时间"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("span",[t._v(t._s(t._f("parseTime")(e.row.end_work_time,"{y}-{m}-{d} {h}:{i}")))])]}}])}),n("el-table-column",{attrs:{width:"138px",align:"center",label:"下线时间"},scopedSlots:t._u([{key:"default",fn:function(e){return[n("span",[t._v(t._s(t._f("parseTime")(e.row.last_work_time,"{y}-{m}-{d} {h}:{i}")))])]}}])}),n("el-table-column",{attrs:{width:"138px",align:"center",label:"路线"},scopedSlots:t._u([{key:"default",fn:function(e){return[10===e.row.route_type?n("el-tag",{attrs:{type:"border-card"}},[t._v("境内路线")]):t._e(),20===e.row.route_type?n("el-tag",{attrs:{type:"success"}},[t._v("境外路线")]):t._e()]}}])})],1)],1)},a=[],l={name:"GetOnlineList",components:{},data:function(){return{statusArr:{0:"禁用",1:"启用"},list:[],total:0,loading:!1,listLoading:!0,listQuery:{page:1,limit:10,status:null,content:""},dialogCreate:!1,dialogEdit:!1,item:{},anchors:{}}},created:function(){this.listQuery.status=this.$route.query.status||null,this.listQuery.content=this.$route.query.content||null,this.getOnlineList()},methods:{getOnlineList:function(){var t=this;this.listLoading=!0,this.$axios.get("/admin/admin/getOnlineList",{params:this.listQuery}).then((function(e){t.list=e.data,t.listLoading=!1})).catch((function(){t.listLoading=!1}))},updateStatus:function(t){var e=this;this.$axios.post("/admin/admin/editInfo",{id:t.id,order_num:t.order_num,is_order:t.isEndWork}).then((function(){e.getOnlineList()})).catch((function(){}))}}},s=l,r=(n("c028"),n("2877")),o=Object(r["a"])(s,i,a,!1,null,"7c77c70f",null);e["default"]=o.exports},c028:function(t,e,n){"use strict";n("c7c8")},c7c8:function(t,e,n){}}]);

File diff suppressed because one or more lines are too long

View File

@ -526,3 +526,36 @@ function input(string $param = null, $default = null)
{ {
return is_null($param) ? request()->all() : request()->input($param, $default); return is_null($param) ? request()->all() : request()->input($param, $default);
} }
/**
* 获取一周的日期
* @return array
*/
function get_week_days() {
// 获取当前日期
$today = new DateTime();
// 获取当前周的周一
$monday = clone $today;
$monday->modify('monday this week');
// 获取当前周的周日
$sunday = clone $today;
$sunday->modify('sunday this week');
// 初始化日期数组
$dates = [];
$dayNmae = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期天'];
// 从周一到周日循环
for ($i = 0; $i < 7; $i++) {
$date = clone $monday;
$date->modify("+$i days");
$dates[] = [
'date_name' => $dayNmae[$i],
'date' => $date->format('Y-m-d')
];
}
return $dates;
}