79 lines
2.1 KiB
PHP
79 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\model\informationg\UserInformationg;
|
|
use app\common\logic\BaseLogic;
|
|
|
|
class InformationController extends BaseApiController
|
|
{
|
|
public function list()
|
|
{
|
|
$param = Request()->param();
|
|
[$page, $limit] = $this->getPage();
|
|
if(isset($param['user_id'])&&$param['user_id']>0){
|
|
$data['create_user_id'] = $param['user_id'];
|
|
}else{
|
|
$data['company_id'] = $this->userInfo['company_id'];
|
|
}
|
|
$res = UserInformationg::list($data,$page,$limit);
|
|
if ($res != true) {
|
|
return $this->fail( BaseLogic::getError());
|
|
}
|
|
return $this->success('ok', $res->toArray());
|
|
}
|
|
|
|
/**
|
|
* 添加
|
|
*/
|
|
public function add()
|
|
{
|
|
$param = Request()->param();
|
|
$param['admin_id'] = $this->userId;
|
|
$param['company_id']=$this->userInfo['company_id'];
|
|
$res = UserInformationg::add($param);
|
|
if ($res != true) {
|
|
return $this->fail( BaseLogic::getError());
|
|
}
|
|
return $this->success('成功');
|
|
}
|
|
|
|
/**
|
|
* 详情
|
|
*/
|
|
public function details(){
|
|
$param = Request()->param();
|
|
$res = UserInformationg::details($param['id']);
|
|
if ($res != true) {
|
|
return $this->fail( BaseLogic::getError());
|
|
}
|
|
return $this->success('成功',$res->toArray());
|
|
}
|
|
|
|
/**
|
|
* 商机更新
|
|
*/
|
|
public function opportunity_update(){
|
|
$param = Request()->param();
|
|
foreach ($param['datas'] as $k => $v) {
|
|
$res = UserInformationg::informationg_demand($v,$param['id'],$this->userId);
|
|
}
|
|
if ($res != true) {
|
|
return $this->fail( BaseLogic::getError());
|
|
}
|
|
return $this->success('成功');
|
|
}
|
|
|
|
/**
|
|
* 编辑
|
|
*/
|
|
public function edit(){
|
|
$param = Request()->param();
|
|
$res = UserInformationg::edit($param);
|
|
if ($res != true) {
|
|
return $this->fail( BaseLogic::getError());
|
|
}
|
|
return $this->success('成功');
|
|
}
|
|
}
|