Commit 617e5102 authored by hujun's avatar hujun

财务日报显示

parent efea8cba
......@@ -2,6 +2,7 @@
namespace app\api_broker\service;
use app\model\AAgents;
use app\model\AuthGroup;
use app\model\AuthRule;
/**
* Created by PhpStorm.
......@@ -62,8 +63,18 @@ class MyCenterService{
if (!empty($result['auth_group_id'])) {
$m_auth_group = new AuthGroup();
$auth_group_name = $m_auth_group->getValue('title', ['id'=>$result['auth_group_id']]);
$result['auth_group_name'] = empty($auth_group_name) ? '':$auth_group_name;
$auth_group = $m_auth_group->getAuthGroup($result['auth_group_id'], 'title,rules');
$result['auth_group_name'] = empty($auth_group['title']) ? '':$auth_group['title'];
$m_rule = new AuthRule();
$id = $m_rule->getAuthRuleByName('index/addDaily', 'id');
$rules_arr = explode(',', $auth_group['rules']);
$result['show_daily'] = 0;
if (in_array($id, $rules_arr)) {
$result['show_daily'] = 1; //财务日报显示
}
}
return $result;
}
......
......@@ -79,4 +79,20 @@ class AuthGroup extends BaseModel
->where('status', $status)
->value($fields);
}
/**
* @param $id
* @param $fields
* @param int $status
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAuthGroup($id, $fields, $status = 0)
{
return $this->field($fields)->where('id',$id)
->where('status', $status)
->find();
}
}
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