作者 jingchen

submit

不能预览此文件类型
... ... @@ -4,6 +4,7 @@ namespace app\admin\controller;
use app\admin\model\AdminLog;
use app\common\controller\Backend;
use app\admin\model\Order;
use think\Config;
use think\Db;
use think\Hook;
... ... @@ -18,7 +19,7 @@ class Index extends Backend
{
protected $noNeedLogin = ['login'];
protected $noNeedRight = ['index', 'logout','timi_msg'];
protected $noNeedRight = ['index', 'logout', 'timi_msg'];
protected $layout = '';
protected $whiteList = [];
... ... @@ -27,30 +28,59 @@ class Index extends Backend
parent::_initialize();
//移除HTML标签
$this->request->filter('trim,strip_tags,htmlspecialchars');
$this->whiteList = ['0.0.0.0','127.0.0.1','139.9.122.254','111.164.178.189','222.70.235.227'];
$this->whiteList = ['0.0.0.0', '127.0.0.1', '139.9.122.254', '111.164.178.189', '222.70.235.227'];
}
/**
* 订单提醒
* 使用轮询订单提醒
* @return void
* @throws \think\Exception
*/
public function timi_msg()
{
//处理逻辑
//获取新订单
$count = Db::name("order")->where(["status"=>7])->whereNull('deletetime')->count('id');
$counts = Db::name("order")->whereNull('deletetime')->where(["status"=>7,'tx_status'=>0])->count('id');
$find = Db::name("order")->whereNull('deletetime')->where(["status"=>7,'tx_status'=>0])->find();
$createtime = $find['createtime'];
//有新消息或者状态未变更都提醒
if ($count > 0) {
$data['num'] = $count;
$data['nums'] = $counts;
\db('order')->where('status', 7)->update(['tx_status'=>1]);
$this->success("有新待服务订单消息", "", $data);
} else {
//$this->success('暂无消息');
// 获取服务订单通知
$serviceOrderCount = Order
::where(["type" => 1, "status" => 7])
->whereNull('deletetime')
->count('id');
$serviceOrderUnchangedCount = Order
::whereNull('deletetime')
->where(["type" => 1, "status" => 7, "tx_status" => 0])
->count('id');
// 获取商品订单通知
$productOrderCount = Order
::where(["type" => 2, "status" => 2]) // 假设status=2表示商品订单待处理
->whereNull('deletetime')
->count('id');
$productOrderUnchangedCount = Order
::whereNull('deletetime')
->where(["type" => 2, "status" => 2, "tx_status" => 0])
->count('id');
// 如果有新消息或者状态未变更,发送通知
if ($serviceOrderCount > 0 || $productOrderCount > 0) {
$data = [
'service_num' => $serviceOrderCount,
'service_nums' => $serviceOrderUnchangedCount,
'product_num' => $productOrderCount,
'product_nums' => $productOrderUnchangedCount,
];
// 更新通知状态
if ($serviceOrderCount > 0) {
Db::name('order')
->where(['type' => 1, 'status' => 7])
->update(['tx_status' => 1]);
}
if ($productOrderCount > 0) {
Db::name('order')
->where(['type' => 2, 'status' => 2])
->update(['tx_status' => 1]);
}
$this->success("有新订单消息", "", $data);
}
}
... ... @@ -69,9 +99,9 @@ class Index extends Backend
//左侧菜单
list($menulist, $navlist, $fixedmenu, $referermenu) = $this->auth->getSidebar([
'dashboard' => 'hot',
'addon' => ['new', 'red', 'badge'],
'addon' => ['new', 'red', 'badge'],
'auth/rule' => __('Menu'),
'general' => ['new', 'purple'],
'general' => ['new', 'purple'],
], $this->view->site['fixedpage']);
$action = $this->request->request('action');
if ($this->request->isPost()) {
... ... @@ -103,13 +133,13 @@ class Index extends Backend
$keeplogin = $this->request->post('keeplogin');
$token = $this->request->post('__token__');
$rule = [
'username' => 'require|length:3,30',
'password' => 'require|length:3,30',
'username' => 'require|length:3,30',
'password' => 'require|length:3,30',
'__token__' => 'require|token',
];
$data = [
'username' => $username,
'password' => $password,
'username' => $username,
'password' => $password,
'__token__' => $token,
];
if (Config::get('fastadmin.login_captcha')) {
... ...
... ... @@ -4,6 +4,7 @@ return [
'Id' => 'ID',
'Name' => '充值卡名称',
'Subname' => '充值卡标题',
'Desc' => '充值卡说明',
'Images' => '充值卡版面',
'Createtime' => '创建时间',
'Updatetime' => '更新时间'
... ...
... ... @@ -18,14 +18,20 @@
<div class="input-group">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-desc" class="form-control editor" rows="5" name="row[desc]" cols="50"></textarea>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -12,20 +12,27 @@
<input id="c-subname" class="form-control" name="row[subname]" type="text" value="{$row.subname|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <div class="input-group">-->
<!-- <input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">-->
<!-- <div class="input-group-addon no-border no-padding">-->
<!-- <span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>-->
<!-- <span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>-->
<!-- </div>-->
<!-- <span class="msg-box n-right" for="c-images"></span>-->
<!-- </div>-->
<!-- <ul class="row list-inline faupload-preview" id="p-images"></ul>-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-desc" class="form-control editor" rows="5" name="row[desc]" cols="50">{$row.desc|htmlentities}</textarea>
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
... ...
... ... @@ -6,8 +6,8 @@
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<!-- <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>-->
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('activity/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('activity/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<div class="dropdown btn-group {:$auth->check('activity/multi')?'':'hide'}">
... ... @@ -21,7 +21,7 @@
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="{:$auth->check('activity/edit')}"
data-operate-del=""
data-operate-del="{:$auth->check('activity/del')}"
width="100%">
</table>
</div>
... ...
... ... @@ -2,17 +2,25 @@
<section class="sidebar">
<!--订单提醒信息-->
<div class="l_kf" style="padding:10px;">
<a id='timimsg' href="#" target="_blank"> 需处理的待服务订单:
<span class="badge" id="timimsg_num" style="background-color: red;">0</span>
</a>
<div>
<a id='service_msg' href="#" target="_blank"> 需处理的服务订单:
<span class="badge" id="service_num" style="background-color: red;">0</span>
</a>
</div>
<div>
<a id='product_msg' href="#" target="_blank"> 需处理的商品订单:
<span class="badge" id="product_num" style="background-color: red;">0</span>
</a>
</div>
<audio id="timi_audio">
<source src="https://soospa.cn/assets/tixing.mp3" type="audio/mpeg">
<source src="http://soospa.jcyang.cn/assets/tixing.mp3" type="audio/mpeg">
</audio>
</div>
<!-- 管理员信息 -->
<div class="user-panel hidden-xs">
<div class="pull-left image">
<a href="general/profile" class="addtabsit"><img src="{$admin.avatar|cdnurl|htmlentities}" class="img-circle" /></a>
<a href="general/profile" class="addtabsit"><img src="{$admin.avatar|cdnurl|htmlentities}"
class="img-circle"/></a>
</div>
<div class="pull-left info">
<p>{$admin.nickname|htmlentities}</p>
... ...
... ... @@ -166,4 +166,10 @@ class Active extends Api
$response->send();
}
// 获取我的礼品卡
public function getMyCard(){
}
}
\ No newline at end of file
... ...
... ... @@ -153,6 +153,7 @@ class Goods extends Api
'total_price'=>$pay_price,
'pay_price'=>$pay_price,
'type'=>2,
'tx_status'=>0,
'createtime'=>time()
];
$order->save($orderdata);
... ... @@ -229,7 +230,7 @@ class Goods extends Api
'shphone'=>$address['tel'],
'shaddress'=>$address['city'].$address['address'],
'remark'=>$param['remark'] ? $param['remark'] : null,
'updatetime'=>time()
'updatetime'=>time(),
];
$order->save($orderdata,['id'=>$param['order_id']]);
$id = $param['order_id'];
... ...
... ... @@ -267,7 +267,7 @@ return [
//会员注册验证码类型email/mobile/wechat/text/false
'user_register_captcha' => 'text',
//登录验证码
'login_captcha' => true,
'login_captcha' => false,
//登录失败超过10次则1天后重试
'login_failure_retry' => true,
//是否同一账号同一时间只能在一个地方登录
... ...
不能预览此文件类型
... ... @@ -17,48 +17,39 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
}
});
// 订单提醒
var timi_audio = document.getElementById('timi_audio');
// setInterval(function () {
// $.ajax({
// url: "index/timi_msg",
// success:function (data) {
// $("#timimsg_num").html(data['num']);
// $("#timimsg").attr("href",data['url']);
// // remind = data;
// // sessionStorage.num = data;
// if(parseInt(data['nums'])>0){
// timi_audio.play();//播放提醒声音
// //clearInterval(timer)
// }else{
// timi_audio.pause(); //暂停
// }
// }
// });
// // });
// },10000);
var timer = setInterval(function (){
Fast.api.ajax({
url: "index/timi_msg",
data: {},
},function(data, ret){
//location.reload()
$("#timimsg_num").html(data['num']);
$("#timimsg").attr("href",data['url']);
if(parseInt(data['nums'])>0){
timi_audio.play();//播放提醒声音
//clearInterval(timer)
}else{
timi_audio.pause(); //暂停
//location.reload();
return false;
// 订单提醒
var orderNotificationAudio = document.getElementById('timi_audio');
var timer = setInterval(function () {
console.log('定时器执行');
Fast.api.ajax({
url: "index/timi_msg",
data: {},
}, function (data, ret) {
//location.reload()
$("#product_num").html(data['product_num']);
$("#product_msg").attr("href", data['url']);
$("#service_num").html(data['service_num']);
$("#service_msg").attr("href", data['url']);
// 判断是否有新消息
if (parseInt(data['service_nums']) > 0 || parseInt(data['product_nums']) > 0) {
// 检查浏览器播放权限
if (orderNotificationAudio.paused) {
orderNotificationAudio.play();
}
},function(data, ret){
// location.reload()
return false;
});
}, 10*1000);//10分钟请求1次
console.warn("音频播放失败:", err);
} else {
// 暂停音频播放
orderNotificationAudio.pause();
orderNotificationAudio.currentTime = 0; // 重置到开头
}
return false;
}, function (data, ret) {
console.error("订单提醒请求失败:", ret);
return false;
});
}, 10 * 1000); // 每10秒请求一次
//快捷搜索
... ...
不能预览此文件类型