206 lines
9.9 KiB
PHP
206 lines
9.9 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeshop100%开源免费商用商城系统
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||
// | github下载:https://github.com/likeshop-github
|
||
// | 访问官网:https://www.likeshop.cn
|
||
// | 访问社区:https://home.likeshop.cn
|
||
// | 访问手册:http://doc.likeshop.cn
|
||
// | 微信公众号:likeshop技术社区
|
||
// | likeshop团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeshopTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
|
||
namespace app\api\logic;
|
||
|
||
use app\common\model\Ad;
|
||
use app\common\server\UrlServer;
|
||
use think\Db;
|
||
|
||
class LeadershipLogic
|
||
{
|
||
public static function lists($pid, $client)
|
||
{
|
||
$ad_list = Db::name('ad a')
|
||
->join('ad_position ap', 'a.pid = ap.id')
|
||
->where(['pid' => $pid, 'ap.client' => $client, 'a.status' => 1, 'a.del' => 0, 'ap.status' => 1, 'ap.del' => 0])
|
||
->field('a.*')
|
||
->select();
|
||
|
||
$list = [];
|
||
foreach ($ad_list as $key => $ad) {
|
||
$url = $ad['link'];
|
||
$is_tab = 0;
|
||
$params = [];
|
||
switch ($ad['link_type']) {
|
||
case 1:
|
||
|
||
$page = Ad::getLinkPage($ad['client'], $ad['link']);
|
||
$url = $page['path'];
|
||
$is_tab = $page['is_tab'] ?? 0;
|
||
break;
|
||
case 2:
|
||
$goods_path = Ad::getGoodsPath($ad['client']);
|
||
$url = $goods_path;
|
||
$params = [
|
||
'id' => $ad['link'],
|
||
];
|
||
break;
|
||
}
|
||
$list[] = [
|
||
'image' => UrlServer::getFileUrl($ad['image']),
|
||
'link' => $url,
|
||
'link_type' => $ad['link_type'],
|
||
'params' => $params,
|
||
'is_tab' => $is_tab,
|
||
];
|
||
}
|
||
return $list;
|
||
}
|
||
|
||
//获取物料申请列表内容
|
||
public static function material_list($get){
|
||
|
||
$staff=Db::name('staff')->where('id',$get['staff_id'])->field('grouping_id')->find(); //获取员工基本信息
|
||
if($staff){
|
||
$grouping=Db::name('staff_grouping')->where('id',$staff['grouping_id'])->field('id')->find(); //获取到分组的ID
|
||
$stafflist=Db::name('staff')->where('grouping_id',$grouping['id'])->field('id')->select(); //获取部门下面的员工id
|
||
$flattenedArray = array_column($stafflist, 'id'); //二维数组转换一位数组
|
||
|
||
$count = Db::name('erp_staff')
|
||
->where('staff_id','in',$flattenedArray)
|
||
->where('status',$get['status'])
|
||
|
||
->count();
|
||
$lists = Db::name('erp_staff')
|
||
->where('staff_id','in',$flattenedArray)
|
||
->where('status',$get['status'])
|
||
->page($get['page'],$get['pageSize'])
|
||
->select();
|
||
foreach ($lists as &$item) {
|
||
$staffinfo=Db::name('staff')->where('id',$item['staff_id'])->field('name,mobile')->find();
|
||
$item['staff_name']=$staffinfo['name'];
|
||
$item['mobile']=$staffinfo['mobile'];
|
||
$item['create_time']=date("Y-m-d H:i:s",$item['create_time']);
|
||
|
||
$gooods=Db::name('epr')->where('id',$item['goods_id'])->find();
|
||
$item['goods_name']= $gooods['name'];
|
||
$item['images']=UrlServer::getFileUrl($gooods['abs_avatar']);
|
||
|
||
}
|
||
return ['count'=>$count , 'lists'=>$lists];
|
||
|
||
}
|
||
|
||
}
|
||
//获取报销的金额的数据列表
|
||
public static function finance_list($get){
|
||
$staff=Db::name('staff')->where('id',$get['staff_id'])->field('grouping_id')->find(); //获取员工基本信息
|
||
if($staff){
|
||
$grouping=Db::name('staff_grouping')->where('id',$staff['grouping_id'])->field('id')->find(); //获取到分组的ID
|
||
$stafflist=Db::name('staff')->where('grouping_id',$grouping['id'])->field('id')->select(); //获取部门下面的员工id
|
||
$flattenedArray = array_column($stafflist, 'id'); //二维数组转换一位数组
|
||
$lists = Db::name('finance')
|
||
->where('staff_id','in',$flattenedArray)
|
||
->where('status',$get['status'])
|
||
->page($get['page'],$get['pageSize'])
|
||
->select();
|
||
foreach ($lists as &$item) {
|
||
$item['create_time']=date("Y-m-d H:i:s",$item['create_time']);
|
||
|
||
$order=Db::name('order_exe')->where('id',$item['order_id'])->find();
|
||
$staffinfo=Db::name('staff')->where('id', $order['staff_id'])->field('name,mobile')->find();
|
||
if($order){
|
||
$item['name']= $order['name'];
|
||
$item['phone']= $order['phone'];
|
||
$item['order_sn']= $order['order_sn'];
|
||
}
|
||
|
||
|
||
if($order['addtime']=1){
|
||
$item['sw_time']="8:00-12:00";
|
||
}else{
|
||
$item['sw_time']="14:00-16:00";
|
||
}
|
||
$item['staff_name']=$staffinfo['name'];
|
||
$item['mobile']=$staffinfo['mobile'];
|
||
}
|
||
|
||
|
||
return $lists;
|
||
}
|
||
}
|
||
|
||
//获取报销的加时间订单列表
|
||
public static function addorder_list($get){
|
||
$staff=Db::name('staff')->where('id',$get['staff_id'])->field('grouping_id')->find(); //获取员工基本信息
|
||
if($staff){
|
||
$grouping=Db::name('staff_grouping')->where('id',$staff['grouping_id'])->field('id')->find(); //获取到分组的ID
|
||
$stafflist=Db::name('staff')->where('grouping_id',$grouping['id'])->field('id')->select(); //获取部门下面的员工id
|
||
$flattenedArray = array_column($stafflist, 'id'); //二维数组转换一位数组
|
||
$lists = Db::name('order_timeadd')
|
||
->where('staff_id','in',$flattenedArray)
|
||
->where('status',$get['status'])
|
||
->page($get['page'],$get['pageSize'])
|
||
->select();
|
||
foreach ($lists as &$item) {
|
||
$item['create_time']=date("Y-m-d H:i:s",$item['create_time']);
|
||
$order=Db::name('order_exe')->where('id',$item['orderid'])->find();
|
||
if($order){
|
||
$item['name']= $order['name'];
|
||
$item['phone']= $order['phone'];
|
||
$item['order_sn']= $order['order_sn'];
|
||
if($order['addtime']=1){
|
||
$item['sw_time']="8:00-12:00";
|
||
}else{
|
||
$item['sw_time']="14:00-16:00";
|
||
}
|
||
$staffinfo=Db::name('staff')->where('id',$order['staff_id'])->field('name,mobile')->find(); //员工传递过来的ID
|
||
if($staffinfo){
|
||
$item['staff_name']=$staffinfo['name'];
|
||
$item['mobile']=$staffinfo['mobile'];
|
||
}
|
||
}
|
||
}
|
||
|
||
return $lists;
|
||
}
|
||
|
||
}
|
||
|
||
public static function staff_list($get){
|
||
$staff=Db::name('staff')->where('id',$get['staff_id'])->field('grouping_id')->find(); //获取员工基本信息
|
||
if($staff){
|
||
$grouping=Db::name('staff_grouping')->where('id',$staff['grouping_id'])->field('id')->find(); //获取到分组的ID
|
||
|
||
$lists = Db::name('staff')
|
||
->where('grouping_id',$grouping['id'])
|
||
->where('onwork',1)
|
||
// ->page($get['page'],$get['pageSize'])
|
||
->select();
|
||
|
||
foreach ($lists as &$item) {
|
||
$item['year_number']=Db::name('order_exe')->where('staff_status',3)->whereTime('autotime','year')->where('staff_id',$item['id'])->count(); //今年订单
|
||
$item['month_number']=Db::name('order_exe')->where('staff_status',3)->whereTime('autotime','month')->where('staff_id',$item['id'])->count(); //当月订单
|
||
$item['addtime_number']=Db::name('order_exe')->where('staff_status',3)->whereTime('autotime','month')->where('staff_id',$item['id'])->SUM('add'); //当月报销
|
||
$item['account_number']=Db::name('order_exe')->where('staff_status',3)->whereTime('autotime','month')->where('staff_id',$item['id'])->SUM('account'); //当月加时
|
||
$item['leave_number']=Db::name('leave')->where('status',1)->whereTime('time','month')->where('user_id',$item['id'])->count()/2; //当月加时
|
||
$item['erp_number']=Db::name('erp_staff')->where('status',2)->whereTime('create_time','month')->where('staff_id',$item['id'])->SUM('number'); //当月加时
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
return $lists;
|
||
}
|
||
|
||
}
|
||
} |