添加网站文件
This commit is contained in:
137
application/admin/logic/FineLogic.php
Normal file
137
application/admin/logic/FineLogic.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
use app\common\server\UrlServer;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
class FineLogic
|
||||
{
|
||||
public static function type_add($post){
|
||||
$post['crem_time']=time();
|
||||
return Db::name('staff_fine')->data($post)->insert();
|
||||
}
|
||||
|
||||
public static function type($get){
|
||||
|
||||
$count = Db::name('staff_fine')
|
||||
->count();
|
||||
|
||||
$lists = Db::name('staff_fine')
|
||||
->page($get['page'],$get['limit'])
|
||||
->order('id desc')
|
||||
->select();
|
||||
foreach ($lists as &$item){
|
||||
$item['crem_time']=date("Y-m-d H:i:s",$item['crem_time']);
|
||||
}
|
||||
return ['count'=>$count , 'lists'=>$lists];
|
||||
}
|
||||
public static function type_fineinfo($id){
|
||||
return Db::name('staff_fine')->where('id',$id)->find();
|
||||
}
|
||||
|
||||
public static function type_eidt($post){
|
||||
return Db::name('staff_fine')->where('id',$post['id'])->update(['name'=>$post['name'],'amount'=>$post['amount'],'integral'=>$post['integral']]);
|
||||
}
|
||||
|
||||
public static function type_del($id){
|
||||
return Db::name('staff_fine')->where('id',$id)->delete();
|
||||
}
|
||||
|
||||
public static function type_lists(){
|
||||
return Db::name('staff_fine')->select();
|
||||
}
|
||||
|
||||
public static function add($post){
|
||||
$post['create_time']=time();
|
||||
return Db::name('fine')->data($post)->insert();
|
||||
}
|
||||
|
||||
public static function lists($get){
|
||||
$where=[];
|
||||
|
||||
if(isset($get['staff_id']) && $get['staff_id'] != ''){
|
||||
$where[] = ['staff_id','=',$get['staff_id']];
|
||||
}
|
||||
//增加时间
|
||||
if(isset($get['start_time']) && $get['start_time']!=''){
|
||||
$where[] = ['create_time','>=',strtotime($get['start_time'])];
|
||||
}
|
||||
if(isset($get['end_time']) && $get['end_time']!=''){
|
||||
$where[] = ['create_time','<=',strtotime($get['end_time'])];
|
||||
}
|
||||
$count = Db::name('fine')
|
||||
->where($where)
|
||||
->count();
|
||||
|
||||
$lists = Db::name('fine')
|
||||
->where($where)
|
||||
->page($get['page'],$get['limit'])
|
||||
->order('id desc')
|
||||
->select();
|
||||
foreach ($lists as &$item){
|
||||
$item['create_time']=date("Y-m-d H:i:s",$item['create_time']);
|
||||
$staff=Db::name('staff')->where('id',$item['staff_id'])->find();
|
||||
if($staff){
|
||||
$item['staff_name']=$staff['name'];
|
||||
$item['staff_mobile']=$staff['mobile'];
|
||||
}
|
||||
|
||||
$type=Db::name('staff_fine')->where('id',$item['type_id'])->find();
|
||||
if($type){
|
||||
$item['type_name']=$type['name'];
|
||||
}else{
|
||||
$item['type_name']='-';
|
||||
}
|
||||
|
||||
$order=Db::name('order_exe')->where('id',$item['order_id'])->find();
|
||||
if($order){
|
||||
$item['user_name']=$order['name'];
|
||||
$item['user_mobile']=$order['phone'];
|
||||
$goods=db::name('goods')->where('id',$order['goods_id'])->find();
|
||||
if($goods){
|
||||
$item['goods_name']= $goods['name'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
return ['count'=>$count , 'lists'=>$lists];
|
||||
}
|
||||
|
||||
public static function fineinfo($id){
|
||||
return Db::name('fine')->where('id',$id)->find();
|
||||
}
|
||||
|
||||
public static function finedel($id){
|
||||
return Db::name('fine')->where('id',$id)->delete();
|
||||
}
|
||||
|
||||
public static function edit($post){
|
||||
return Db::name('fine')->where('id',$post['id'])->data($post)->update();
|
||||
}
|
||||
//审核员工的分
|
||||
public static function done($post){
|
||||
Db::name('fine')->where('id',$post['id'])->update(['status'=>1]);
|
||||
$staff=Db::name('staff')->where('id',$post['staff_id'])->find();
|
||||
Db::name('staff')->where('id',$post['staff_id'])->update(['number'=>$staff['number']-$post['integral']]);
|
||||
$data=[
|
||||
'staff_id'=>$post['staff_id'],
|
||||
'type' =>0,
|
||||
'ysjf' =>$staff['number'],
|
||||
'bdjf' =>$post['integral'],
|
||||
'type_name'=>'服务违规',
|
||||
'add_time'=>time()
|
||||
];
|
||||
if($staff['number']>10){
|
||||
db::name('staff')->where('id',$post['id'])->update(['state'=>1]);
|
||||
}else{
|
||||
db::name('staff')->where('id',$post['id'])->update(['state'=>0]);
|
||||
}
|
||||
Db::name('staff_points')->data($data)->insert();
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user