|
...
|
...
|
@@ -9,6 +9,7 @@ namespace App\Http\Controllers\Aside\Geo; |
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Controllers\Aside\BaseController;
|
|
|
|
use App\Http\Logic\Aside\Geo\GeoLogic;
|
|
|
|
use App\Models\Geo\GeoConf;
|
|
|
|
use App\Models\Geo\GeoConfirm;
|
|
|
|
use App\Models\Manage\ManageHr;
|
|
...
|
...
|
@@ -23,6 +24,11 @@ use Illuminate\Http\Request; |
|
|
|
*/
|
|
|
|
class GeoController extends BaseController
|
|
|
|
{
|
|
|
|
public function __construct(){
|
|
|
|
parent::__construct();
|
|
|
|
$this->logic = new GeoLogic();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取GEO相关配置
|
|
|
|
* @param Request $request
|
|
...
|
...
|
@@ -34,36 +40,8 @@ class GeoController extends BaseController |
|
|
|
], [
|
|
|
|
'project_id.required' => '项目ID不能为空',
|
|
|
|
]);
|
|
|
|
$projectModel = new Project();
|
|
|
|
$project_geo_conf = $projectModel->read(['id' => $this->param['project_id']],['title', 'version', 'geo_status', 'geo_qualify_num']);
|
|
|
|
$geoConfModel = new GeoConf();
|
|
|
|
$geo_conf = $geoConfModel->read(['project_id' => $this->param['project_id']]);
|
|
|
|
if($geo_conf === false){//数据未初始化
|
|
|
|
$geo_conf = [
|
|
|
|
'project_id' => $this->param['project_id'],
|
|
|
|
'manager_id'=>0,
|
|
|
|
'company'=>$project_geo_conf['title'],
|
|
|
|
'brand'=>'',
|
|
|
|
'description'=>''
|
|
|
|
];
|
|
|
|
}
|
|
|
|
//负责人集合
|
|
|
|
$geo_manage_list = $geoConfModel->geoManage();
|
|
|
|
// geo配置管理员,已经移除管理员列表,补充管理员信息
|
|
|
|
if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
|
|
|
|
$manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
|
|
|
|
$geo_manage_list = array_merge($geo_manage_list, $manage);
|
|
|
|
}
|
|
|
|
$result = [
|
|
|
|
'project_geo_conf' => $project_geo_conf,
|
|
|
|
'geo_conf' => $geo_conf,
|
|
|
|
'geo_manage_list' => $geo_manage_list,
|
|
|
|
'geo_keyword' => [
|
|
|
|
'prefix' => KeywordPrefix::getKeyword($this->param['project_id'], KeywordPrefix::TYPE_GEO_PREFIX),
|
|
|
|
'suffix' => KeywordPrefix::getKeyword($this->param['project_id'], KeywordPrefix::TYPE_GEO_SUFFIX),
|
|
|
|
],
|
|
|
|
];
|
|
|
|
$this->response('success', Code::SUCCESS, $result);
|
|
|
|
$data = $this->logic->getCongInfo($this->param['project_id']);
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -87,14 +65,8 @@ class GeoController extends BaseController |
|
|
|
'brand.max' => '品牌名不能超过200个字符',
|
|
|
|
'description.max' => '描述不能超过500个字符',
|
|
|
|
]);
|
|
|
|
try {
|
|
|
|
$
|
|
|
|
$data = GeoConf::saveConf($this->param['project_id'], $this->param['manager_id'], $this->param['company'], $this->param['brand'], $this->param['description'], $this->param['prefix'], $this->param['suffix']);
|
|
|
|
# FIXME 保存GEO状态 达标数量
|
|
|
|
$data = $this->logic->saveConfig($this->param);
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$this->fail('配置保存失败, error:' . $e->getMessage());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
...
|
...
|
|