This commit is contained in:
parent
af6be7dcfb
commit
4cb91b32d0
|
@ -101,7 +101,7 @@ export const asyncRoutes = [
|
|||
title: '客服在线列表',
|
||||
roles: ['admin']
|
||||
}
|
||||
},
|
||||
}/*,
|
||||
{
|
||||
path: 'shortcut',
|
||||
component: () => import('@/views/shortcut/shortcutContent.vue'),
|
||||
|
@ -110,7 +110,7 @@ export const asyncRoutes = [
|
|||
title: '快捷内容设置',
|
||||
roles: ['admin']
|
||||
}
|
||||
}/*,
|
||||
},
|
||||
{
|
||||
path: 'teams',
|
||||
component: () => import('@/views/admin/teams'),
|
||||
|
@ -218,7 +218,7 @@ export const asyncRoutes = [
|
|||
roles: ['data_index']
|
||||
}
|
||||
},
|
||||
{
|
||||
/* {
|
||||
path: 'online',
|
||||
component: () => import('@/views/data/online'),
|
||||
name: 'Index',
|
||||
|
@ -235,7 +235,7 @@ export const asyncRoutes = [
|
|||
title: '主播概况',
|
||||
roles: ['data_anchor']
|
||||
}
|
||||
},
|
||||
},*/
|
||||
{
|
||||
path: 'sale',
|
||||
component: () => import('@/views/data/sale'),
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-table v-loading="listLoading" :data="list" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column align="center" label="ID" width="80" prop="id" />
|
||||
<el-table-column align="center" label="姓名" width="380" prop="name" />
|
||||
<el-table-column align="center" label="ID" width="60" prop="id" />
|
||||
<el-table-column align="center" label="姓名" width="80" prop="name" />
|
||||
<el-table-column align="center" label="状态" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.isOnline === 0" type="border-card">下线</el-tag>
|
||||
|
@ -10,25 +10,35 @@
|
|||
<el-tag v-if="scope.row.isOnline === 2" type="info">没上线</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="是否分单" width="100">
|
||||
<!-- <el-table-column align="center" label="是否分单" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag v-if="scope.row.isEndWork === 0" type="border-card">否</el-tag>
|
||||
<el-tag v-if="scope.row.isEndWork === 1" type="success">是</el-tag>
|
||||
</template>
|
||||
</el-table-column>-->
|
||||
<el-table-column align="center" label="是否分单" width="100">
|
||||
<template #default="scope">
|
||||
<el-switch v-model="scope.row.isEndWork" :active-value="1" :inactive-value="0" @change="updateStatus(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="在线时长" width="380">
|
||||
<el-table-column align="center" label="剩余限制订单数量" width="190">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.order_num" :max="9999999" :min="0" class="small-input-number" style="width: 160px; height: 36px;" @change="updateStatus(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="在线时长" width="80">
|
||||
<template slot-scope="scope">
|
||||
{{ Math.floor((scope.row.data ? scope.row.data.onlineTime : scope.row.onlineTime) / 3600) || '--' }} 分钟
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="138px" align="center" label="上班时间">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.last_follow | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
<span>{{ scope.row.start_work_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="138px" align="center" label="下班时间">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.last_follow | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
<span>{{ scope.row.end_work_time | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -69,11 +79,16 @@ export default {
|
|||
this.listLoading = true // /admin/admin/getOnlineList /admin/shortcutContent/list
|
||||
this.$axios.get('/admin/admin/getOnlineList', { params: this.listQuery }).then(response => {
|
||||
this.list = response.data
|
||||
console.log('====list==' + this.list)
|
||||
this.listLoading = false
|
||||
}).catch(() => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
updateStatus(item) {
|
||||
this.$axios.post('/admin/admin/editInfo', { id: item.id, order_num: item.order_num, is_order: item.isEndWork }).then(() => {
|
||||
this.getOnlineList()
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,12 +30,16 @@
|
|||
<el-button v-if="scope.row.self ==0 && scope.row.status == 0" type="success" size="small" icon="el-icon-close" @click="onRefuse(scope.row)">
|
||||
拒绝
|
||||
</el-button>
|
||||
<el-button v-if="scope.row.self ==3 && scope.row.status == 0" type="success" size="small" icon="el-icon-close" @click="onCancel(scope.row)">
|
||||
取消
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column align="center" label="转出" width="80" prop="outto.username" />
|
||||
|
||||
<el-table-column align="center" label="转入" width="80" prop="into.username" />
|
||||
<el-table-column align="center" label="申请者" width="80" prop="apply.username" />
|
||||
<el-table-column align="center" label="订单号" width="220" prop="orders.sn" />
|
||||
<el-table-column align="center" label="产品" prop="orders.product_name" />
|
||||
|
||||
|
@ -158,6 +162,15 @@ export default {
|
|||
this.getList()
|
||||
}).catch(err => {
|
||||
|
||||
})
|
||||
},
|
||||
onCancel(item) {
|
||||
this.$axios.post('/admin/order/backcancel', { id: item.id }).then(res => {
|
||||
this.dialogVisible = false
|
||||
this.item = {}
|
||||
this.getList()
|
||||
}).catch(err => {
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,9 +74,9 @@
|
|||
|
||||
<el-table-column align="center" fixed width="200" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button type="success" size="small" icon="el-icon-refresh" @click="onCirculation(scope.row)">
|
||||
<el-button type="success" size="small" icon="el-icon-refresh" @click="onCirculation(scope.row)">
|
||||
流转出
|
||||
</el-button>-->
|
||||
</el-button>
|
||||
<el-button :type="types[scope.row.order_status]" size="small" icon="el-icon-edit" @click="onInfo(scope.row)">
|
||||
跟进
|
||||
</el-button>
|
||||
|
@ -357,7 +357,6 @@
|
|||
|
||||
<el-dialog title="申请转出订单" :visible.sync="dialog3Visible">
|
||||
<el-form label-width="160px" :model="item3">
|
||||
<el-input v-model="item3.os" disabled />
|
||||
<el-form-item label="标题:">
|
||||
<el-input v-model="item3.product_name" disabled />
|
||||
</el-form-item>
|
||||
|
@ -379,7 +378,7 @@
|
|||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="onCirculationSave()">确 认</el-button>
|
||||
<el-button type="primary" @click="onCirculationSave(value)">确 认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
|
@ -497,15 +496,15 @@ export default {
|
|||
this.dialog3Visible = true
|
||||
this.item3 = { ...item, os: Number(item.os) }
|
||||
},
|
||||
onCirculationSave() {
|
||||
console.log('====os:' + JSON.stringify(this.item3))
|
||||
/* this.$axios.post('/admin/order/back', this.item).then(res => {
|
||||
this.dialogVisible = false
|
||||
onCirculationSave(to_admin_id) {
|
||||
this.$axios.post('/admin/order/back', { sn: this.item3.sn, os: this.item3.os, to_admin_id: to_admin_id }).then(res => {
|
||||
this.dialog3Visible = false
|
||||
this.item = {}
|
||||
this.getList()
|
||||
console.log(this.dialog3Visible)
|
||||
}).catch(err => {
|
||||
|
||||
})*/
|
||||
})
|
||||
},
|
||||
onBack() {
|
||||
this.$axios.post('/admin/order/back', this.item).then(res => {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<el-table-column align="center" fixed label="快捷内容" width="380" prop="content" />
|
||||
<el-table-column align="center" label="排序" width="140">
|
||||
<template #default="scope">
|
||||
<el-input-number v-model="scope.row.sort" :max="100" :min="0" class="small-input-number" @change="updateSort(scope.row)" style="width: 110px; height: 36px;" />
|
||||
<el-input-number v-model="scope.row.sort" :max="100" :min="0" class="small-input-number" style="width: 110px; height: 36px;" @change="updateSort(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="状态" width="100">
|
||||
|
@ -56,7 +56,7 @@
|
|||
<el-input v-model="anchors.content" type="textarea" placeholder="请输入快捷内容" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input-number class="aaas" v-model="anchors.sort" :max="100" :min="0" controls-position="right" />
|
||||
<el-input-number v-model="anchors.sort" :max="100" :min="0" controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-switch v-model="anchors.status" :active-value="1" :inactive-value="0" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
|
|
|
@ -159,14 +159,36 @@ class AdminController extends base
|
|||
$list[$adminId]['onlineTime'] = 0;
|
||||
$list[$adminId]['isOnline'] = 2;
|
||||
}
|
||||
Log::warning('===bug:',['bug'=> (!config('app.debug', true))]);
|
||||
if ($user->is_order == 1 && $list[$adminId]['isOnline'] ==1 && empty(Redis::get("CRM:USER:ENDWORK:".$user->id)) && (!config('app.debug', true))){
|
||||
|
||||
if (!isset($list[$adminId]['isOnline'])){
|
||||
$list[$adminId]['isOnline'] = 0;
|
||||
}
|
||||
|
||||
// if ($user->is_order == 1 && $list[$adminId]['isOnline'] ==1){
|
||||
if ($user->is_order == 1){
|
||||
$list[$adminId]['isEndWork'] = 1;//是否分单
|
||||
}else{
|
||||
$list[$adminId]['isEndWork'] = 0;
|
||||
}
|
||||
$list[$adminId]['start_work_time'] = $user->start_work_time;
|
||||
$list[$adminId]['end_work_time'] = $user->end_work_time;
|
||||
$list[$adminId]['order_num'] = $user->order_num;
|
||||
}
|
||||
|
||||
return $this->success(array_values($list));
|
||||
}
|
||||
|
||||
public function editInfo(Request $request)
|
||||
{
|
||||
$post = $request->post();
|
||||
if (empty($post['id'])) return $this->error(500, '参数错误');
|
||||
|
||||
try {
|
||||
Admins::update($post);
|
||||
}catch (\Exception $e){
|
||||
return $this->error(2001,$e->getMessage());
|
||||
}
|
||||
|
||||
return $this->success(true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Citys;
|
||||
use support\Request;
|
||||
|
||||
class CityController extends base
|
||||
{
|
||||
public function getCityList(Request $request){
|
||||
$list = Citys::fieldRaw('city_id,city_name')->where('status','=',1)->order('sort','desc')->select();
|
||||
return $this->success($list);
|
||||
}
|
||||
}
|
|
@ -8,6 +8,7 @@ use app\model\Follows;
|
|||
use app\model\Orders;
|
||||
use app\model\Logs;
|
||||
use stdClass;
|
||||
use support\Log;
|
||||
use support\Redis;
|
||||
use support\Request;
|
||||
|
||||
|
@ -31,7 +32,7 @@ class OrderController extends base
|
|||
|
||||
$status = $request->get('status', null);
|
||||
|
||||
$query = Orders::attimes($timetype, $times)->with(['admin','anchor'])->where($where)
|
||||
$query = Orders::attimes($timetype, $times)->with(['admin','anchor','backs'])->where($where)
|
||||
->order('create_at','desc')
|
||||
->order('update_time','desc')
|
||||
->order('id','desc');
|
||||
|
@ -294,7 +295,7 @@ class OrderController extends base
|
|||
$sn = $request->get('sn');
|
||||
$status = $request->get('status',null);
|
||||
|
||||
$query = Backs::with(['into','outto','orders'])->where(function($query) use($request) {
|
||||
$query = Backs::with(['into','outto','orders','apply'])->where(function($query) use($request) {
|
||||
$query->where('admin_id', $request->admin->id)->WhereOr('admin', $request->admin->id);
|
||||
})->order('update_time','desc')->order('id','desc');
|
||||
|
||||
|
@ -309,8 +310,12 @@ class OrderController extends base
|
|||
|
||||
$backs = $query->paginate($request->get('limit',10));
|
||||
foreach($backs as &$back){
|
||||
if ($back->admin_id == $request->admin->id || $back->admin == $request->admin->id){
|
||||
$back->self = 0;
|
||||
if($back->admin_id == $request->admin->id) {
|
||||
if($back->apply_id == $request->admin->id) {
|
||||
$back->self = 3;
|
||||
}
|
||||
}else{
|
||||
$back->self = 1;
|
||||
}
|
||||
}
|
||||
|
@ -322,19 +327,22 @@ class OrderController extends base
|
|||
public function back(Request $request) {
|
||||
$sn = $request->post('sn');
|
||||
$os = $request->post('os');
|
||||
$to_admin_id = $request->post('to_admin_id');
|
||||
$admin_id = empty($to_admin_id) ? $request->admin->id : $to_admin_id;
|
||||
|
||||
if(empty($sn)) return $this->error(2001, '提交单号');
|
||||
|
||||
$item = Orders::where('sn', $sn)->where('os', $os)->find();
|
||||
if(empty($item)) return $this->error(2002, '订单没有找到');
|
||||
if($item->admin_id == $request->admin->id) return $this->error(2002, '订单已经在你的账号上,不需要再拉取!');
|
||||
if($item->admin_id == $admin_id) return $this->error(2002, '订单已经在账号上,不需要再拉取!');
|
||||
|
||||
$back = Backs::create([
|
||||
'order_id' => $item->id,
|
||||
'admin_id' => $request->admin->id,
|
||||
'admin' => $item->admin_id
|
||||
'admin_id' => $admin_id,
|
||||
'admin' => $item->admin_id,
|
||||
'apply_id' => $request->admin->id
|
||||
]);
|
||||
Logs::todo($item->id, $request->admin->id, 7);
|
||||
Logs::todo($item->id, $admin_id, 7);
|
||||
|
||||
if($back) {
|
||||
return $this->success($back);
|
||||
|
@ -346,19 +354,22 @@ class OrderController extends base
|
|||
public function toBack(Request $request) {
|
||||
$sn = $request->post('sn');
|
||||
$os = $request->post('os');
|
||||
$to_admin_id = $request->post('to_admin_id');
|
||||
$admin_id = empty($to_admin_id) ? $request->admin->id : $to_admin_id;
|
||||
|
||||
if(empty($sn)) return $this->error(2001, '提交单号');
|
||||
|
||||
$item = Orders::where('sn', $sn)->where('os', $os)->find();
|
||||
if(empty($item)) return $this->error(2002, '订单没有找到');
|
||||
if($item->admin_id == $request->admin->id) return $this->error(2002, '订单已经在你的账号上,不需要再拉取!');
|
||||
if($item->admin_id == $admin_id) return $this->error(2002, '订单已经在账号上,不需要再拉取!');
|
||||
|
||||
$back = Backs::create([
|
||||
'order_id' => $item->id,
|
||||
'admin_id' => $request->admin->id,
|
||||
'admin' => $item->admin_id
|
||||
'admin_id' => $admin_id,
|
||||
'admin' => $item->admin_id,
|
||||
'apply_id' => $request->admin->id
|
||||
]);
|
||||
Logs::todo($item->id, $request->admin->id, 7);
|
||||
Logs::todo($item->id, $admin_id, 7);
|
||||
|
||||
if($back) {
|
||||
return $this->success($back);
|
||||
|
@ -367,12 +378,20 @@ class OrderController 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 backpass(Request $request) {
|
||||
$id = $request->post('id', 0);
|
||||
|
||||
$item = Backs::where('id', $id)->find();
|
||||
if($item->status != 0) return $this->error(2004, '记录已经处理了.');
|
||||
if($item->admin != $request->admin->id) return $this->error(2005, '管理员错误');
|
||||
if($item->admin != $request->admin->id && $item->admin != $item->apply_id) return $this->error(2005, '管理员错误');
|
||||
|
||||
try {
|
||||
Backs::change($item);
|
||||
|
@ -382,13 +401,21 @@ class OrderController 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 backrefuse(Request $request) {
|
||||
$id = $request->post('id', 0);
|
||||
|
||||
$item = Backs::where('id', $id)->find();
|
||||
if(empty($item)) return $this->error(2004, '记录没有找到.');
|
||||
if($item->status != 0) return $this->error(2004, '记录已经处理了.');
|
||||
if($item->admin != $request->admin->id) return $this->error(2005, '管理员错误');
|
||||
if($item->admin != $request->admin->id && $item->admin != $item->apply_id) return $this->error(2005, '管理员错误');
|
||||
|
||||
try {
|
||||
Backs::refuse($item);
|
||||
|
@ -398,4 +425,29 @@ class OrderController 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 backcancel(Request $request)
|
||||
{
|
||||
$id = $request->post('id', 0);
|
||||
|
||||
$item = Backs::where('id', $id)->find();
|
||||
if(empty($item)) return $this->error(2004, '记录没有找到.');
|
||||
if($item->status != 0) return $this->error(2004, '记录已经处理了.');
|
||||
if($item->admin != $request->admin->id && $item->admin == $item->apply_id) return $this->error(2005, '管理员错误');
|
||||
|
||||
try {
|
||||
Backs::cancel($item);
|
||||
return $this->success('');
|
||||
}catch(\Exception $e) {
|
||||
return $this->error(2006, '确认失败了');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Qas;
|
||||
use support\Request;
|
||||
|
||||
class QaController extends base
|
||||
{
|
||||
public function getQaList(Request $request)
|
||||
{
|
||||
$cityId = $request->get('city_id');
|
||||
$limit = $request->get('limit', 10);
|
||||
|
||||
if (empty($cityId)) return $this->error(2001, 'city_id cannot be empty!');
|
||||
|
||||
$list = Qas::fieldRaw('city_id,title,content')->where('city_id', $cityId)->paginate($limit);
|
||||
|
||||
return $this->success($list);
|
||||
}
|
||||
|
||||
public function getQaDetail(Request $request)
|
||||
{
|
||||
$cityId = $request->get('city_id');
|
||||
// $id = $request->get('id');
|
||||
|
||||
if (empty($cityId)) return $this->error(2001, 'city_id cannot be empty!');
|
||||
|
||||
$data = Qas::fieldRaw('city_id,title,content')->where([/*'id' => $id, */'city_id' => $cityId])->find();
|
||||
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
public function addQa(Request $request)
|
||||
{
|
||||
$post = $request->post();
|
||||
if (empty($post['city_id'])) return $this->error(2001, 'city_id data cannot be empty!');
|
||||
if (empty($post['title'])) return $this->error(2001, 'title data cannot be empty!');
|
||||
if (empty($post['content'])) return $this->error(2001, 'content data cannot be empty!');
|
||||
|
||||
try {
|
||||
$data = Qas::create($post);
|
||||
} catch (\Exception $e) {
|
||||
return $this->error(2002, $e->getMessage());
|
||||
}
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
public function editQa(Request $request)
|
||||
{
|
||||
$post = $request->post();
|
||||
if (empty($post['id'])) return $this->error(2001, 'id data cannot be empty!');
|
||||
|
||||
try {
|
||||
$data = Qas::update($post);
|
||||
} catch (\Exception $e) {
|
||||
return $this->error(2002, $e->getMessage());
|
||||
}
|
||||
return $this->success($data);
|
||||
}
|
||||
|
||||
public function delQa(Request $request)
|
||||
{
|
||||
$id = $request->get('id');
|
||||
if (empty($id)) return $this->error(2001, 'id data cannot be empty!');
|
||||
try {
|
||||
$data = Qas::destroy($id);
|
||||
} catch (\Exception $e) {
|
||||
return $this->error(2002, $e->getMessage());
|
||||
}
|
||||
return $this->success($data);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\model\Admins;
|
||||
|
@ -6,10 +7,12 @@ use app\model\Orders;
|
|||
use app\model\Works;
|
||||
use support\Redis;
|
||||
use support\Request;
|
||||
use function Symfony\Component\Translation\t;
|
||||
|
||||
class WorkController extends base
|
||||
{
|
||||
public function index(Request $request) {
|
||||
public function index(Request $request)
|
||||
{
|
||||
$admin_id = $request->get('id');
|
||||
$admin = $request->get('username');
|
||||
if ($admin) {
|
||||
|
@ -23,7 +26,8 @@ class WorkController extends base
|
|||
return $this->success($list->append(['total', 'oss']), '', ['oss' => Orders::OSS]);
|
||||
}
|
||||
|
||||
public function saves(Request $request) {
|
||||
public function saves(Request $request)
|
||||
{
|
||||
return '';
|
||||
$admin_id = $request->post('admin_id');
|
||||
$dates = $request->post('dates');
|
||||
|
@ -57,7 +61,8 @@ class WorkController extends base
|
|||
return $this->success($date);
|
||||
}
|
||||
|
||||
public function save2(Request $request) {
|
||||
public function save2(Request $request)
|
||||
{
|
||||
$times = $request->post('times');
|
||||
if (!empty($times)) {
|
||||
$times = $request->post('times');
|
||||
|
@ -110,7 +115,8 @@ class WorkController extends base
|
|||
/**
|
||||
* @保存一天的时间
|
||||
*/
|
||||
public function save(Request $request) {
|
||||
public function save(Request $request)
|
||||
{
|
||||
$id = $request->post('id', 0);
|
||||
$date = $request->post('date');
|
||||
$oss = $request->post('oss');
|
||||
|
@ -137,7 +143,8 @@ class WorkController extends base
|
|||
return $this->error(2003);
|
||||
}
|
||||
|
||||
public function del(Request $request) {
|
||||
public function del(Request $request)
|
||||
{
|
||||
$id = $request->post('id', 0);
|
||||
|
||||
if ($id) {
|
||||
|
@ -152,7 +159,8 @@ class WorkController extends base
|
|||
}
|
||||
}
|
||||
|
||||
public function anchor(Request $request) {
|
||||
public function anchor(Request $request)
|
||||
{
|
||||
$anchor = Admins::where('status', 1)->where('is_anchor', 1)->select();
|
||||
foreach ($anchor as &$an) {
|
||||
$an->os = [];
|
||||
|
@ -160,18 +168,25 @@ class WorkController extends base
|
|||
return $this->success($anchor->hidden(['password', 'remember_token']));
|
||||
}
|
||||
|
||||
public function endworks(Request $request) {
|
||||
Redis::set("CRM:USER:ENDWORK:".$request->admin->id,10*3600);
|
||||
public function endworks(Request $request)
|
||||
{
|
||||
// Redis::set("CRM:USER:ENDWORK:".$request->admin->id,10*3600);
|
||||
Admins::update(['id' => $request->admin->id, 'is_order' => 0, 'end_work_time' => time()]);
|
||||
return $this->success(null);
|
||||
}
|
||||
|
||||
public function startworks(Request $request) {
|
||||
Redis::del("CRM:USER:ENDWORK:".$request->admin->id);
|
||||
public function startworks(Request $request)
|
||||
{
|
||||
// Redis::del("CRM:USER:ENDWORK:" . $request->admin->id);
|
||||
Admins::update(['id' => $request->admin->id, 'is_order' => 1,'start_work_time' => time()]);
|
||||
return $this->success(null);
|
||||
}
|
||||
|
||||
public function getworkstatus(Request $request) {
|
||||
$workstatus = Redis::get("CRM:USER:ENDWORK:".$request->admin->id);
|
||||
public function getworkstatus(Request $request)
|
||||
{
|
||||
// $workstatus = Redis::get("CRM:USER:ENDWORK:" . $request->admin->id);
|
||||
$data = Admins::where('id' , $request->admin->id)->find();
|
||||
$workstatus = !$data->is_order;
|
||||
return $this->success((bool)$workstatus);
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ class SpiderMt extends Command
|
|||
protected static $defaultDescription = '美团订单拉取器';
|
||||
|
||||
protected $_users = [];
|
||||
protected $order_num = 99999999;
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
|
@ -51,12 +52,23 @@ class SpiderMt extends Command
|
|||
if (empty($ru)) continue;
|
||||
}
|
||||
//过滤不分配订单的客服用户
|
||||
$isEndWork = Redis::get("CRM:USER:ENDWORK:" . $u->id);
|
||||
/*$isEndWork = Redis::get("CRM:USER:ENDWORK:" . $u->id);
|
||||
if (empty($isEndWork)) {
|
||||
$_u = new stdClass();
|
||||
$_u->username = $u->id;
|
||||
$us[] = $_u;
|
||||
}*/
|
||||
if ($u->order_num > 0){
|
||||
$_u = new stdClass();
|
||||
$_u->username = $u->id;
|
||||
$us[] = $_u;
|
||||
if ($u->order_num != $this->order_num){
|
||||
Admins::where('id',$u->id)->decrement('order_num',1);
|
||||
}
|
||||
}
|
||||
$_u = new stdClass();
|
||||
$_u->username = $u->id;
|
||||
$us[] = $_u;
|
||||
};
|
||||
$this->_users = $us;
|
||||
return $this->_users;
|
||||
|
|
|
@ -16,4 +16,5 @@ class Admins extends base
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -13,6 +13,10 @@ class Backs extends base
|
|||
return $this->belongsTo(Admins::class, 'admin')->visible(['name','username','avatar']);
|
||||
}
|
||||
|
||||
public function apply() {
|
||||
return $this->belongsTo(Admins::class, 'apply_id')->visible(['name','username','avatar']);
|
||||
}
|
||||
|
||||
public function orders(){
|
||||
return $this->belongsTo(Orders::class, 'order_id');
|
||||
}
|
||||
|
@ -36,4 +40,11 @@ class Backs extends base
|
|||
Logs::todo($item->order_id, $item->admin, 9); //拒绝请求
|
||||
});
|
||||
}
|
||||
|
||||
public static function cancel(Backs $item) {
|
||||
Db::transaction(function() use ($item) {
|
||||
Backs::where('id', $item->id)->where('status', 0)->update(['status' => 3]);
|
||||
Logs::todo($item->order_id, $item->admin, 10); //拒绝请求
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
class Citys extends base
|
||||
{
|
||||
|
||||
}
|
|
@ -103,6 +103,10 @@ class Orders extends base{
|
|||
return $this->belongsTo(Admins::class, 'zhubo')->visible(['name','username','avatar']);
|
||||
}
|
||||
|
||||
public function backs() {
|
||||
return $this->hasOne(Backs::class, 'order_id')->visible(['status']);
|
||||
}
|
||||
|
||||
public function follow() {
|
||||
return $this->hasMany(Follows::class, 'order_id')->order('id','desc');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
class Qas extends base
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue