20201112
This commit is contained in:
@@ -90,15 +90,24 @@ class Staff extends Controller{
|
||||
*/
|
||||
public function addStaff(){
|
||||
$data = $this->request->post();
|
||||
// $data['staff_level_id'] = '3';
|
||||
// $data['addition'] = '1';
|
||||
// $data['addition_reason'] = '';
|
||||
// $data['subtraction'] = '';
|
||||
// $data['subtraction_reason'] = '';
|
||||
// $data['name'] = '1';
|
||||
// $data['phone'] = '1';
|
||||
// $data['email'] = '1';
|
||||
// $data['password'] = '1';
|
||||
$insert['staff_level_id'] = $data['staff_level_id'];
|
||||
$insert['name'] = $data['name'];
|
||||
$insert['phone'] = $data['phone'];
|
||||
$insert['email'] = $data['email'];
|
||||
$insert['password'] = md5($data['password']);
|
||||
$insert['addition'] = $data['addition'];
|
||||
$insert['addition_reason'] = $data['addition_reason'];
|
||||
$insert['subtraction'] = $data['subtraction'];
|
||||
$insert['subtraction_reason'] = $data['subtraction_reason'];
|
||||
$insert['add_price'] = $data['add_price'];
|
||||
$insert['add_reason'] = $data['add_reason'];
|
||||
$insert['sub_price'] = $data['sub_price'];
|
||||
$insert['sub_reason'] = $data['sub_reason'];
|
||||
$this->staff_obj->insert($insert);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
@@ -122,10 +131,10 @@ class Staff extends Controller{
|
||||
$update['phone'] = $data['phone'];
|
||||
$update['email'] = $data['email'];
|
||||
$update['password'] = md5($data['password']);
|
||||
$update['addition'] = $data['addition'];
|
||||
$update['addition_reason'] = $data['addition_reason'];
|
||||
$update['subtraction'] = $data['subtraction'];
|
||||
$update['subtraction_reason'] = $data['subtraction_reason'];
|
||||
$update['add_price'] = $data['add_price'];
|
||||
$update['add_reason'] = $data['add_reason'];
|
||||
$update['sub_price'] = $data['sub_price'];
|
||||
$update['sub_reason'] = $data['sub_reason'];
|
||||
$this->staff_obj->where('staff_id',$data['staff_id'])->update($update);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
@@ -136,31 +145,81 @@ class Staff extends Controller{
|
||||
public function getStaffs(){
|
||||
$data = $this->request->post();
|
||||
$limit_start = ($data['pageIndex'] - 1) * $data['pageSize'];
|
||||
$list = $this->staff_obj->where('state',0)->limit($limit_start,$data['pageSize'])->select();
|
||||
$list = $this->staff_obj->field('t_staff.*,t_staff_level.*')
|
||||
->join('t_staff_level','t_staff_level.staff_level_id = t_staff.staff_level_id','left')
|
||||
->where('t_staff.state',0)
|
||||
->limit($limit_start,$data['pageSize'])
|
||||
->select();
|
||||
$count = $this->staff_obj->where('state',0)->count();
|
||||
$re['staffs'] = $list;
|
||||
$re['count'] = $count;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部期刊
|
||||
*/
|
||||
public function getJournals(){
|
||||
$list = $this->journal_obj->where('state',0)->select();
|
||||
|
||||
$re['journals'] = $list;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改期刊提成对接人
|
||||
*/
|
||||
public function editJournalStaff(){
|
||||
$data = $this->request->post();
|
||||
$this->journal_obj->where('journal_id',$data['journal_id'])->update(['staff_id'=>$data['staff_id']]);
|
||||
return jsonSuccess([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工实时工资
|
||||
*/
|
||||
public function getStaffRealtime(){
|
||||
$data = $this->request->post();
|
||||
$staff_info = $this->staff_obj->where('name',$data['name'])->find();
|
||||
$price = $this->getBasePrice($data['name']);
|
||||
|
||||
//获取实时期刊提成情况
|
||||
$journals = $this->journal_obj->where('staff_id',$staff_info['staff_id'])->column('journal_id');
|
||||
$where['journal'] = array('in',$journals);
|
||||
if(date('d')>25){
|
||||
$ch_time = strtotime(date('Y-m').'-26 00:00:00');
|
||||
$where['ctime'] = array('>',$ch_time);
|
||||
}else{
|
||||
$c_time = strtotime("-1 month", strtotime(date('Y-m').'-26 00:00:00'));
|
||||
$c_time1 = strtotime(date('Y-m'.'-25 23:59:59'));
|
||||
$where['ctime'] = array(['>',$c_time],['<=',$c_time1]);
|
||||
}
|
||||
$where['state'] = 0;
|
||||
$list = $this->article_obj->where($where)->select();
|
||||
|
||||
|
||||
echo '<pre>';
|
||||
var_dump($list);
|
||||
echo '</pre>';
|
||||
die;
|
||||
|
||||
|
||||
$re['price'] = $price;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 核算月薪(系统自动调用)
|
||||
* 核算月薪,记录进log(系统自动调用)
|
||||
*/
|
||||
public function pushStaffLog(){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工工资信息(管理员专用)
|
||||
* 获取员工工资信息列表(管理员专用)
|
||||
*/
|
||||
public function getAllStaff($month = '0'){
|
||||
if($month=='0'){//获取当月实时工资
|
||||
@@ -171,10 +230,18 @@ class Staff extends Controller{
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户某月份工资
|
||||
* 获取用户某月份工资详情
|
||||
*/
|
||||
public function getStaffLog($month){
|
||||
|
||||
public function getStaffLog(){
|
||||
$data = $this->request->post();
|
||||
$staff_info = $this->staff_obj->where('name',$data['name'])->find();
|
||||
$staff_log_obj = $this->staff_log_obj
|
||||
->where('staff_id',$staff_info['staff_id'])
|
||||
->where('date',$data['date'])
|
||||
->where('state',0)
|
||||
->find();
|
||||
$re['staffLog'] = $staff_log_obj;
|
||||
return jsonSuccess($re);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,11 +254,24 @@ class Staff extends Controller{
|
||||
$where['state'] = 0;
|
||||
$res = $this->staff_obj->where($where)->find();
|
||||
if($res){
|
||||
return jsonSuccess([]);
|
||||
return jsonSuccess(['info'=>$res]);
|
||||
}else{
|
||||
return jsonError('check error');
|
||||
}
|
||||
}
|
||||
|
||||
private function getBasePrice($name){
|
||||
$staff_info = $this->staff_obj->where('name',$name)->where('state',0)->find();
|
||||
$level_info = $this->staff_level_obj->where('staff_level_id',$staff_info['staff_level_id'])->where('state',0)->find();
|
||||
//获取基本薪资
|
||||
$price1 = $level_info['wages']+$staff_info['add_price']-$staff_info['sub_price'];
|
||||
|
||||
//获取稿件提成信息
|
||||
$price2 = 0;
|
||||
|
||||
//返回基础工资
|
||||
return $price1 +$price2;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user