Merge remote-tracking branch 'origin/master' into akun
正在显示
16 个修改的文件
包含
183 行增加
和
107 行删除
| @@ -5,7 +5,7 @@ namespace App\Console\Commands\DayCount; | @@ -5,7 +5,7 @@ namespace App\Console\Commands\DayCount; | ||
| 5 | use App\Helper\Common; | 5 | use App\Helper\Common; |
| 6 | use App\Helper\FormGlobalsoApi; | 6 | use App\Helper\FormGlobalsoApi; |
| 7 | use App\Models\Domain\DomainInfo; | 7 | use App\Models\Domain\DomainInfo; |
| 8 | -use App\Models\Inquiry\InquiryOther; | 8 | +use App\Models\Inquiry\InquiryFormData; |
| 9 | use App\Models\Project\DeployBuild; | 9 | use App\Models\Project\DeployBuild; |
| 10 | use App\Models\Project\DeployOptimize; | 10 | use App\Models\Project\DeployOptimize; |
| 11 | use App\Models\Project\Project; | 11 | use App\Models\Project\Project; |
| @@ -102,7 +102,7 @@ class Count extends Command | @@ -102,7 +102,7 @@ class Count extends Command | ||
| 102 | * @time :2023/6/14 15:40 | 102 | * @time :2023/6/14 15:40 |
| 103 | */ | 103 | */ |
| 104 | public function pv_num($yesterday,$domain){ | 104 | public function pv_num($yesterday,$domain){ |
| 105 | - $pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count(); | 105 | + $pv = DB::connection('custom_mysql')->table('gl_customer_visit_item')->whereDate('updated_date', $yesterday)->count(); |
| 106 | return $pv; | 106 | return $pv; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| @@ -113,7 +113,7 @@ class Count extends Command | @@ -113,7 +113,7 @@ class Count extends Command | ||
| 113 | * @time :2023/6/14 15:40 | 113 | * @time :2023/6/14 15:40 |
| 114 | */ | 114 | */ |
| 115 | public function ip_num($yesterday,$domain){ | 115 | public function ip_num($yesterday,$domain){ |
| 116 | - $ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->where('domain',$domain)->count(); | 116 | + $ip = DB::connection('custom_mysql')->table('gl_customer_visit')->whereDate('updated_date', $yesterday)->count(); |
| 117 | return $ip; | 117 | return $ip; |
| 118 | } | 118 | } |
| 119 | 119 | ||
| @@ -146,8 +146,8 @@ class Count extends Command | @@ -146,8 +146,8 @@ class Count extends Command | ||
| 146 | 146 | ||
| 147 | //加上其他询盘 | 147 | //加上其他询盘 |
| 148 | ProjectServer::useProject($project_id); | 148 | ProjectServer::useProject($project_id); |
| 149 | - $arr['inquiry_num'] = InquiryOther::count(); | ||
| 150 | - $countryData = InquiryOther::select("country",DB::raw('COUNT(*) as count'))->groupBy('country')->get()->toArray(); | 149 | + $arr['inquiry_num'] += InquiryFormData::getCount(); |
| 150 | + $countryData = InquiryFormData::getCountryCount(); | ||
| 151 | foreach ($countryData as $v1){ | 151 | foreach ($countryData as $v1){ |
| 152 | if(isset($countryArr[$v1['country']])){ | 152 | if(isset($countryArr[$v1['country']])){ |
| 153 | $countryArr[$v1['country']] += $v1['count']; | 153 | $countryArr[$v1['country']] += $v1['count']; |
| @@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
| 3 | namespace App\Console\Commands; | 3 | namespace App\Console\Commands; |
| 4 | 4 | ||
| 5 | use App\Helper\FormGlobalsoApi; | 5 | use App\Helper\FormGlobalsoApi; |
| 6 | -use App\Models\Inquiry\InquiryOther; | 6 | +use App\Models\Inquiry\InquiryFormData; |
| 7 | use App\Models\Project\Project; | 7 | use App\Models\Project\Project; |
| 8 | use App\Services\ProjectServer; | 8 | use App\Services\ProjectServer; |
| 9 | use Illuminate\Console\Command; | 9 | use Illuminate\Console\Command; |
| @@ -56,7 +56,7 @@ class LastInquiry extends Command | @@ -56,7 +56,7 @@ class LastInquiry extends Command | ||
| 56 | $last_time = $res['data']['data'][0] ?? ''; | 56 | $last_time = $res['data']['data'][0] ?? ''; |
| 57 | //其他询盘的最新时间 | 57 | //其他询盘的最新时间 |
| 58 | ProjectServer::useProject($item['id']); | 58 | ProjectServer::useProject($item['id']); |
| 59 | - $other_last_time = InquiryOther::orderBy('id', 'desc')->value('submit_time'); | 59 | + $other_last_time = InquiryFormData::orderBy('id', 'desc')->value('submit_at'); |
| 60 | 60 | ||
| 61 | $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time; | 61 | $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time; |
| 62 | 62 |
| @@ -4,7 +4,7 @@ namespace App\Console\Commands\MonthlyCount; | @@ -4,7 +4,7 @@ namespace App\Console\Commands\MonthlyCount; | ||
| 4 | 4 | ||
| 5 | use App\Helper\FormGlobalsoApi; | 5 | use App\Helper\FormGlobalsoApi; |
| 6 | use App\Models\Domain\DomainInfo; | 6 | use App\Models\Domain\DomainInfo; |
| 7 | -use App\Models\Inquiry\InquiryOther; | 7 | +use App\Models\Inquiry\InquiryFormData; |
| 8 | use App\Models\Project\Project; | 8 | use App\Models\Project\Project; |
| 9 | use App\Services\ProjectServer; | 9 | use App\Services\ProjectServer; |
| 10 | use Carbon\Carbon; | 10 | use Carbon\Carbon; |
| @@ -107,11 +107,9 @@ class InquiryMonthlyCount extends Command | @@ -107,11 +107,9 @@ class InquiryMonthlyCount extends Command | ||
| 107 | } | 107 | } |
| 108 | //加上其他询盘 | 108 | //加上其他询盘 |
| 109 | ProjectServer::useProject($project_id); | 109 | ProjectServer::useProject($project_id); |
| 110 | - $arr['total'] += InquiryOther::count(); | ||
| 111 | - $arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count(); | ||
| 112 | - $countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime]) | ||
| 113 | - ->select("country",DB::raw('COUNT(*) as count')) | ||
| 114 | - ->groupBy('country')->get()->toArray(); | 110 | + $arr['total'] += InquiryFormData::count(); |
| 111 | + $arr['month_total'] += InquiryFormData::getCount([$startTime, $endTime]); | ||
| 112 | + $countryData = InquiryFormData::getCountryCount([$startTime, $endTime]); | ||
| 115 | foreach ($countryData as $v1){ | 113 | foreach ($countryData as $v1){ |
| 116 | if(isset($countryArr[$v1['country']])){ | 114 | if(isset($countryArr[$v1['country']])){ |
| 117 | $countryArr[$v1['country']] += $v1['count']; | 115 | $countryArr[$v1['country']] += $v1['count']; |
| @@ -2,30 +2,24 @@ | @@ -2,30 +2,24 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Console\Commands; | 3 | namespace App\Console\Commands; |
| 4 | 4 | ||
| 5 | -use App\Http\Logic\Aside\Project\DomainInfoLogic; | ||
| 6 | -use App\Models\Com\UpdateNotify; | ||
| 7 | -use App\Models\Devops\DevopsTask as DevopsTaskModel; | ||
| 8 | -use App\Models\Devops\DevopsTaskLog; | 5 | + |
| 6 | + | ||
| 7 | +use App\Helper\FormGlobalsoApi; | ||
| 9 | use App\Models\Domain\DomainInfo; | 8 | use App\Models\Domain\DomainInfo; |
| 10 | -use App\Models\File\File; | ||
| 11 | -use App\Models\File\Image; | ||
| 12 | -use App\Models\Product\CategoryRelated; | ||
| 13 | -use App\Models\Product\Product; | 9 | +use App\Models\HomeCount\Count; |
| 10 | +use App\Models\Inquiry\InquiryFormData; | ||
| 14 | use App\Models\Project\Project; | 11 | use App\Models\Project\Project; |
| 15 | -use App\Models\RouteMap\RouteMap; | ||
| 16 | -use App\Models\Template\BCustomTemplate; | ||
| 17 | use App\Services\ProjectServer; | 12 | use App\Services\ProjectServer; |
| 18 | use Illuminate\Console\Command; | 13 | use Illuminate\Console\Command; |
| 19 | -use Illuminate\Database\QueryException; | 14 | +use Illuminate\Database\Eloquent\Model; |
| 20 | use Illuminate\Support\Facades\DB; | 15 | use Illuminate\Support\Facades\DB; |
| 21 | -use Illuminate\Support\Str; | 16 | +use mysql_xdevapi\Exception; |
| 22 | 17 | ||
| 23 | /** | 18 | /** |
| 24 | - * 测试 | ||
| 25 | - * Class Traffic | 19 | + * Class Test |
| 26 | * @package App\Console\Commands | 20 | * @package App\Console\Commands |
| 27 | * @author zbj | 21 | * @author zbj |
| 28 | - * @date 2023/5/18 | 22 | + * @date 2023/4/25 |
| 29 | */ | 23 | */ |
| 30 | class Test extends Command | 24 | class Test extends Command |
| 31 | { | 25 | { |
| @@ -41,7 +35,7 @@ class Test extends Command | @@ -41,7 +35,7 @@ class Test extends Command | ||
| 41 | * | 35 | * |
| 42 | * @var string | 36 | * @var string |
| 43 | */ | 37 | */ |
| 44 | - protected $description = '测试'; | 38 | + protected $description = ''; |
| 45 | 39 | ||
| 46 | /** | 40 | /** |
| 47 | * Create a new command instance. | 41 | * Create a new command instance. |
| @@ -58,52 +52,70 @@ class Test extends Command | @@ -58,52 +52,70 @@ class Test extends Command | ||
| 58 | */ | 52 | */ |
| 59 | public function handle() | 53 | public function handle() |
| 60 | { | 54 | { |
| 61 | - $domains = DB::table('gl_customer_visit')->groupBy('domain')->select('domain')->pluck('domain')->toArray(); | ||
| 62 | - foreach($domains as $domain){ | ||
| 63 | - if(!Str::contains($domain, 'globalso.site')){ | ||
| 64 | - $this->sync($domain); | 55 | + $projects = Project::all(); |
| 56 | + foreach ($projects as $project){ | ||
| 57 | + echo "project " . $project->id; | ||
| 58 | + if(!ProjectServer::useProject($project->id)){ | ||
| 59 | + echo '未配置数据库' . PHP_EOL; | ||
| 60 | + continue; | ||
| 61 | + } | ||
| 62 | + $test_domain = $project->deploy_build['test_domain']; | ||
| 63 | + $domainInfo = new DomainInfo(); | ||
| 64 | + $info = $domainInfo->read(['id'=>$project->deploy_optimize['domain']]); | ||
| 65 | + if($info !== false){ | ||
| 66 | + $test_domain = $info['domain']; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + try { | ||
| 70 | + $list = Count::where('date', '2023-12-11')->where('project_id', $project->id)->get(); | ||
| 71 | + foreach ($list as $v){ | ||
| 72 | + $arr = $this->inquiry([],$test_domain, $v['id']); | ||
| 73 | + $v->inquiry_num = $arr['inquiry_num']; | ||
| 74 | + $v->country = $arr['country']; | ||
| 75 | + $v->save(); | ||
| 76 | + echo $v['date'] . ':' . $v->pv_num .':'. $v->ip_num . PHP_EOL; | ||
| 77 | + } | ||
| 78 | + }catch (\Exception $e){ | ||
| 79 | + echo '保存失败' . $e->getMessage() . PHP_EOL; | ||
| 65 | } | 80 | } |
| 66 | } | 81 | } |
| 82 | + echo "finish"; | ||
| 67 | } | 83 | } |
| 68 | 84 | ||
| 69 | - public function sync($domain){ | ||
| 70 | - echo date('Y-m-d H:i:s') . "同步项目{$domain}" . PHP_EOL; | ||
| 71 | - if(!Str::startsWith($domain,'www.')){ | ||
| 72 | - $domain = 'www.'.$domain; | ||
| 73 | - } | ||
| 74 | - $project_id = DomainInfo::where('domain', $domain)->value('project_id'); | ||
| 75 | - if(!$project_id){ | ||
| 76 | - echo date('Y-m-d H:i:s') . "项目{$domain}不存在" . PHP_EOL; | ||
| 77 | - return true; | ||
| 78 | - } | ||
| 79 | - if(!ProjectServer::useProject($project_id)){ | ||
| 80 | - echo date('Y-m-d H:i:s') . "项目{$domain}数据库配置无效" . PHP_EOL; | ||
| 81 | - return true; | 85 | + public function inquiry($arr,$domain,$project_id){ |
| 86 | + $inquiry_list = (new FormGlobalsoApi())->getInquiryList($domain,'',1,100000000); | ||
| 87 | + if($inquiry_list['status'] == 400){ | ||
| 88 | + $arr['inquiry_num'] = 0; | ||
| 89 | + $countryArr = []; | ||
| 90 | + }else{ | ||
| 91 | + $arr['inquiry_num'] = $inquiry_list['data']['total']; | ||
| 92 | + //询盘国家统计 | ||
| 93 | + $countryData = $inquiry_list['data']['data']; | ||
| 94 | + $countryArr = []; | ||
| 95 | + foreach ($countryData as $v1){ | ||
| 96 | + if(isset($countryArr[$v1['country']])){ | ||
| 97 | + $countryArr[$v1['country']]++; | ||
| 98 | + }else{ | ||
| 99 | + $countryArr[$v1['country']] = 1; | ||
| 100 | + } | ||
| 101 | + } | ||
| 82 | } | 102 | } |
| 83 | - $visit = 0; | ||
| 84 | - $visit_item = 0; | ||
| 85 | - $list = DB::table('gl_customer_visit')->whereIn('domain', [$domain, str_replace('www.','',$domain)])->get(); | ||
| 86 | - foreach ($list as $v){ | ||
| 87 | - $v = (array) $v; | ||
| 88 | - | ||
| 89 | - $items = DB::table('gl_customer_visit_item')->where('customer_visit_id', $v['id'])->get(); | ||
| 90 | - | ||
| 91 | - unset($v['id']); | ||
| 92 | - $id = DB::connection('custom_mysql')->table('gl_customer_visit')->insertGetId($v); | ||
| 93 | - | ||
| 94 | - $visit++; | ||
| 95 | 103 | ||
| 96 | - $data = []; | ||
| 97 | - foreach ($items as $item){ | ||
| 98 | - $item = (array) $item; | ||
| 99 | - unset($item['id']); | ||
| 100 | - $item['customer_visit_id'] = $id; | ||
| 101 | - $data[] = $item; | ||
| 102 | - $visit_item++; | 104 | + //加上其他询盘 |
| 105 | + $arr['inquiry_num'] += InquiryFormData::getCount(); | ||
| 106 | + $countryData = InquiryFormData::getCountryCount(); | ||
| 107 | + foreach ($countryData as $v1){ | ||
| 108 | + if(isset($countryArr[$v1['country']])){ | ||
| 109 | + $countryArr[$v1['country']] += $v1['count']; | ||
| 110 | + }else{ | ||
| 111 | + $countryArr[$v1['country']] = $v1['count']; | ||
| 103 | } | 112 | } |
| 104 | - DB::connection('custom_mysql')->table('gl_customer_visit_item')->insert($data); | ||
| 105 | } | 113 | } |
| 106 | - echo date('Y-m-d H:i:s') . "visit:{$visit};item:{$visit_item}" . PHP_EOL;exit; | ||
| 107 | - } | ||
| 108 | 114 | ||
| 115 | + | ||
| 116 | + arsort($countryArr); | ||
| 117 | + $top20 = array_slice($countryArr, 0, 20, true); | ||
| 118 | + $arr['country'] = json_encode($top20); | ||
| 119 | + return $arr; | ||
| 120 | + } | ||
| 109 | } | 121 | } |
| @@ -53,14 +53,10 @@ class UpdateRoute extends Command | @@ -53,14 +53,10 @@ class UpdateRoute extends Command | ||
| 53 | * @time :2023/11/20 15:13 | 53 | * @time :2023/11/20 15:13 |
| 54 | */ | 54 | */ |
| 55 | public function handle(){ | 55 | public function handle(){ |
| 56 | - $projectModel = new Project(); | ||
| 57 | - $lists = $projectModel->list(['is_upgrade'=>0,'type'=>['!=',0]]); | ||
| 58 | - foreach ($lists as $k => $v){ | ||
| 59 | - ProjectServer::useProject($v['id']); | ||
| 60 | - $this->getProductKeyword($v['id']); | ||
| 61 | - DB::disconnect('custom_mysql'); | ||
| 62 | - } | ||
| 63 | - echo date('Y-m-d H:i:s') . ' end: 项目id为' . $v['id'] . PHP_EOL; | 56 | + ProjectServer::useProject(75); |
| 57 | + $this->getProductKeyword(); | ||
| 58 | + DB::disconnect('custom_mysql'); | ||
| 59 | + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | ||
| 64 | } | 60 | } |
| 65 | 61 | ||
| 66 | /** | 62 | /** |
| @@ -70,12 +66,32 @@ class UpdateRoute extends Command | @@ -70,12 +66,32 @@ class UpdateRoute extends Command | ||
| 70 | * @method :post | 66 | * @method :post |
| 71 | * @time :2023/12/8 11:13 | 67 | * @time :2023/12/8 11:13 |
| 72 | */ | 68 | */ |
| 73 | - public function getProductKeyword($id){ | 69 | + public function getProductKeyword(){ |
| 74 | $keywordModel = new Keyword(); | 70 | $keywordModel = new Keyword(); |
| 75 | - $lists = $keywordModel->list(['route'=>['like','%-1-2-%']]); | 71 | + $lists = $keywordModel->list(['route'=>null]); |
| 76 | if(!empty($lists)){ | 72 | if(!empty($lists)){ |
| 77 | - echo date('Y-m-d H:i:s') . ' 错误id:' . $id . PHP_EOL; | 73 | + foreach ($lists as $v){ |
| 74 | + echo date('Y-m-d H:i:s') . 'id :'.$v['id'] . PHP_EOL; | ||
| 75 | + $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], 75); | ||
| 76 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 77 | + $keywordModel->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 78 | + echo date('Y-m-d H:i:s') . 'end :'.$route . PHP_EOL; | ||
| 79 | + } | ||
| 78 | } | 80 | } |
| 79 | } | 81 | } |
| 80 | 82 | ||
| 83 | + /** | ||
| 84 | + * @remark :删除路由通知C端 | ||
| 85 | + * @name :curlDelRoute | ||
| 86 | + * @author :lyh | ||
| 87 | + * @method :post | ||
| 88 | + * @time :2023/11/30 14:43 | ||
| 89 | + */ | ||
| 90 | + public function curlDelRoute($data){ | ||
| 91 | + $data['project_id'] = 75; | ||
| 92 | + $str = http_build_query($data); | ||
| 93 | + $url = 'https://www.zrutong.com/api/delHtml/?'.$str; | ||
| 94 | + curlGet($url); | ||
| 95 | + return true; | ||
| 96 | + } | ||
| 81 | } | 97 | } |
| @@ -33,6 +33,7 @@ use App\Models\Project\RenewLog; | @@ -33,6 +33,7 @@ use App\Models\Project\RenewLog; | ||
| 33 | use App\Models\RankData\RankData; | 33 | use App\Models\RankData\RankData; |
| 34 | use App\Models\Task\Task; | 34 | use App\Models\Task\Task; |
| 35 | use App\Models\Visit\Visit; | 35 | use App\Models\Visit\Visit; |
| 36 | +use App\Models\WebSetting\WebLanguage; | ||
| 36 | use Illuminate\Http\Request; | 37 | use Illuminate\Http\Request; |
| 37 | use Illuminate\Support\Facades\DB; | 38 | use Illuminate\Support\Facades\DB; |
| 38 | 39 | ||
| @@ -541,7 +542,7 @@ class ProjectController extends BaseController | @@ -541,7 +542,7 @@ class ProjectController extends BaseController | ||
| 541 | if(isset($this->map['entry_position']) && !empty($this->map['entry_position'])){ | 542 | if(isset($this->map['entry_position']) && !empty($this->map['entry_position'])){ |
| 542 | $this->map['entry_position'] = ['in',$this->map['entry_position']]; | 543 | $this->map['entry_position'] = ['in',$this->map['entry_position']]; |
| 543 | } | 544 | } |
| 544 | - $lists = $hrManagerModel->list($this->map,'id',['id','manage_id','name','entry_position','is_leader']); | 545 | + $lists = $hrManagerModel->list($this->map,['sort','id'],['id','manage_id','name','entry_position','is_leader']); |
| 545 | $this->response('success',Code::SUCCESS,$lists); | 546 | $this->response('success',Code::SUCCESS,$lists); |
| 546 | } | 547 | } |
| 547 | 548 | ||
| @@ -872,4 +873,17 @@ class ProjectController extends BaseController | @@ -872,4 +873,17 @@ class ProjectController extends BaseController | ||
| 872 | } | 873 | } |
| 873 | $this->response('success',Code::SUCCESS,$zone_list); | 874 | $this->response('success',Code::SUCCESS,$zone_list); |
| 874 | } | 875 | } |
| 876 | + | ||
| 877 | + /** | ||
| 878 | + * @remark :获取小语种列表 | ||
| 879 | + * @name :lists | ||
| 880 | + * @author :lyh | ||
| 881 | + * @method :post | ||
| 882 | + * @time :2023/11/30 10:59 | ||
| 883 | + */ | ||
| 884 | + public function languageLists(){ | ||
| 885 | + $webLanguageModel = new WebLanguage(); | ||
| 886 | + $lists = $webLanguageModel->list(); | ||
| 887 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 888 | + } | ||
| 875 | } | 889 | } |
| @@ -65,7 +65,16 @@ class CustomModuleContentController extends BaseController | @@ -65,7 +65,16 @@ class CustomModuleContentController extends BaseController | ||
| 65 | public function getCategoryList(){ | 65 | public function getCategoryList(){ |
| 66 | $categoryModel = new CustomModuleCategory(); | 66 | $categoryModel = new CustomModuleCategory(); |
| 67 | $list = $categoryModel->list(['project_id'=>$this->user['project_id'],'module_id'=>$this->param['module_id']],['id','name']); | 67 | $list = $categoryModel->list(['project_id'=>$this->user['project_id'],'module_id'=>$this->param['module_id']],['id','name']); |
| 68 | - $this->response('success',Code::SUCCESS,$list); | 68 | + $menu = []; |
| 69 | + if(!empty($list)){ | ||
| 70 | + foreach ($list as $v){ | ||
| 71 | + if($v['pid'] == 0){ | ||
| 72 | + $v['sub'] = _get_child($v['id'],$list); | ||
| 73 | + $menu[] = $v; | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + $this->response('success',Code::SUCCESS,$menu); | ||
| 69 | } | 78 | } |
| 70 | 79 | ||
| 71 | /** | 80 | /** |
| @@ -9,6 +9,7 @@ | @@ -9,6 +9,7 @@ | ||
| 9 | 9 | ||
| 10 | namespace App\Http\Controllers\Bside\CustomModule; | 10 | namespace App\Http\Controllers\Bside\CustomModule; |
| 11 | 11 | ||
| 12 | +use App\Enums\Common\Code; | ||
| 12 | use App\Http\Controllers\Bside\BaseController; | 13 | use App\Http\Controllers\Bside\BaseController; |
| 13 | use App\Http\Logic\Bside\CustomModule\CustomModuleExtendLogic; | 14 | use App\Http\Logic\Bside\CustomModule\CustomModuleExtendLogic; |
| 14 | use App\Models\CustomModule\CustomModuleExtend; | 15 | use App\Models\CustomModule\CustomModuleExtend; |
| @@ -30,7 +31,7 @@ class CustomModuleExtentController extends BaseController | @@ -30,7 +31,7 @@ class CustomModuleExtentController extends BaseController | ||
| 30 | ]); | 31 | ]); |
| 31 | $this->map['project_id'] = $this->user['project_id']; | 32 | $this->map['project_id'] = $this->user['project_id']; |
| 32 | $filed = ['id','title','status','type','operator_id','project_id','module_id','created_at','updated_at']; | 33 | $filed = ['id','title','status','type','operator_id','project_id','module_id','created_at','updated_at']; |
| 33 | - $lists = $customModuleExtend->lists($this->map,$this->page,$this->row,$this->order,$filed); | 34 | + $lists = $customModuleExtend->list($this->map,$this->order,$filed); |
| 34 | $this->response('success',Code::SUCCESS,$lists); | 35 | $this->response('success',Code::SUCCESS,$lists); |
| 35 | } | 36 | } |
| 36 | 37 | ||
| @@ -59,8 +60,8 @@ class CustomModuleExtentController extends BaseController | @@ -59,8 +60,8 @@ class CustomModuleExtentController extends BaseController | ||
| 59 | * @time :2023/12/4 15:45 | 60 | * @time :2023/12/4 15:45 |
| 60 | */ | 61 | */ |
| 61 | public function save(CustomModuleExtendLogic $logic){ | 62 | public function save(CustomModuleExtendLogic $logic){ |
| 62 | - $logic->extendSave(); | ||
| 63 | - $this->response('success'); | 63 | + $info = $logic->extendSave(); |
| 64 | + $this->response('success',Code::SUCCESS,$info); | ||
| 64 | } | 65 | } |
| 65 | 66 | ||
| 66 | /** | 67 | /** |
| @@ -14,8 +14,6 @@ use App\Models\CustomModule\CustomModuleCategory; | @@ -14,8 +14,6 @@ use App\Models\CustomModule\CustomModuleCategory; | ||
| 14 | use App\Models\CustomModule\CustomModuleContent; | 14 | use App\Models\CustomModule\CustomModuleContent; |
| 15 | use App\Models\CustomModule\CustomModuleExtend; | 15 | use App\Models\CustomModule\CustomModuleExtend; |
| 16 | use App\Models\CustomModule\CustomModuleExtentContent; | 16 | use App\Models\CustomModule\CustomModuleExtentContent; |
| 17 | -use App\Models\Product\Extend; | ||
| 18 | -use App\Models\Product\ExtendInfo; | ||
| 19 | use App\Models\RouteMap\RouteMap; | 17 | use App\Models\RouteMap\RouteMap; |
| 20 | use Illuminate\Support\Facades\DB; | 18 | use Illuminate\Support\Facades\DB; |
| 21 | use mysql_xdevapi\Exception; | 19 | use mysql_xdevapi\Exception; |
| @@ -248,7 +246,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -248,7 +246,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 248 | */ | 246 | */ |
| 249 | public function saveExtendInfo($content_id,$extend){ | 247 | public function saveExtendInfo($content_id,$extend){ |
| 250 | //先删除以前的数据 | 248 | //先删除以前的数据 |
| 251 | - $extendInfoModel = new ExtendInfo(); | 249 | + $extendInfoModel = new CustomModuleExtentContent(); |
| 252 | $extendInfoModel->del(['content_id'=>$content_id]); | 250 | $extendInfoModel->del(['content_id'=>$content_id]); |
| 253 | if(empty($extend)) { | 251 | if(empty($extend)) { |
| 254 | return $this->success(); | 252 | return $this->success(); |
| @@ -271,6 +269,7 @@ class CustomModuleContentLogic extends BaseLogic | @@ -271,6 +269,7 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 271 | * @time :2023/12/6 15:11 | 269 | * @time :2023/12/6 15:11 |
| 272 | */ | 270 | */ |
| 273 | public function saveHandleExtend(&$v,$content_id){ | 271 | public function saveHandleExtend(&$v,$content_id){ |
| 272 | + unset($v['title']); | ||
| 274 | if($v['type'] == 3){ | 273 | if($v['type'] == 3){ |
| 275 | foreach ($v['values'] as $k1=>$v1){ | 274 | foreach ($v['values'] as $k1=>$v1){ |
| 276 | $v1['url'] = str_replace_url($v1['url']); | 275 | $v1['url'] = str_replace_url($v1['url']); |
| @@ -322,8 +321,8 @@ class CustomModuleContentLogic extends BaseLogic | @@ -322,8 +321,8 @@ class CustomModuleContentLogic extends BaseLogic | ||
| 322 | { | 321 | { |
| 323 | RouteMap::delRoute(RouteMap::SOURCE_MODULE, $id, $this->user['project_id']); | 322 | RouteMap::delRoute(RouteMap::SOURCE_MODULE, $id, $this->user['project_id']); |
| 324 | //通知 | 323 | //通知 |
| 325 | - $info = $this->model->read(['id' => $id], ['id', 'url']); | ||
| 326 | - $this->curlDelRoute(['route'=>$info['url']]); | 324 | + $info = $this->model->read(['id' => $id], ['id', 'route']); |
| 325 | + $this->curlDelRoute(['route'=>$info['route']]); | ||
| 327 | return $this->success(); | 326 | return $this->success(); |
| 328 | } | 327 | } |
| 329 | } | 328 | } |
| @@ -50,7 +50,7 @@ class CustomModuleExtendLogic extends BaseLogic | @@ -50,7 +50,7 @@ class CustomModuleExtendLogic extends BaseLogic | ||
| 50 | }else{ | 50 | }else{ |
| 51 | $this->extendAdd(); | 51 | $this->extendAdd(); |
| 52 | } | 52 | } |
| 53 | - return $this->success(); | 53 | + return $this->success($this->param); |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | /** | 56 | /** |
| @@ -138,12 +138,17 @@ class CountLogic extends BaseLogic | @@ -138,12 +138,17 @@ class CountLogic extends BaseLogic | ||
| 138 | $customerVisitModel = new Visit(); | 138 | $customerVisitModel = new Visit(); |
| 139 | $data = $customerVisitModel->select('referrer_url', DB::raw('COUNT(*) as count')) | 139 | $data = $customerVisitModel->select('referrer_url', DB::raw('COUNT(*) as count')) |
| 140 | ->groupBy('referrer_url')->where(['domain'=>$this->user['domain']]) | 140 | ->groupBy('referrer_url')->where(['domain'=>$this->user['domain']]) |
| 141 | - ->orderByDesc('count')->limit(8)->get()->toArray(); | 141 | + ->orderByDesc('count')->limit(9)->get()->toArray(); |
| 142 | $total = $customerVisitModel->count(); | 142 | $total = $customerVisitModel->count(); |
| 143 | if(!empty($data)){ | 143 | if(!empty($data)){ |
| 144 | foreach ($data as $k=>$v){ | 144 | foreach ($data as $k=>$v){ |
| 145 | + if(empty($v['referrer_url'])){ | ||
| 146 | + unset($data[$k]); | ||
| 147 | + continue; | ||
| 148 | + } | ||
| 145 | $data[$k]['proportion'] = ($v['count']/$total) * 100; | 149 | $data[$k]['proportion'] = ($v['count']/$total) * 100; |
| 146 | } | 150 | } |
| 151 | + $data = array_values($data); | ||
| 147 | } | 152 | } |
| 148 | return $this->success($data); | 153 | return $this->success($data); |
| 149 | } | 154 | } |
| @@ -6,7 +6,7 @@ use App\Helper\FormGlobalsoApi; | @@ -6,7 +6,7 @@ use App\Helper\FormGlobalsoApi; | ||
| 6 | use App\Http\Logic\Bside\BaseLogic; | 6 | use App\Http\Logic\Bside\BaseLogic; |
| 7 | use App\Models\HomeCount\Count; | 7 | use App\Models\HomeCount\Count; |
| 8 | use App\Models\HomeCount\MonthCount; | 8 | use App\Models\HomeCount\MonthCount; |
| 9 | -use App\Models\Inquiry\InquiryOther; | 9 | +use App\Models\Inquiry\InquiryFormData; |
| 10 | use App\Models\Project\DeployOptimize; | 10 | use App\Models\Project\DeployOptimize; |
| 11 | use App\Services\ProjectServer; | 11 | use App\Services\ProjectServer; |
| 12 | use Carbon\Carbon; | 12 | use Carbon\Carbon; |
| @@ -86,11 +86,9 @@ class MonthCountLogic extends BaseLogic | @@ -86,11 +86,9 @@ class MonthCountLogic extends BaseLogic | ||
| 86 | } | 86 | } |
| 87 | } | 87 | } |
| 88 | //加上其他询盘 | 88 | //加上其他询盘 |
| 89 | - $arr['total'] += InquiryOther::count(); | ||
| 90 | - $arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count(); | ||
| 91 | - $countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime]) | ||
| 92 | - ->select("country",DB::raw('COUNT(*) as count')) | ||
| 93 | - ->groupBy('country')->get()->toArray(); | 89 | + $arr['total'] += InquiryFormData::getCount(); |
| 90 | + $arr['month_total'] += InquiryFormData::getCount([$startTime, $endTime]); | ||
| 91 | + $countryData = InquiryFormData::getCountryCount([$startTime, $endTime]); | ||
| 94 | foreach ($countryData as $v1){ | 92 | foreach ($countryData as $v1){ |
| 95 | if(isset($countryArr[$v1['country']])){ | 93 | if(isset($countryArr[$v1['country']])){ |
| 96 | $countryArr[$v1['country']] += $v1['count']; | 94 | $countryArr[$v1['country']] += $v1['count']; |
| @@ -126,7 +126,6 @@ class KeywordLogic extends BaseLogic | @@ -126,7 +126,6 @@ class KeywordLogic extends BaseLogic | ||
| 126 | */ | 126 | */ |
| 127 | public function batchAdd(){ | 127 | public function batchAdd(){ |
| 128 | try { | 128 | try { |
| 129 | - $idArr = []; | ||
| 130 | foreach ($this->param['title'] as $v){ | 129 | foreach ($this->param['title'] as $v){ |
| 131 | $this->model = new Keyword(); | 130 | $this->model = new Keyword(); |
| 132 | $info = $this->model->read(['title'=>$v]); | 131 | $info = $this->model->read(['title'=>$v]); |
| @@ -136,16 +135,11 @@ class KeywordLogic extends BaseLogic | @@ -136,16 +135,11 @@ class KeywordLogic extends BaseLogic | ||
| 136 | $param['updated_at'] = $param['created_at']; | 135 | $param['updated_at'] = $param['created_at']; |
| 137 | $param['title'] = $v; | 136 | $param['title'] = $v; |
| 138 | $id = $this->model->insertGetId($param); | 137 | $id = $this->model->insertGetId($param); |
| 139 | - $idArr[] = ['id'=>$id,'title'=>$v]; | 138 | + $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); |
| 139 | + $this->curlDelRoute(['new_route'=>$route]); | ||
| 140 | + $this->model->edit(['route'=>$route],['id'=>$id]); | ||
| 140 | } | 141 | } |
| 141 | } | 142 | } |
| 142 | - //批量生成路由 | ||
| 143 | - foreach ($idArr as $v){ | ||
| 144 | - $this->model = new Keyword(); | ||
| 145 | - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $v['id'], $this->user['project_id']); | ||
| 146 | - $this->curlDelRoute(['new_route'=>$route]); | ||
| 147 | - $this->model->edit(['route'=>$route],['id'=>$v['id']]); | ||
| 148 | - } | ||
| 149 | }catch (\Exception $e){ | 143 | }catch (\Exception $e){ |
| 150 | $this->fail('error'); | 144 | $this->fail('error'); |
| 151 | } | 145 | } |
| @@ -13,7 +13,7 @@ use App\Models\Base; | @@ -13,7 +13,7 @@ use App\Models\Base; | ||
| 13 | 13 | ||
| 14 | class CustomModuleExtentContent extends Base | 14 | class CustomModuleExtentContent extends Base |
| 15 | { | 15 | { |
| 16 | - protected $table = 'gl_custom_module_extent_content'; | 16 | + protected $table = 'gl_custom_module_extend_content'; |
| 17 | //连接数据库 | 17 | //连接数据库 |
| 18 | protected $connection = 'custom_mysql'; | 18 | protected $connection = 'custom_mysql'; |
| 19 | } | 19 | } |
| @@ -4,6 +4,7 @@ namespace App\Models\Inquiry; | @@ -4,6 +4,7 @@ namespace App\Models\Inquiry; | ||
| 4 | 4 | ||
| 5 | use App\Models\Base; | 5 | use App\Models\Base; |
| 6 | use Illuminate\Database\Eloquent\SoftDeletes; | 6 | use Illuminate\Database\Eloquent\SoftDeletes; |
| 7 | +use Illuminate\Support\Facades\DB; | ||
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| 9 | * Class InquiryFormData | 10 | * Class InquiryFormData |
| @@ -26,4 +27,32 @@ class InquiryFormData extends Base | @@ -26,4 +27,32 @@ class InquiryFormData extends Base | ||
| 26 | { | 27 | { |
| 27 | return json_decode($value, true); | 28 | return json_decode($value, true); |
| 28 | } | 29 | } |
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 非默认表单的数量统计 | ||
| 33 | + * @author zbj | ||
| 34 | + * @date 2023/12/12 | ||
| 35 | + */ | ||
| 36 | + public static function getCount($submit_at = []){ | ||
| 37 | + return self::leftjoin('gl_inquiry_form', 'gl_inquiry_form.id', '=', 'gl_inquiry_form_data.form_id') | ||
| 38 | + ->where('gl_inquiry_form.is_default', 0) | ||
| 39 | + ->when($submit_at, function ($query, $submit_at) { | ||
| 40 | + $query->whereBetween('submit_at',[$submit_at[0], $submit_at[1]]); | ||
| 41 | + }) | ||
| 42 | + ->count(); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + /** | ||
| 46 | + * 非默认表单的国家统计 | ||
| 47 | + * @author zbj | ||
| 48 | + * @date 2023/12/12 | ||
| 49 | + */ | ||
| 50 | + public static function getCountryCount($submit_at = []){ | ||
| 51 | + return self::leftjoin('gl_inquiry_form', 'gl_inquiry_form.id', '=', 'gl_inquiry_form_data.form_id') | ||
| 52 | + ->where('gl_inquiry_form.is_default', 0) | ||
| 53 | + ->when($submit_at, function ($query, $submit_at) { | ||
| 54 | + $query->whereBetween('submit_at',[$submit_at[0], $submit_at[1]]); | ||
| 55 | + }) | ||
| 56 | + ->select("country",DB::raw('COUNT(*) as count'))->groupBy('country')->get()->toArray(); | ||
| 57 | + } | ||
| 29 | } | 58 | } |
| @@ -176,6 +176,7 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -176,6 +176,7 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 176 | Route::any('/saveOtherProject', [Aside\Project\ProjectController::class, 'saveOtherProject'])->name('admin.project_saveOtherProject');//其他项目设置 | 176 | Route::any('/saveOtherProject', [Aside\Project\ProjectController::class, 'saveOtherProject'])->name('admin.project_saveOtherProject');//其他项目设置 |
| 177 | Route::any('/getOtherProject', [Aside\Project\ProjectController::class, 'getOtherProject'])->name('admin.project_getOtherProject');//获取其他项目设置 | 177 | Route::any('/getOtherProject', [Aside\Project\ProjectController::class, 'getOtherProject'])->name('admin.project_getOtherProject');//获取其他项目设置 |
| 178 | Route::any('/getChannel', [Aside\Project\ProjectController::class, 'getChannel'])->name('admin.project_getChannel');//其他项目设置 | 178 | Route::any('/getChannel', [Aside\Project\ProjectController::class, 'getChannel'])->name('admin.project_getChannel');//其他项目设置 |
| 179 | + Route::any('/languageLists', [Aside\Project\ProjectController::class, 'languageLists'])->name('admin.project_languageLists');//其他项目设置 | ||
| 179 | //获取关键词前缀和后缀 | 180 | //获取关键词前缀和后缀 |
| 180 | Route::prefix('keyword')->group(function () { | 181 | Route::prefix('keyword')->group(function () { |
| 181 | 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'); |
-
请 注册 或 登录 后发表评论