作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -11,6 +11,7 @@ namespace App\Console\Commands\Domain;
use Illuminate\Console\Command;
use App\Models\Domain\DomainInfo as DomainInfoModel;
use Illuminate\Support\Facades\Log;
class DomainInfo extends Command
{
... ... @@ -184,8 +185,8 @@ class DomainInfo extends Command
public function updateDomain($domain){
$url = 'http://openai.waimaoq.com/v1/whois_api?domain='.$domain;
$response = http_get($url);
$start = '';
$end = '';
$start = date('Y-m-d H:i:s');
$end = date('Y-m-d H:i:s');
if($response['code'] == 200){
$start = $response['text']['creation_date'];
$end = $response['text']['expiration_date'];
... ...
... ... @@ -50,4 +50,21 @@ class KeywordPrefixController extends BaseController
$keywordPrefixLogic->prefixSave();
$this->response('success');
}
/**
* @remark :删除自添加关键字
* @name :del
* @author :lyh
* @method :post
* @time :2023/12/16 13:45
*/
public function del(KeywordPrefixLogic $keywordPrefixLogic){
$this->request->validate([
'id'=>'required|array',
],[
'id.required' => 'id不能为空',
]);
$keywordPrefixLogic->prefixDel();
$this->response('success');
}
}
... ...
... ... @@ -9,6 +9,7 @@
namespace App\Http\Logic\Aside\Project;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\KeywordPrefix;
... ... @@ -40,4 +41,28 @@ class KeywordPrefixLogic extends BaseLogic
}
return $this->success();
}
/**
* @remark :删除关键字
* @name :prefixDel
* @author :lyh
* @method :post
* @time :2023/12/16 13:48
*/
public function prefixDel(){
$ids = $this->param['id'];
try {
foreach ($ids as $id){
$info = $this->model->read(['id'=>$id]);
if($info !== false){
if($info['project_id'] != 0){
$this->model->del(['id'=>$id]);
}
}
}
}catch (\Exception $e){
$this->fail('删除失败,请联系管理员');
}
return $this->success();
}
}
... ...
... ... @@ -13,6 +13,7 @@ use App\Models\User\ProjectMenu;
use App\Models\User\ProjectRole;
use App\Services\SyncService;
use App\Utils\HttpUtils;
use App\Utils\LogUtils;
use GuzzleHttp\Exception\GuzzleException;
use Illuminate\Support\Arr as SupArr;
use App\Helper\Arr;
... ... @@ -35,6 +36,7 @@ use App\Services\ProjectServer;
use Hashids\Hashids;
use App\Models\User\User as UserModel;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Str;
... ... @@ -704,6 +706,30 @@ class ProjectLogic extends BaseLogic
* @time :2023/11/17 15:26
*/
public function saveOtherProject(){
//获取当前数据详情
$projectInfo = $this->getProjectInfo($this->param['id']);
//aicc
if(($projectInfo['aicc'] == Project::TYPE_ZERO) && ($this->param['aicc'] == Project::TYPE_ONE)){
$data = [
'company_name'=>$projectInfo['company'],
'principal_mobile'=>$projectInfo['mobile'],
'remark'=>'',
'exclusive_aicc_day'=>$projectInfo['exclusive_aicc_day'] ?: 1,
'from_order_id'=>$projectInfo['from_order_id']
];
$this->toAicc($data);
}
//黑格
if(($projectInfo['hagro'] == Project::TYPE_ZERO) && ($this->param['hagro'] == Project::TYPE_ONE)){
$data = [
'company_name'=>$projectInfo['company'],
'principal_mobile'=>$projectInfo['mobile'],
'exclusive_hagro_day'=>$projectInfo['exclusive_hagro_day'] ?: 1,
'from_order_id'=>$projectInfo['from_order_id'],
'company_id'=>$projectInfo['channel']['channel_id']
];
$this->toHagro($data);
}
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
if($rs === false){
$this->fail('保存失败,请联系管理员');
... ... @@ -723,4 +749,62 @@ class ProjectLogic extends BaseLogic
return $this->success($info);
}
/**
* 同步到AICC
* @param $data
* @author zbj
* @date 2023/9/1
*/
protected function toAicc($data){
$url = 'https://biz.ai.cc/api/sync_company_for_order';
$param = [
'company_name' => $data['company_name'],
'company_address' => '',
'company_tel' => $data['principal_mobile'],
'company_email' => '',
'remark' => $data['remark'],
'level_id' => 6,
'level_day' => $data['exclusive_aicc_day'] ?: 1,
'from_order_id' => $data['from_order_id'],
];
//sign
ksort($param);
$tem = [];
foreach ($param as $key => $val) {
$tem[] = $key . '=' . urlencode($val);
}
$string = implode('&', $tem);
$key = md5('quanqiusou.com');
$param['sign'] = md5($string . $key);
$res = Http::withoutVerifying()->post($url, $param)->json();
if(empty($res['status']) || $res['status'] != 200){
LogUtils::error('ProjectToAicc error', $res);
}
return true;
}
/**
* 同步到Hagro
* @param $data
* @author zbj
* @date 2023/9/1
*/
protected function toHagro($data){
$url = 'https://admin.hagro.cn/globalso/create_project';
$param = [
'company' => $data['company_name'],
'phone' => $data['principal_mobile'],
'planday' => $data['exclusive_hagro_day'] ?: 1,
'from_order_id' => $data['from_order_id'],
'agent_phone' => Channel::where('source_id', $data['company_id'])->value('contact_mobile') ?: '',
];
$common = new Common();
$token = $common->encrypt($param);
$res = Http::withoutVerifying()->get($url, ['token' => $token])->json();
if(empty($res['code']) || $res['code'] != 200){
$this->fail('ProjectToHagro error');
}
return true;
}
}
... ...
... ... @@ -215,7 +215,7 @@ class BTemplateLogic extends BaseLogic
public function getCommonMain($source,$source_id,$is_custom){
$data = [];
if($is_custom == BTemplate::SOURCE_CUSTOM){
if($source_id != 0){$type = BTemplate::TYPE_SIX;}else{$type = BTemplate::TYPE_SEVEN;}
if($source_id != 0){$type = BTemplate::TYPE_CUSTOM_DETAIL;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
}else{
if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}
... ... @@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic
public function templateSave(){
//演示项目不允许修改
$this->showProjectNoEdit($this->param['source']);
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$this->param = $this->handleDefaultString($this->param);//设置默认字符
$templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],
$this->param['source_id'],$this->param['is_custom']);
... ... @@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic
//更新头部信息
$this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
$this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('系统错误,请联系管理员');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']);
return $this->success();
... ... @@ -541,8 +541,8 @@ class BTemplateLogic extends BaseLogic
public function homeOrProduct($source,$source_id = 0,$is_custom = 0){
if($is_custom == 0){
if($source == BTemplate::SOURCE_HOME){
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
$type = RouteMap::SOURCE_INDEX;
$route = RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
$type = RouteMap::SOURCE_PAGE;
}elseif($source == BTemplate::SOURCE_PRODUCT){
$type = RouteMap::SOURCE_PRODUCT;
}elseif($source == BTemplate::SOURCE_BLOG){
... ... @@ -552,7 +552,6 @@ class BTemplateLogic extends BaseLogic
}else{
$type = 'all';
}
$route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
}else{
$type = RouteMap::SOURCE_MODULE;
$route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
... ... @@ -721,7 +720,7 @@ class BTemplateLogic extends BaseLogic
$this->fail('请先设置模板');
}
$is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$is_custom);
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
//获取设置的默认中间部分
$bTemplateMainModel = new BTemplateMain();
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
... ... @@ -745,17 +744,17 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/15 18:06
*/
public function getTypeCommonHtml($template_id,$is_custom){
public function getTypeCommonHtml($template_id,$type,$is_custom){
//获取首页公共部分
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
//判断当前项目是否有设置独立头部的权限
if($is_custom == BTemplate::SOURCE_CUSTOM){
return $this->success($commonInfo);
}
//判断当前项目是否有设置独立头部的权限
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
//有权限时,获取独立头部
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
if($commonTypeInfo !== false){
$commonInfo = $commonTypeInfo;
}
... ...
... ... @@ -23,7 +23,7 @@ class ProjectCountryLogic extends BaseLogic
public function country_info(){
$lists = $this->model->read(['project_id'=>$this->user['project_id']]);
if (empty($lists)){
return [];
$lists['country_lists'] = '';
}
$lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
return $this->success($lists);
... ...
... ... @@ -36,6 +36,9 @@ class BTemplate extends Base
const TYPE_SEVEN = 7;//新闻列表
const TYPE_EIGHT = 8;//自定义页面
const TYPE_CUSTOM_DETAIL = 11;//扩展详情
const TYPE_CUSTOM_LIST = 12;//扩展列表
protected $table = 'gl_web_template';
//连接数据库
protected $connection = 'custom_mysql';
... ...
... ... @@ -181,6 +181,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::prefix('keyword')->group(function () {
Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix');
Route::any('/save', [Aside\Project\KeywordPrefixController::class, 'save'])->name('admin.keyword_save');
Route::any('/del', [Aside\Project\KeywordPrefixController::class, 'del'])->name('admin.keyword_del');
});
//更新项目tdk
Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk');
... ...