Commit d4ff54a7 authored by hujun's avatar hujun

auth

parent 635af6d2
......@@ -37,7 +37,7 @@ class ApplyForCost extends Basic
$redis = new RedisCacheService();
$agent_data = $redis->getRedisCache(2, $this->agentId);
$check_rule = new VipService();
$check_url = '';
switch ($this->params['type']) {
case 1 :
$check_url = 'index/checkCostTwo/1';
......@@ -67,28 +67,33 @@ class ApplyForCost extends Basic
}
break;
case 3 :
$get_check_user = 'index/getCostListThree/2';
$is_check = $this->checkAuth($get_check_user);
if (!$is_check) {
$where['a.store_id'] = $agent_data['store_id'];
}
$check_url = 'index/checkCostFour/3';
$where['a.status'] = 2;break; //财务一审
case 4 :
$get_check_user = 'index/getCostListFour/3';
$is_check = $this->checkAuth($get_check_user);
if (!$is_check) {
$where['a.store_id'] = $agent_data['store_id'];
}
$check_url = 'index/checkCostFive/4';
$where['a.status'] = 3;break; //财务二审
case 5 :
$get_check_user = 'index/getCostListFive/4';
$is_check = $this->checkAuth($get_check_user);
if (!$is_check) {
$where['a.store_id'] = $agent_data['store_id'];
}
$where['a.status'] = 4;break; //财务三审
default :
return $this->response(101, '请求错误');
}
if (isset($check_url)) {
$is_ok = $check_rule->checkRule($this->agentId, $check_url);
if ($is_ok) {
$is_check = 0;
} else {
$is_check = 1;
}
} else {
$is_check = 0;
}
$is_check = $this->checkAuth($check_url); //审核通过权限
$field = 'a.id,a.count_time,a.source,a.type,a.create_time,a.agent_id,a.total_fee,a.fee_item,a.purpose,';
$field .= 'b.name as agent_name,a.card_name,a.bank,a.card_no,a.source,a.store_id,a.status';
$fee_model = new FApplyForFee();
......@@ -179,4 +184,24 @@ class ApplyForCost extends Basic
}
return $this->response($code, $result['msg']);
}
/**
* @param $check_url
* @return int
*/
private function checkAuth($check_url)
{
$check_rule = new VipService();
if (empty($check_url)) {
$is_check = 0;
} else {
$is_ok = $check_rule->checkRule($this->agentId, $check_url);
if ($is_ok) {
$is_check = 0;
} else {
$is_check = 1;
}
}
return $is_check;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment