作者 jinglong
1 个管道 的构建 通过 耗费 1 秒

修改甲方总公司首页

... ... @@ -367,6 +367,15 @@ class CommonController extends RestBaseController
return $res;
}
//获取甲方公司id
public function getCompanyAid($project_id){
$res = Db::name('project')
->where('id',$project_id)
->field('id,a_cid')
->find();
return $res;
}
//获取项目运行时间
public function getRunTime($time){
$currentTime = time();
... ...
... ... @@ -73,6 +73,8 @@ class IndexController extends RestBaseController
*
* @header name:token require:1 default: desc:header
*
* @param name:project_id type:int require:0 default: other desc:项目id
*
* @return data: @
* @data id:公司id company_name:甲方公司名称 logo:公司logo company_name_head:甲方总公司名称 address:地区 run_time:运行时间 service:服务列表@
* @service id:服务id(1:消防日检,2:月检,3:改造,4:报修,5:培训,6:演习,7:年检,101:消息审批) name:服务名称 icon:图标路径 english_name:英文名称
... ... @@ -82,16 +84,18 @@ class IndexController extends RestBaseController
*/
public function chiefLeaderIndex(){
if($this->request->isGet()){
$where = ['u_ls_id' => $this->userId];
$project_id = $this->request->get('project_id');
$field = 'id,company_name,company_name_head,address,logo,create_time';
$common = new CommonController();
$res = $common->getTotalCompany($where,$field);
//查询甲方公司id
$company = $common->getCompanyAid($project_id);
$res = $common->getTotalCompany(['id'=>$company['a_cid']],$field);
$host = config('site.host');
$city = [];
$i = 0;
foreach($res as &$value){
$i+=0;
//查找企业拥有的服务
$data['c_id'] = $value['id'];
$rule = $common->getRule($data,'',1);
... ... @@ -107,13 +111,8 @@ class IndexController extends RestBaseController
$value['logo'] = $host.'/upload/'.$value['logo'];
//公司运行时间
$value['run_time'] = $common->getRunTime($value['create_time']);
$city[$i]['id'] = $value['id'];
$city[$i]['address'] = $value['address'];
$i++;
}
$arr['data'] = $res;
$arr['address'] = $city;
$arr['tips'] = config('site.tips');
$this->success('成功',$arr);
}else{
... ...