作者 刘锟

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

@@ -11,6 +11,7 @@ namespace App\Console\Commands\Domain; @@ -11,6 +11,7 @@ namespace App\Console\Commands\Domain;
11 11
12 use Illuminate\Console\Command; 12 use Illuminate\Console\Command;
13 use App\Models\Domain\DomainInfo as DomainInfoModel; 13 use App\Models\Domain\DomainInfo as DomainInfoModel;
  14 +use Illuminate\Support\Facades\Log;
14 15
15 class DomainInfo extends Command 16 class DomainInfo extends Command
16 { 17 {
@@ -184,8 +185,8 @@ class DomainInfo extends Command @@ -184,8 +185,8 @@ class DomainInfo extends Command
184 public function updateDomain($domain){ 185 public function updateDomain($domain){
185 $url = 'http://openai.waimaoq.com/v1/whois_api?domain='.$domain; 186 $url = 'http://openai.waimaoq.com/v1/whois_api?domain='.$domain;
186 $response = http_get($url); 187 $response = http_get($url);
187 - $start = '';  
188 - $end = ''; 188 + $start = date('Y-m-d H:i:s');
  189 + $end = date('Y-m-d H:i:s');
189 if($response['code'] == 200){ 190 if($response['code'] == 200){
190 $start = $response['text']['creation_date']; 191 $start = $response['text']['creation_date'];
191 $end = $response['text']['expiration_date']; 192 $end = $response['text']['expiration_date'];
@@ -50,4 +50,21 @@ class KeywordPrefixController extends BaseController @@ -50,4 +50,21 @@ class KeywordPrefixController extends BaseController
50 $keywordPrefixLogic->prefixSave(); 50 $keywordPrefixLogic->prefixSave();
51 $this->response('success'); 51 $this->response('success');
52 } 52 }
  53 +
  54 + /**
  55 + * @remark :删除自添加关键字
  56 + * @name :del
  57 + * @author :lyh
  58 + * @method :post
  59 + * @time :2023/12/16 13:45
  60 + */
  61 + public function del(KeywordPrefixLogic $keywordPrefixLogic){
  62 + $this->request->validate([
  63 + 'id'=>'required|array',
  64 + ],[
  65 + 'id.required' => 'id不能为空',
  66 + ]);
  67 + $keywordPrefixLogic->prefixDel();
  68 + $this->response('success');
  69 + }
53 } 70 }
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 9
10 namespace App\Http\Logic\Aside\Project; 10 namespace App\Http\Logic\Aside\Project;
11 11
  12 +use App\Enums\Common\Code;
12 use App\Http\Logic\Aside\BaseLogic; 13 use App\Http\Logic\Aside\BaseLogic;
13 use App\Models\Project\KeywordPrefix; 14 use App\Models\Project\KeywordPrefix;
14 15
@@ -40,4 +41,28 @@ class KeywordPrefixLogic extends BaseLogic @@ -40,4 +41,28 @@ class KeywordPrefixLogic extends BaseLogic
40 } 41 }
41 return $this->success(); 42 return $this->success();
42 } 43 }
  44 +
  45 + /**
  46 + * @remark :删除关键字
  47 + * @name :prefixDel
  48 + * @author :lyh
  49 + * @method :post
  50 + * @time :2023/12/16 13:48
  51 + */
  52 + public function prefixDel(){
  53 + $ids = $this->param['id'];
  54 + try {
  55 + foreach ($ids as $id){
  56 + $info = $this->model->read(['id'=>$id]);
  57 + if($info !== false){
  58 + if($info['project_id'] != 0){
  59 + $this->model->del(['id'=>$id]);
  60 + }
  61 + }
  62 + }
  63 + }catch (\Exception $e){
  64 + $this->fail('删除失败,请联系管理员');
  65 + }
  66 + return $this->success();
  67 + }
43 } 68 }
@@ -13,6 +13,7 @@ use App\Models\User\ProjectMenu; @@ -13,6 +13,7 @@ use App\Models\User\ProjectMenu;
13 use App\Models\User\ProjectRole; 13 use App\Models\User\ProjectRole;
14 use App\Services\SyncService; 14 use App\Services\SyncService;
15 use App\Utils\HttpUtils; 15 use App\Utils\HttpUtils;
  16 +use App\Utils\LogUtils;
16 use GuzzleHttp\Exception\GuzzleException; 17 use GuzzleHttp\Exception\GuzzleException;
17 use Illuminate\Support\Arr as SupArr; 18 use Illuminate\Support\Arr as SupArr;
18 use App\Helper\Arr; 19 use App\Helper\Arr;
@@ -35,6 +36,7 @@ use App\Services\ProjectServer; @@ -35,6 +36,7 @@ use App\Services\ProjectServer;
35 use Hashids\Hashids; 36 use Hashids\Hashids;
36 use App\Models\User\User as UserModel; 37 use App\Models\User\User as UserModel;
37 use Illuminate\Support\Facades\DB; 38 use Illuminate\Support\Facades\DB;
  39 +use Illuminate\Support\Facades\Http;
38 use Illuminate\Support\Facades\Log; 40 use Illuminate\Support\Facades\Log;
39 use Illuminate\Support\Facades\Schema; 41 use Illuminate\Support\Facades\Schema;
40 use Illuminate\Support\Str; 42 use Illuminate\Support\Str;
@@ -704,6 +706,30 @@ class ProjectLogic extends BaseLogic @@ -704,6 +706,30 @@ class ProjectLogic extends BaseLogic
704 * @time :2023/11/17 15:26 706 * @time :2023/11/17 15:26
705 */ 707 */
706 public function saveOtherProject(){ 708 public function saveOtherProject(){
  709 + //获取当前数据详情
  710 + $projectInfo = $this->getProjectInfo($this->param['id']);
  711 + //aicc
  712 + if(($projectInfo['aicc'] == Project::TYPE_ZERO) && ($this->param['aicc'] == Project::TYPE_ONE)){
  713 + $data = [
  714 + 'company_name'=>$projectInfo['company'],
  715 + 'principal_mobile'=>$projectInfo['mobile'],
  716 + 'remark'=>'',
  717 + 'exclusive_aicc_day'=>$projectInfo['exclusive_aicc_day'] ?: 1,
  718 + 'from_order_id'=>$projectInfo['from_order_id']
  719 + ];
  720 + $this->toAicc($data);
  721 + }
  722 + //黑格
  723 + if(($projectInfo['hagro'] == Project::TYPE_ZERO) && ($this->param['hagro'] == Project::TYPE_ONE)){
  724 + $data = [
  725 + 'company_name'=>$projectInfo['company'],
  726 + 'principal_mobile'=>$projectInfo['mobile'],
  727 + 'exclusive_hagro_day'=>$projectInfo['exclusive_hagro_day'] ?: 1,
  728 + 'from_order_id'=>$projectInfo['from_order_id'],
  729 + 'company_id'=>$projectInfo['channel']['channel_id']
  730 + ];
  731 + $this->toHagro($data);
  732 + }
707 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 733 $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
708 if($rs === false){ 734 if($rs === false){
709 $this->fail('保存失败,请联系管理员'); 735 $this->fail('保存失败,请联系管理员');
@@ -723,4 +749,62 @@ class ProjectLogic extends BaseLogic @@ -723,4 +749,62 @@ class ProjectLogic extends BaseLogic
723 return $this->success($info); 749 return $this->success($info);
724 } 750 }
725 751
  752 + /**
  753 + * 同步到AICC
  754 + * @param $data
  755 + * @author zbj
  756 + * @date 2023/9/1
  757 + */
  758 + protected function toAicc($data){
  759 + $url = 'https://biz.ai.cc/api/sync_company_for_order';
  760 + $param = [
  761 + 'company_name' => $data['company_name'],
  762 + 'company_address' => '',
  763 + 'company_tel' => $data['principal_mobile'],
  764 + 'company_email' => '',
  765 + 'remark' => $data['remark'],
  766 + 'level_id' => 6,
  767 + 'level_day' => $data['exclusive_aicc_day'] ?: 1,
  768 + 'from_order_id' => $data['from_order_id'],
  769 + ];
  770 + //sign
  771 + ksort($param);
  772 + $tem = [];
  773 + foreach ($param as $key => $val) {
  774 + $tem[] = $key . '=' . urlencode($val);
  775 + }
  776 + $string = implode('&', $tem);
  777 + $key = md5('quanqiusou.com');
  778 + $param['sign'] = md5($string . $key);
  779 + $res = Http::withoutVerifying()->post($url, $param)->json();
  780 + if(empty($res['status']) || $res['status'] != 200){
  781 + LogUtils::error('ProjectToAicc error', $res);
  782 + }
  783 + return true;
  784 + }
  785 +
  786 + /**
  787 + * 同步到Hagro
  788 + * @param $data
  789 + * @author zbj
  790 + * @date 2023/9/1
  791 + */
  792 + protected function toHagro($data){
  793 + $url = 'https://admin.hagro.cn/globalso/create_project';
  794 + $param = [
  795 + 'company' => $data['company_name'],
  796 + 'phone' => $data['principal_mobile'],
  797 + 'planday' => $data['exclusive_hagro_day'] ?: 1,
  798 + 'from_order_id' => $data['from_order_id'],
  799 + 'agent_phone' => Channel::where('source_id', $data['company_id'])->value('contact_mobile') ?: '',
  800 + ];
  801 + $common = new Common();
  802 + $token = $common->encrypt($param);
  803 + $res = Http::withoutVerifying()->get($url, ['token' => $token])->json();
  804 + if(empty($res['code']) || $res['code'] != 200){
  805 + $this->fail('ProjectToHagro error');
  806 + }
  807 + return true;
  808 + }
  809 +
726 } 810 }
@@ -215,7 +215,7 @@ class BTemplateLogic extends BaseLogic @@ -215,7 +215,7 @@ class BTemplateLogic extends BaseLogic
215 public function getCommonMain($source,$source_id,$is_custom){ 215 public function getCommonMain($source,$source_id,$is_custom){
216 $data = []; 216 $data = [];
217 if($is_custom == BTemplate::SOURCE_CUSTOM){ 217 if($is_custom == BTemplate::SOURCE_CUSTOM){
218 - if($source_id != 0){$type = BTemplate::TYPE_SIX;}else{$type = BTemplate::TYPE_SEVEN;} 218 + if($source_id != 0){$type = BTemplate::TYPE_CUSTOM_DETAIL;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
219 }else{ 219 }else{
220 if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}} 220 if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
221 if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}} 221 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 @@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic
284 public function templateSave(){ 284 public function templateSave(){
285 //演示项目不允许修改 285 //演示项目不允许修改
286 $this->showProjectNoEdit($this->param['source']); 286 $this->showProjectNoEdit($this->param['source']);
287 -// DB::beginTransaction();  
288 -// try { 287 + DB::beginTransaction();
  288 + try {
289 $this->param = $this->handleDefaultString($this->param);//设置默认字符 289 $this->param = $this->handleDefaultString($this->param);//设置默认字符
290 $templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'], 290 $templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],
291 $this->param['source_id'],$this->param['is_custom']); 291 $this->param['source_id'],$this->param['is_custom']);
@@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic @@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic
299 //更新头部信息 299 //更新头部信息
300 $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']); 300 $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
301 $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']); 301 $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
302 -// DB::commit();  
303 -// }catch (\Exception $e){  
304 -// DB::rollBack();  
305 -// $this->fail('系统错误,请联系管理员');  
306 -// } 302 + DB::commit();
  303 + }catch (\Exception $e){
  304 + DB::rollBack();
  305 + $this->fail('系统错误,请联系管理员');
  306 + }
307 //通知更新 307 //通知更新
308 $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']); 308 $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']);
309 return $this->success(); 309 return $this->success();
@@ -541,8 +541,8 @@ class BTemplateLogic extends BaseLogic @@ -541,8 +541,8 @@ class BTemplateLogic extends BaseLogic
541 public function homeOrProduct($source,$source_id = 0,$is_custom = 0){ 541 public function homeOrProduct($source,$source_id = 0,$is_custom = 0){
542 if($is_custom == 0){ 542 if($is_custom == 0){
543 if($source == BTemplate::SOURCE_HOME){ 543 if($source == BTemplate::SOURCE_HOME){
544 - RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);  
545 - $type = RouteMap::SOURCE_INDEX; 544 + $route = RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
  545 + $type = RouteMap::SOURCE_PAGE;
546 }elseif($source == BTemplate::SOURCE_PRODUCT){ 546 }elseif($source == BTemplate::SOURCE_PRODUCT){
547 $type = RouteMap::SOURCE_PRODUCT; 547 $type = RouteMap::SOURCE_PRODUCT;
548 }elseif($source == BTemplate::SOURCE_BLOG){ 548 }elseif($source == BTemplate::SOURCE_BLOG){
@@ -552,7 +552,6 @@ class BTemplateLogic extends BaseLogic @@ -552,7 +552,6 @@ class BTemplateLogic extends BaseLogic
552 }else{ 552 }else{
553 $type = 'all'; 553 $type = 'all';
554 } 554 }
555 - $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);  
556 }else{ 555 }else{
557 $type = RouteMap::SOURCE_MODULE; 556 $type = RouteMap::SOURCE_MODULE;
558 $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']); 557 $route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
@@ -721,7 +720,7 @@ class BTemplateLogic extends BaseLogic @@ -721,7 +720,7 @@ class BTemplateLogic extends BaseLogic
721 $this->fail('请先设置模板'); 720 $this->fail('请先设置模板');
722 } 721 }
723 $is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版 722 $is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
724 - $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$is_custom); 723 + $commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
725 //获取设置的默认中间部分 724 //获取设置的默认中间部分
726 $bTemplateMainModel = new BTemplateMain(); 725 $bTemplateMainModel = new BTemplateMain();
727 $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 726 $mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
@@ -745,17 +744,17 @@ class BTemplateLogic extends BaseLogic @@ -745,17 +744,17 @@ class BTemplateLogic extends BaseLogic
745 * @method :post 744 * @method :post
746 * @time :2023/12/15 18:06 745 * @time :2023/12/15 18:06
747 */ 746 */
748 - public function getTypeCommonHtml($template_id,$is_custom){ 747 + public function getTypeCommonHtml($template_id,$type,$is_custom){
749 //获取首页公共部分 748 //获取首页公共部分
750 $templateCommonModel = new BTemplateCommon(); 749 $templateCommonModel = new BTemplateCommon();
751 $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]); 750 $commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
752 - //判断当前项目是否有设置独立头部的权限  
753 if($is_custom == BTemplate::SOURCE_CUSTOM){ 751 if($is_custom == BTemplate::SOURCE_CUSTOM){
754 return $this->success($commonInfo); 752 return $this->success($commonInfo);
755 } 753 }
  754 + //判断当前项目是否有设置独立头部的权限
756 if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) { 755 if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
757 //有权限时,获取独立头部 756 //有权限时,获取独立头部
758 - $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 757 + $commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
759 if($commonTypeInfo !== false){ 758 if($commonTypeInfo !== false){
760 $commonInfo = $commonTypeInfo; 759 $commonInfo = $commonTypeInfo;
761 } 760 }
@@ -23,7 +23,7 @@ class ProjectCountryLogic extends BaseLogic @@ -23,7 +23,7 @@ class ProjectCountryLogic extends BaseLogic
23 public function country_info(){ 23 public function country_info(){
24 $lists = $this->model->read(['project_id'=>$this->user['project_id']]); 24 $lists = $this->model->read(['project_id'=>$this->user['project_id']]);
25 if (empty($lists)){ 25 if (empty($lists)){
26 - return []; 26 + $lists['country_lists'] = '';
27 } 27 }
28 $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']); 28 $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
29 return $this->success($lists); 29 return $this->success($lists);
@@ -36,6 +36,9 @@ class BTemplate extends Base @@ -36,6 +36,9 @@ class BTemplate extends Base
36 const TYPE_SEVEN = 7;//新闻列表 36 const TYPE_SEVEN = 7;//新闻列表
37 const TYPE_EIGHT = 8;//自定义页面 37 const TYPE_EIGHT = 8;//自定义页面
38 38
  39 + const TYPE_CUSTOM_DETAIL = 11;//扩展详情
  40 + const TYPE_CUSTOM_LIST = 12;//扩展列表
  41 +
39 protected $table = 'gl_web_template'; 42 protected $table = 'gl_web_template';
40 //连接数据库 43 //连接数据库
41 protected $connection = 'custom_mysql'; 44 protected $connection = 'custom_mysql';
@@ -181,6 +181,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -181,6 +181,7 @@ Route::middleware(['aloginauth'])->group(function () {
181 Route::prefix('keyword')->group(function () { 181 Route::prefix('keyword')->group(function () {
182 Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix'); 182 Route::any('/getKeywordPrefix', [Aside\Project\KeywordPrefixController::class, 'getKeywordPrefix'])->name('admin.keyword_getKeywordPrefix');
183 Route::any('/save', [Aside\Project\KeywordPrefixController::class, 'save'])->name('admin.keyword_save'); 183 Route::any('/save', [Aside\Project\KeywordPrefixController::class, 'save'])->name('admin.keyword_save');
  184 + Route::any('/del', [Aside\Project\KeywordPrefixController::class, 'del'])->name('admin.keyword_del');
184 }); 185 });
185 //更新项目tdk 186 //更新项目tdk
186 Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk'); 187 Route::any('/updateSeoTdk', [Aside\Com\UpdateController::class, 'updateSeoTdk'])->name('admin.project_updateSeoTdk');