Merge remote-tracking branch 'origin/master' into akun
正在显示
14 个修改的文件
包含
277 行增加
和
17 行删除
app/Console/Commands/Inquiry/SyncAdCost.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\Inquiry; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\Inquiry\ReInquiryCost; | ||
| 7 | +use App\Utils\HttpUtils; | ||
| 8 | +use GuzzleHttp\Exception\GuzzleException; | ||
| 9 | +use Illuminate\Console\Command; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * Class SyncAdCost | ||
| 13 | + * @package App\Console\Commands\Inquiry | ||
| 14 | + */ | ||
| 15 | +class SyncAdCost extends Command | ||
| 16 | +{ | ||
| 17 | + /** | ||
| 18 | + * The name and signature of the console command. | ||
| 19 | + * | ||
| 20 | + * @var string | ||
| 21 | + */ | ||
| 22 | + protected $signature = 'sync_ad_cost'; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * The console command description. | ||
| 26 | + * | ||
| 27 | + * @var string | ||
| 28 | + */ | ||
| 29 | + protected $description = '同步广告费用'; | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Create a new command instance. | ||
| 33 | + * | ||
| 34 | + * @return void | ||
| 35 | + */ | ||
| 36 | + public function __construct() | ||
| 37 | + { | ||
| 38 | + parent::__construct(); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * @author zbj | ||
| 43 | + * @date 2024/12/4 | ||
| 44 | + */ | ||
| 45 | + public function handle() | ||
| 46 | + { | ||
| 47 | + $list = $this->getAdCost(); | ||
| 48 | + foreach ($list as $item) { | ||
| 49 | + ReInquiryCost::saveData($item['ad_id'], $item['spend'], $item['lead'], $item['single_cost'], $item['start_date'], $item['end_date']); | ||
| 50 | + } | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * 获取远程询盘信息 | ||
| 55 | + * @return array | ||
| 56 | + * @throws \GuzzleHttp\Exception\GuzzleException | ||
| 57 | + */ | ||
| 58 | + public function getAdCost() | ||
| 59 | + { | ||
| 60 | + try { | ||
| 61 | + $res = HttpUtils::get('https://fob.ai.cc/api/fb_ad_cost', []); | ||
| 62 | + $res = Arr::s2a($res); | ||
| 63 | + } catch (\Exception | GuzzleException $e) { | ||
| 64 | + $this->output($e->getMessage()); | ||
| 65 | + return []; | ||
| 66 | + } | ||
| 67 | + return $res['data']?? []; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + | ||
| 71 | + public function output($message) | ||
| 72 | + { | ||
| 73 | + echo date('Y-m-d H:i:s') . ' | ' . $message . PHP_EOL; | ||
| 74 | + } | ||
| 75 | +} |
| @@ -56,7 +56,7 @@ class WeekProject extends Command | @@ -56,7 +56,7 @@ class WeekProject extends Command | ||
| 56 | $this->weekData($v); | 56 | $this->weekData($v); |
| 57 | DB::disconnect('custom_mysql'); | 57 | DB::disconnect('custom_mysql'); |
| 58 | } | 58 | } |
| 59 | - echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; | 59 | + echo date('Y-m-d H:i:s') . 'end:' . PHP_EOL; |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | /** | 62 | /** |
| @@ -77,14 +77,14 @@ class WeekProject extends Command | @@ -77,14 +77,14 @@ class WeekProject extends Command | ||
| 77 | // 上一周的结束时间(周日 23:59:59) | 77 | // 上一周的结束时间(周日 23:59:59) |
| 78 | $endOfLastWeek = strtotime("last week sunday 23:59:59"); | 78 | $endOfLastWeek = strtotime("last week sunday 23:59:59"); |
| 79 | // 格式化为日期时间字符串 | 79 | // 格式化为日期时间字符串 |
| 80 | - $startOfLastWeekFormatted = date('Y-m-d', $startOfLastWeek); | ||
| 81 | - $endOfLastWeekFormatted = date('Y-m-d', $endOfLastWeek); | 80 | + $data['start_date'] = $startOfLastWeekFormatted = date('Y-m-d', $startOfLastWeek); |
| 81 | + $data['end_date'] = $endOfLastWeekFormatted = date('Y-m-d', $endOfLastWeek); | ||
| 82 | $countModel = new Count(); | 82 | $countModel = new Count(); |
| 83 | $startOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num','country']); | 83 | $startOfLastWeekFormattedInfo = $countModel->read(['date'=>$startOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num','country']); |
| 84 | - $endOfLastWeekFormattedInfo = $countModel->read(['date'=>$endOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num']); | ||
| 85 | - $data['inquiry_total'] = $startOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘数量 | ||
| 86 | - $data['inquiry_country'] = $startOfLastWeekFormattedInfo['country'] ?? json_encode([]); | ||
| 87 | - $data['week_inquiry_total'] = ($startOfLastWeekFormattedInfo['inquiry_num'] ?? 0) - ($endOfLastWeekFormattedInfo['inquiry_num'] ?? 0); | 84 | + $endOfLastWeekFormattedInfo = $countModel->read(['date'=>$endOfLastWeekFormatted,'project_id'=>$value['id']],['inquiry_num','country']); |
| 85 | + $data['inquiry_total'] = $endOfLastWeekFormattedInfo['inquiry_num'] ?? 0;//询盘数量 | ||
| 86 | + $data['inquiry_country'] = $endOfLastWeekFormattedInfo['country'] ?? json_encode([]); | ||
| 87 | + $data['week_inquiry_total'] = ($endOfLastWeekFormattedInfo['inquiry_num'] ?? 0) - ($startOfLastWeekFormattedInfo['inquiry_num'] ?? 0); | ||
| 88 | $rankDataModel = new RankData(); | 88 | $rankDataModel = new RankData(); |
| 89 | $rankInfo = $rankDataModel->read(['project_id'=>$value['id'],'lang'=>''],['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num','indexed_pages_num']); | 89 | $rankInfo = $rankDataModel->read(['project_id'=>$value['id'],'lang'=>''],['first_num','first_page_num','first_three_pages_num','first_five_pages_num','first_ten_pages_num','indexed_pages_num']); |
| 90 | $data['google_indexed_num'] = $rankInfo['indexed_pages_num'] ?? 0; | 90 | $data['google_indexed_num'] = $rankInfo['indexed_pages_num'] ?? 0; |
| @@ -108,7 +108,8 @@ class WeekProject extends Command | @@ -108,7 +108,8 @@ class WeekProject extends Command | ||
| 108 | $data['aggregation_minor_update_num'] = $notifyModel->counts(['type'=>2,'route'=>4,'project_id'=>$value['id']]) ?? 0; | 108 | $data['aggregation_minor_update_num'] = $notifyModel->counts(['type'=>2,'route'=>4,'project_id'=>$value['id']]) ?? 0; |
| 109 | //日均访问量 | 109 | //日均访问量 |
| 110 | $data['daily_average_num'] = 0; | 110 | $data['daily_average_num'] = 0; |
| 111 | - $pv_num_count = $countModel->whereBetween('date', [$startOfLastWeekFormatted,$endOfLastWeekFormattedInfo])->sum('pv_num'); | 111 | + $pv_num_count = $countModel->where('project_id',$value['id'])->whereBetween('date', [$startOfLastWeekFormatted,$endOfLastWeekFormatted])->sum('pv_num'); |
| 112 | + echo date('Y-m-d H:i:s') . 'pv总量:'.$pv_num_count . PHP_EOL; | ||
| 112 | if($pv_num_count != 0){ | 113 | if($pv_num_count != 0){ |
| 113 | $data['daily_average_num'] = round($pv_num_count / 7,2); | 114 | $data['daily_average_num'] = round($pv_num_count / 7,2); |
| 114 | } | 115 | } |
| @@ -42,6 +42,8 @@ class Kernel extends ConsoleKernel | @@ -42,6 +42,8 @@ class Kernel extends ConsoleKernel | ||
| 42 | $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); | 42 | $schedule->command('updateAiProjects')->everyFourHours()->withoutOverlapping(1); |
| 43 | //每日同步询盘文案 | 43 | //每日同步询盘文案 |
| 44 | $schedule->command('sync_inquiry_text')->dailyAt('09:00')->withoutOverlapping(1); | 44 | $schedule->command('sync_inquiry_text')->dailyAt('09:00')->withoutOverlapping(1); |
| 45 | + //FB询盘费用同步 | ||
| 46 | + $schedule->command('sync_ad_cost')->everyThirtyMinutes()->withoutOverlapping(1); | ||
| 45 | } | 47 | } |
| 46 | 48 | ||
| 47 | /** | 49 | /** |
| @@ -88,7 +88,7 @@ class BaseController extends Controller | @@ -88,7 +88,7 @@ class BaseController extends Controller | ||
| 88 | break; | 88 | break; |
| 89 | case "end_at": | 89 | case "end_at": |
| 90 | $this->_btw[1] = $v; | 90 | $this->_btw[1] = $v; |
| 91 | - $this->map['updated_at'] = ['between', $this->_btw]; | 91 | + $this->map['created_at'] = ['between', $this->_btw]; |
| 92 | break; | 92 | break; |
| 93 | default: | 93 | default: |
| 94 | if ($v != null) { | 94 | if ($v != null) { |
| @@ -13,9 +13,74 @@ use App\Enums\Common\Code; | @@ -13,9 +13,74 @@ use App\Enums\Common\Code; | ||
| 13 | use App\Http\Controllers\Aside\BaseController; | 13 | use App\Http\Controllers\Aside\BaseController; |
| 14 | use App\Models\Manage\LoginLog; | 14 | use App\Models\Manage\LoginLog; |
| 15 | use App\Models\Manage\Manage; | 15 | use App\Models\Manage\Manage; |
| 16 | +use App\Models\Manage\ManageLog; | ||
| 17 | +use App\Models\User\User; | ||
| 18 | +use App\Models\User\UserLog; | ||
| 16 | 19 | ||
| 17 | class ManagerLogController extends BaseController | 20 | class ManagerLogController extends BaseController |
| 18 | { | 21 | { |
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * @remark :管理员操作日志 | ||
| 25 | + * @name :log | ||
| 26 | + * @author :lyh | ||
| 27 | + * @method :post | ||
| 28 | + * @time :2024/12/4 16:51 | ||
| 29 | + */ | ||
| 30 | + public function logList(ManageLog $manageLog){ | ||
| 31 | + $managerModel = new Manage(); | ||
| 32 | + if(isset($this->map['name']) && !empty($this->map['name'])){ | ||
| 33 | + $ids = $managerModel->where('name', 'like', '%' . $this->param['name'] . '%')->pluck('id')->toArray(); | ||
| 34 | + $this->map['manage_id'] = ['in',$ids]; | ||
| 35 | + unset($this->map['name']); | ||
| 36 | + } | ||
| 37 | + if(isset($this->map['url']) && !empty($this->map['url'])){ | ||
| 38 | + $this->map['url'] = ['like','%'.$this->map['url'].'%']; | ||
| 39 | + } | ||
| 40 | + if(isset($this->map['ip']) && !empty($this->map['ip'])){ | ||
| 41 | + $this->map['ip'] = ['like','%'.$this->map['ip'].'%']; | ||
| 42 | + } | ||
| 43 | + $lists = $manageLog->lists($this->map,$this->page,$this->row,$this->order); | ||
| 44 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 45 | + foreach ($lists['list'] as $k => $v){ | ||
| 46 | + $v['name'] = $managerModel->getName($v['manage_id']); | ||
| 47 | + $lists['list'][$k] = $v; | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /** | ||
| 54 | + * @remark :v6操作日志 | ||
| 55 | + * @name :UserLogList | ||
| 56 | + * @author :lyh | ||
| 57 | + * @method :post | ||
| 58 | + * @time :2024/12/4 17:37 | ||
| 59 | + */ | ||
| 60 | + public function userLogList(UserLog $userLogModel){ | ||
| 61 | + $userModel = new User(); | ||
| 62 | + if(isset($this->map['name']) && !empty($this->map['name'])){ | ||
| 63 | + $ids = $userModel->where('name', 'like', '%' . $this->param['name'] . '%')->pluck('id')->toArray(); | ||
| 64 | + $this->map['operator_id'] = ['in',$ids]; | ||
| 65 | + unset($this->map['name']); | ||
| 66 | + } | ||
| 67 | + if(isset($this->map['model']) && !empty($this->map['model'])){ | ||
| 68 | + $this->map['model'] = ['like','%'.$this->map['model'].'%']; | ||
| 69 | + } | ||
| 70 | + if(isset($this->map['remark']) && !empty($this->map['remark'])){ | ||
| 71 | + $this->map['remark'] = ['like','%'.$this->map['remark'].'%']; | ||
| 72 | + } | ||
| 73 | + $lists = $userLogModel->lists($this->map,$this->page,$this->row,$this->order); | ||
| 74 | + if(!empty($lists) && !empty($lists['list'])){ | ||
| 75 | + $userModel = new User(); | ||
| 76 | + foreach ($lists['list'] as $k => $v){ | ||
| 77 | + $v['name'] = $userModel->getName($v['operator_id']); | ||
| 78 | + $lists['list'][$k] = $v; | ||
| 79 | + } | ||
| 80 | + } | ||
| 81 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 82 | + } | ||
| 83 | + | ||
| 19 | /** | 84 | /** |
| 20 | * @remark :管理员日志列表 | 85 | * @remark :管理员日志列表 |
| 21 | * @name :lists | 86 | * @name :lists |
| @@ -510,6 +510,10 @@ class OptimizeController extends BaseController | @@ -510,6 +510,10 @@ class OptimizeController extends BaseController | ||
| 510 | 'is_minor_languages.required' => '项目is_minor_languages不能为空', | 510 | 'is_minor_languages.required' => '项目is_minor_languages不能为空', |
| 511 | ]); | 511 | ]); |
| 512 | $projectModel = new Project(); | 512 | $projectModel = new Project(); |
| 513 | + $info = $projectModel->read(['id'=>$this->param['id']],['main_lang_id']); | ||
| 514 | + if($info['main_lang_id'] != 1){ | ||
| 515 | + $this->fail('当前主语种不允许操作小语种监控配置'); | ||
| 516 | + } | ||
| 513 | $projectModel->edit(['is_minor_languages'=>$this->param['is_minor_languages']],['id'=>$this->param['id']]); | 517 | $projectModel->edit(['is_minor_languages'=>$this->param['is_minor_languages']],['id'=>$this->param['id']]); |
| 514 | $this->response('success'); | 518 | $this->response('success'); |
| 515 | } | 519 | } |
| @@ -13,6 +13,7 @@ use App\Helper\QuanqiusouApi; | @@ -13,6 +13,7 @@ use App\Helper\QuanqiusouApi; | ||
| 13 | use App\Http\Controllers\Aside\BaseController; | 13 | use App\Http\Controllers\Aside\BaseController; |
| 14 | use App\Models\Channel\Channel; | 14 | use App\Models\Channel\Channel; |
| 15 | use App\Models\Domain\DomainInfo; | 15 | use App\Models\Domain\DomainInfo; |
| 16 | +use App\Models\Inquiry\ReInquiryCost; | ||
| 16 | use App\Models\Inquiry\ReInquiryCount; | 17 | use App\Models\Inquiry\ReInquiryCount; |
| 17 | use App\Models\Inquiry\ReInquiryDetail; | 18 | use App\Models\Inquiry\ReInquiryDetail; |
| 18 | use App\Models\Inquiry\ReInquiryForm; | 19 | use App\Models\Inquiry\ReInquiryForm; |
| @@ -57,15 +58,21 @@ class AdsController extends BaseController | @@ -57,15 +58,21 @@ class AdsController extends BaseController | ||
| 57 | } | 58 | } |
| 58 | }) | 59 | }) |
| 59 | ->orderBy('id', 'desc') | 60 | ->orderBy('id', 'desc') |
| 60 | - ->paginate($page_size); | 61 | + ->paginate($page_size) |
| 62 | + ->toArray(); | ||
| 61 | 63 | ||
| 62 | $relay_site_total = 0; | 64 | $relay_site_total = 0; |
| 63 | - foreach ($result as &$item){ | ||
| 64 | - $relay_site_total += count($item->target); | ||
| 65 | - $item->requiry_num = ReInquiryDetail::where('task_id', $item->id)->where('status', ReInquiryDetail::STATUS_SUCCESS)->count(); | ||
| 66 | - $item->form_num = ReInquiryForm::whereIn('ad_id', explode(',', $item->ad_id))->count(); | 65 | + foreach ($result['list'] as &$item){ |
| 66 | + $relay_site_total += count($item['target']); | ||
| 67 | + $item['requiry_num'] = ReInquiryDetail::where('task_id', $item['id'])->where('status', ReInquiryDetail::STATUS_SUCCESS)->count(); | ||
| 68 | + $item['form_num'] = ReInquiryForm::whereIn('ad_id', explode(',', $item['ad_id']))->count(); | ||
| 69 | + //关联网站是否有重复的 | ||
| 70 | + foreach ($item['target'] as $k=>$target){ | ||
| 71 | + $repeat = ReInquiryTask::where('target', 'like', '%'.$target['url'].'%')->where('id', '<>', $item['id'])->first(); | ||
| 72 | + $item['target'][$k]['is_repeat'] = $repeat ? 1 : 0; | ||
| 73 | + } | ||
| 74 | + $item['cost'] = ReInquiryCost::getCostByAdIds($item['ad_id']); | ||
| 67 | } | 75 | } |
| 68 | - $result = $result->toArray(); | ||
| 69 | $result['relay_site_total'] = $relay_site_total; | 76 | $result['relay_site_total'] = $relay_site_total; |
| 70 | $result['default_ai_param'] = ReInquiryTask::DEFAULT_AI_PARAM; | 77 | $result['default_ai_param'] = ReInquiryTask::DEFAULT_AI_PARAM; |
| 71 | 78 |
| @@ -41,7 +41,9 @@ class OperationHeartbeatController extends BaseController | @@ -41,7 +41,9 @@ class OperationHeartbeatController extends BaseController | ||
| 41 | 'is_custom.required' => '是否为扩展模版', | 41 | 'is_custom.required' => '是否为扩展模版', |
| 42 | 'is_template.required' => '详情页/可视化', | 42 | 'is_template.required' => '详情页/可视化', |
| 43 | ]); | 43 | ]); |
| 44 | - | 44 | + if(empty($this->param['source_id'])){ |
| 45 | + $this->response('success'); | ||
| 46 | + } | ||
| 45 | $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], | 47 | $condition = ['project_id'=>$this->user['project_id'],'source'=>$this->param['source'],'source_id'=>$this->param['source_id'], |
| 46 | 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']]; | 48 | 'is_list'=>$this->param['is_list'],'is_custom'=>$this->param['is_custom'],'is_template'=>$this->param['is_template']]; |
| 47 | $operationHeartbeatModel = new OperationHeartbeat(); | 49 | $operationHeartbeatModel = new OperationHeartbeat(); |
| @@ -279,4 +279,16 @@ class KeywordController extends BaseController | @@ -279,4 +279,16 @@ class KeywordController extends BaseController | ||
| 279 | $logic->delRelated($this->param['keyword_id'],$this->param['product_id']); | 279 | $logic->delRelated($this->param['keyword_id'],$this->param['product_id']); |
| 280 | $this->response('success'); | 280 | $this->response('success'); |
| 281 | } | 281 | } |
| 282 | + | ||
| 283 | + /** | ||
| 284 | + * @remark :清除当前项目所有关键字 | ||
| 285 | + * @name :delAllKeyword | ||
| 286 | + * @author :lyh | ||
| 287 | + * @method :post | ||
| 288 | + * @time :2024/12/5 16:34 | ||
| 289 | + */ | ||
| 290 | + public function delAllKeyword(KeywordLogic $logic){ | ||
| 291 | + $logic->delAllKeyword(); | ||
| 292 | + $this->response('success'); | ||
| 293 | + } | ||
| 282 | } | 294 | } |
| @@ -313,7 +313,11 @@ class KeywordLogic extends BaseLogic | @@ -313,7 +313,11 @@ class KeywordLogic extends BaseLogic | ||
| 313 | $productIdArr = $keywordRelatedModel->selectField(['keyword_id'=>$keyword_id],'product_id'); | 313 | $productIdArr = $keywordRelatedModel->selectField(['keyword_id'=>$keyword_id],'product_id'); |
| 314 | if(!empty($productIdArr)){ | 314 | if(!empty($productIdArr)){ |
| 315 | $productModel = new Product(); | 315 | $productModel = new Product(); |
| 316 | - $productList = $productModel->list(['id'=>['in',$productIdArr]],['id','title']); | 316 | + $productList = $productModel->list(['id'=>['in',$productIdArr]],['id','title','route']); |
| 317 | + foreach ($productList as $k => $v){ | ||
| 318 | + $v['route'] = $this->user['domain'].$v['route']; | ||
| 319 | + $productList[$k] = $v; | ||
| 320 | + } | ||
| 317 | } | 321 | } |
| 318 | return $this->success($productList); | 322 | return $this->success($productList); |
| 319 | } | 323 | } |
| @@ -336,4 +340,31 @@ class KeywordLogic extends BaseLogic | @@ -336,4 +340,31 @@ class KeywordLogic extends BaseLogic | ||
| 336 | return $this->success(); | 340 | return $this->success(); |
| 337 | } | 341 | } |
| 338 | 342 | ||
| 343 | + /** | ||
| 344 | + * @remark :删除所有的关键字 | ||
| 345 | + * @name :delAllKeyword | ||
| 346 | + * @author :lyh | ||
| 347 | + * @method :post | ||
| 348 | + * @time :2024/12/5 15:37 | ||
| 349 | + */ | ||
| 350 | + public function delAllKeyword(){ | ||
| 351 | + DB::beginTransaction(); | ||
| 352 | + try { | ||
| 353 | + //截断关联表 | ||
| 354 | + KeywordRelated::truncate(); | ||
| 355 | + //截断关键词表 | ||
| 356 | + Keyword::truncate(); | ||
| 357 | + //清空产品表的keyword_id字段 | ||
| 358 | + $routeMapModel = new RouteMap(); | ||
| 359 | + $routeMapModel->del(['source'=>'product_keyword']); | ||
| 360 | + $productModel = new Product(); | ||
| 361 | + $productModel->edit(['keyword_id'=>''],['id'=>['>',0]]); | ||
| 362 | + DB::commit(); | ||
| 363 | + }catch (\Exception $e){ | ||
| 364 | + DB::rollBack(); | ||
| 365 | + $this->fail('操作失败,请联系管理员'); | ||
| 366 | + } | ||
| 367 | + return $this->success(); | ||
| 368 | + } | ||
| 369 | + | ||
| 339 | } | 370 | } |
app/Models/Inquiry/ReInquiryCost.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Inquiry; | ||
| 4 | + | ||
| 5 | +use App\Models\Base; | ||
| 6 | +use Illuminate\Support\Facades\Cache; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Class ReInquiryCost | ||
| 10 | + * @package App\Models\Inquiry | ||
| 11 | + * @author zbj | ||
| 12 | + * @date 2024/12/4 | ||
| 13 | + */ | ||
| 14 | +class ReInquiryCost extends Base | ||
| 15 | +{ | ||
| 16 | + | ||
| 17 | + //设置关联表名 | ||
| 18 | + /** | ||
| 19 | + * @var mixed | ||
| 20 | + */ | ||
| 21 | + protected $table = 'gl_re_inquiry_cost'; | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + public static function saveData($ad_id, $spend, $lead, $single_cost, $start_date, $end_date){ | ||
| 25 | + $cost = self::where('ad_id', $ad_id)->first(); | ||
| 26 | + if(!$cost){ | ||
| 27 | + $cost = new self(); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + $cost->ad_id = $ad_id; | ||
| 31 | + $cost->spend = $spend; | ||
| 32 | + $cost->lead = $lead; | ||
| 33 | + $cost->single_cost = $single_cost; | ||
| 34 | + $cost->start_date = $start_date; | ||
| 35 | + $cost->end_date = $end_date; | ||
| 36 | + $cost->save(); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public static function getCostByAdIds($ad_ids){ | ||
| 40 | + if(is_string($ad_ids)){ | ||
| 41 | + $ad_ids = explode(',',$ad_ids); | ||
| 42 | + } | ||
| 43 | + $cache_key = 'GET_COST_BY_AD_IDS_' . implode(',', $ad_ids); | ||
| 44 | + $data = Cache::get($cache_key); | ||
| 45 | + if(!$data){ | ||
| 46 | + $data = []; | ||
| 47 | + $list = self::whereIn('ad_id', $ad_ids)->get(); | ||
| 48 | + foreach ($list as $item){ | ||
| 49 | + $data['cost'][] = '$' . $item['spend']; | ||
| 50 | + $data['single_cost'][] = '$' . $item['single_cost']; | ||
| 51 | + } | ||
| 52 | + Cache::set($cache_key, $data); | ||
| 53 | + } | ||
| 54 | + return $data; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | +} |
| @@ -148,6 +148,8 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -148,6 +148,8 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 148 | //管理员日志 | 148 | //管理员日志 |
| 149 | Route::prefix('log')->group(function () { | 149 | Route::prefix('log')->group(function () { |
| 150 | Route::any('/', [Aside\Manage\ManagerLogController::class, 'lists'])->name('admin.manager_log_lists'); | 150 | Route::any('/', [Aside\Manage\ManagerLogController::class, 'lists'])->name('admin.manager_log_lists'); |
| 151 | + Route::any('/logList', [Aside\Manage\ManagerLogController::class, 'logList'])->name('admin.manager_log_logList'); | ||
| 152 | + Route::any('/userLogList', [Aside\Manage\ManagerLogController::class, 'userLogList'])->name('admin.manager_log_userLogList'); | ||
| 151 | }); | 153 | }); |
| 152 | }); | 154 | }); |
| 153 | 155 |
| @@ -282,6 +282,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -282,6 +282,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 282 | Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel'); | 282 | Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel'); |
| 283 | Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete'); | 283 | Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete'); |
| 284 | Route::any('keyword/delRelated', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delRelated'])->name('product_keyword_delRelated'); | 284 | Route::any('keyword/delRelated', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delRelated'])->name('product_keyword_delRelated'); |
| 285 | + Route::any('keyword/delAllKeyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delAllKeyword'])->name('product_keyword_delAllKeyword'); | ||
| 285 | Route::any('keyword/batchUpdateKeyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchUpdateKeyword'])->name('product_keyword_batchUpdateKeyword'); | 286 | Route::any('keyword/batchUpdateKeyword', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchUpdateKeyword'])->name('product_keyword_batchUpdateKeyword'); |
| 286 | Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo'); | 287 | Route::any('keyword/batchKeywordIsVideo', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordIsVideo'])->name('product_keyword_batchKeywordIsVideo'); |
| 287 | Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled'); | 288 | Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled'); |
-
请 注册 或 登录 后发表评论