This commit is contained in:
wangjinlei
2021-12-21 16:54:13 +08:00
parent b4f5cd59bb
commit e00dd3913b
8 changed files with 785 additions and 99 deletions

View File

@@ -115,7 +115,7 @@ class Staff extends Controller {
*/
public function delStaff() {
$data = $this->request->post();
$this->staff_obj->where('staff_id', $data['staff_id'])->update(['state' => 1]);
$this->staff_obj->where('staff_id', $data['staff_id'])->delete();
return jsonSuccess([]);
}
@@ -233,6 +233,38 @@ class Staff extends Controller {
return jsonSuccess($res);
}
}
public function ggg(){
$staff_list = $this->staff_obj->where('staff_id',27)->select();
$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]);
foreach ($staff_list as $value) {
$base_price = $this->getBasePrice($value['name']);
$journals = $this->journal_obj->where('staff_id', $value['staff_id'])->select();
$journal_price = 0;
$cite_price = 0;
if($value['type']==0){
foreach ($journals as $v) {
$c_price = 0;
$where['accept_sn'] = ['like',$v['abbr'].'%'];
$cache_articles = $this->article_obj->where($where)->select();
echo '<pre>';
var_dump($cache_articles);
echo '</pre>';
die;
}
}
}
}
/**
* 核算月薪,记录进log(系统自动调用)
@@ -251,7 +283,6 @@ class Staff extends Controller {
if($value['type']==0){
foreach ($journals as $v) {
$c_price = 0;
// $where['journal_id'] = $v['journal_id'];
$where['accept_sn'] = ['like',$v['abbr'].'%'];
$cache_articles = $this->article_obj->where($where)->select();
$c_gn = 0;
@@ -456,6 +487,76 @@ class Staff extends Controller {
$re['sub_price'] = 0;
return $re;
}
public function getgrtc(){
$staff_info = $this->staff_obj->where('name', $name)->where('state',0)->find();
$baseprice = $this->getBasePrice($name);
//获取实时期刊提成情况
$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]);
$journals = $this->journal_obj->where('staff_id', $staff_info['staff_id'])->select();
$journal_price = 0;
$cite_price = 0;
if($staff_info['type']==0){
foreach ($journals as $v) {
$c_price = 0;
$where['accept_sn'] = ['like',$v['abbr'].'%'];
$cache_articles = $this->article_obj->where($where)->select();
echo '<pre>';
var_dump($cache_articles);
echo '</pre>';
$c_gn = 0;
$c_gw = 0;
foreach ($cache_articles as $vv) {
$c_country = $this->article_author_obj->where('article_id', $vv['article_id'])->where('state', 0)->column('country');
$c_c = 'gn';
foreach ($c_country as $vvv) {
if ($vvv != 'China' && $vvv != '') {
$c_c = 'gw';
}
}
if ($c_c == 'gn') {
$c_gn++;
} else {
$c_gw++;
}
}
if ($c_gn - $v['jour_num'] >= 0) {
$c_price = ($c_gn - $v['jour_num']) * 100 + $c_gw * 200;
} else {
if (($c_gw - ($v['jour_num'] - $c_gn)) >= 0) {
$c_price = ($c_gn + $c_gw - $v['jour_num']) * 200;
} else {
$c_price = 0 - ($v['jour_num'] - $c_gn - $c_gw) * 50;
}
}
$journal_price += $c_price;
//获取cite提成
$jcites = json_decode(myPost(self::JURL,['issn'=>$v['issn']]));
$jcs = $jcites->data->cites;
$cite_price += count($jcs)*500;
}
echo '------------------------------------------------';
}
$re['staff_log_id'] = 0;
$re['baseprice'] = $baseprice;
$re['journalprice'] = $journal_price;
$re['citeprice'] = $cite_price;
$re['add_price'] = 0;
$re['sub_price'] = 0;
echo '<pre>';
var_dump($re);
echo '</pre>';
die;
}
private function getBasePrice($name) {
$staff_info = $this->staff_obj->where('name', $name)->where('state', 0)->find();