|
...
|
...
|
@@ -4,109 +4,99 @@ |
|
|
|
* @name :GeoLogic.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/2 17:51
|
|
|
|
* @time :2025/10/25 11:08
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Http\Logic\Aside\Geo;
|
|
|
|
|
|
|
|
use App\Enums\Common\Code;
|
|
|
|
use App\Http\Logic\Aside\BaseLogic;
|
|
|
|
use App\Models\Geo\GeoPlatform;
|
|
|
|
use App\Models\Geo\GeoConf;
|
|
|
|
use App\Models\Geo\GeoQuestion;
|
|
|
|
use App\Models\Manage\ManageHr;
|
|
|
|
use App\Models\Project\KeywordPrefix;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :geo设置
|
|
|
|
* @name :GeoLogic
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/10/25 11:08
|
|
|
|
*/
|
|
|
|
class GeoLogic extends BaseLogic
|
|
|
|
{
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
parent::__construct();
|
|
|
|
$this->param = $this->requestAll;
|
|
|
|
$this->model = new GeoQuestion();
|
|
|
|
$this->model = new GeoConf();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :设置geo状态
|
|
|
|
* @name :setGeoStatus
|
|
|
|
* @remark :获取geo设置数据详情
|
|
|
|
* @name :getCongInfo
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/2 17:51
|
|
|
|
* @time :2025/10/25 11:10
|
|
|
|
*/
|
|
|
|
public function setGeoStatus(){
|
|
|
|
public function getCongInfo($project_id)
|
|
|
|
{
|
|
|
|
$projectModel = new Project();
|
|
|
|
$data = $projectModel->edit(['geo_status'=>$this->param['geo_status'],'geo_frequency'=>$this->param['geo_frequency']],['id'=>$this->param['project_id']]);
|
|
|
|
$questionModel = new GeoQuestion();
|
|
|
|
$questionModel->edit(['status'=>$this->param['geo_status']],['project_id'=>$this->param['project_id']]);
|
|
|
|
return $this->success($data);
|
|
|
|
$project_geo_conf = $projectModel->read(['id' => $project_id],['title', 'version', 'geo_status', 'geo_qualify_num']);
|
|
|
|
$geoConfModel = new GeoConf();
|
|
|
|
$geo_conf = $geoConfModel->read(['project_id' => $project_id]);
|
|
|
|
if($geo_conf === false){//数据未初始化
|
|
|
|
$geo_conf = [
|
|
|
|
'project_id' => $project_id, 'manager_id'=>0, 'company'=>$project_geo_conf['title'], 'brand'=>'', 'description'=>''
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取类型
|
|
|
|
* @name :getType
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/3 10:47
|
|
|
|
*/
|
|
|
|
public function getType(){
|
|
|
|
$data['type'] = $this->model->brandType();
|
|
|
|
$data['frequency'] = $this->model->frequency;
|
|
|
|
$geoPlatformModel = new GeoPlatform();
|
|
|
|
$data['platform'] = $geoPlatformModel->getList();
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取问题列表
|
|
|
|
* @name :getGeoQuestionList
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/3 9:12
|
|
|
|
*/
|
|
|
|
public function getGeoQuestionList($map,$page,$row,$order,$field = ['*']){
|
|
|
|
$data = $this->model->lists($map,$page,$row,$order,$field);
|
|
|
|
if(!empty($data) && !empty($data['list'])){
|
|
|
|
foreach ($data['list'] as $key => $item){
|
|
|
|
$item['type_name'] = $this->model->brandType()[$item['type']];
|
|
|
|
$data['list'][$key] = $item;
|
|
|
|
//负责人集合
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->success($data);
|
|
|
|
$result = [
|
|
|
|
'project_geo_conf' => $project_geo_conf,
|
|
|
|
'geo_conf' => $geo_conf,
|
|
|
|
'geo_manage_list' => $geo_manage_list,
|
|
|
|
'geo_keyword' => [
|
|
|
|
'prefix' => KeywordPrefix::getKeyword($project_id, KeywordPrefix::TYPE_GEO_PREFIX),
|
|
|
|
'suffix' => KeywordPrefix::getKeyword($project_id, KeywordPrefix::TYPE_GEO_SUFFIX),
|
|
|
|
],
|
|
|
|
];
|
|
|
|
return $this->success($result);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存数据
|
|
|
|
* @name :saveGeoQuestion
|
|
|
|
* @remark :保存数据详情
|
|
|
|
* @name :saveCongInfo
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/3 9:47
|
|
|
|
* @param : question->提交的问题
|
|
|
|
* @param : url->提交的网址
|
|
|
|
* @param : keywords->提交的关键字
|
|
|
|
* @param : project_id->项目id
|
|
|
|
* @time :2025/10/25 11:14
|
|
|
|
* @param->gl_geo_conf : project_id->项目id;manager_id->管理员id;company->公司名称;brand->品牌名;description->描述(必传)
|
|
|
|
* @param :prefix->前缀;suffix->后缀(非必传)
|
|
|
|
* @param->gl_project : geo_status->开启/关闭状态 geo_qualify_num->达标数量
|
|
|
|
*/
|
|
|
|
public function saveGeoQuestion(){
|
|
|
|
//处理数据
|
|
|
|
$this->param['question'] = json_encode($this->param['question'] ?? [],true);
|
|
|
|
$this->param['url'] = json_encode($this->param['url'] ?? [],true);
|
|
|
|
$this->param['keywords'] = json_encode($this->param['keywords'] ?? [],true);
|
|
|
|
//执行时间设置为今天
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
$id = $this->param['id'];
|
|
|
|
$this->model->edit($this->param,['id'=>$id]);
|
|
|
|
public function saveConfig($param)
|
|
|
|
{
|
|
|
|
$projectModel = new Project();
|
|
|
|
$projectModel->edit(['geo_status'=>$param['geo_status'],'geo_qualify_num'=>$param['geo_qualify_num']],['id'=>$param['project_id']]);
|
|
|
|
try {
|
|
|
|
unset($param['geo_status'],$param['geo_qualify_num']);//无需保存
|
|
|
|
$info = $this->model->read(['project_id' => $param['project_id']]);
|
|
|
|
if($info === false){
|
|
|
|
$id = $this->model->addReturnId($param);
|
|
|
|
}else{
|
|
|
|
$this->param['next_time'] = date('Y-m-d');
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
$id = $param['id'];
|
|
|
|
$this->model->edit($param,['id'=>$info['id']]);
|
|
|
|
}
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
$this->fail('配置保存失败, error:' . $e->getMessage());
|
|
|
|
}
|
|
|
|
return $this->success(['id'=>$id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :删除数据
|
|
|
|
* @name :delGeoQuestion
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/7/3 10:13
|
|
|
|
*/
|
|
|
|
public function delGeoQuestion(){
|
|
|
|
$data = $this->model->del(['id'=>['in',$this->param['ids']]]);
|
|
|
|
return $this->success($data);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|