作者 lyh

gx脚本

@@ -123,7 +123,7 @@ class AiBlogAuthorTask extends Command @@ -123,7 +123,7 @@ class AiBlogAuthorTask extends Command
123 'description'=>$v['description'], 123 'description'=>$v['description'],
124 ]; 124 ];
125 $id = $aiBlogAuthorModel->addReturnId($param); 125 $id = $aiBlogAuthorModel->addReturnId($param);
126 - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 126 + $route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id);
127 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); 127 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]);
128 } 128 }
129 } 129 }
@@ -16,13 +16,16 @@ use App\Models\HomeCount\Count; @@ -16,13 +16,16 @@ use App\Models\HomeCount\Count;
16 use App\Models\News\News; 16 use App\Models\News\News;
17 use App\Models\Product\Product; 17 use App\Models\Product\Product;
18 use App\Models\Project\Project; 18 use App\Models\Project\Project;
  19 +use App\Models\ProjectAssociation\ProjectAssociation;
19 use App\Models\RankData\ExternalLinks; 20 use App\Models\RankData\ExternalLinks;
20 use App\Models\RankData\RankData; 21 use App\Models\RankData\RankData;
21 use App\Models\RankData\RankWeek; 22 use App\Models\RankData\RankWeek;
  23 +use App\Models\Workchat\MessagePush;
22 use App\Services\ProjectServer; 24 use App\Services\ProjectServer;
23 use Carbon\Carbon; 25 use Carbon\Carbon;
24 use Illuminate\Console\Command; 26 use Illuminate\Console\Command;
25 use Illuminate\Support\Facades\DB; 27 use Illuminate\Support\Facades\DB;
  28 +use Illuminate\Support\Facades\Log;
26 29
27 class WeekProject extends Command 30 class WeekProject extends Command
28 { 31 {
@@ -97,8 +100,10 @@ class WeekProject extends Command @@ -97,8 +100,10 @@ class WeekProject extends Command
97 $data['keyword_ten_num'] = $rankInfo['first_ten_pages_num'] ?? 0; 100 $data['keyword_ten_num'] = $rankInfo['first_ten_pages_num'] ?? 0;
98 $productModel = new Product(); 101 $productModel = new Product();
99 $data['product_num'] = $productModel->counts(['status'=>1]) ?? 0; 102 $data['product_num'] = $productModel->counts(['status'=>1]) ?? 0;
  103 + $data['week_product_num'] = $productModel->counts(['status'=>1,'created_at'=>['between',[$startOfLastWeek,$endOfLastWeek]]]) ?? 0;
100 $newsModel = new News(); 104 $newsModel = new News();
101 $data['news_num'] = $newsModel->counts(['status'=>1]) ?? 0; 105 $data['news_num'] = $newsModel->counts(['status'=>1]) ?? 0;
  106 + $data['week_news_num'] = $newsModel->counts(['status'=>1,'created_at'=>['between',[$startOfLastWeek,$endOfLastWeek]]]) ?? 0;
102 $blogModel = new Blog(); 107 $blogModel = new Blog();
103 $data['blog_num'] = $blogModel->counts(['status'=>1]) ?? 0; 108 $data['blog_num'] = $blogModel->counts(['status'=>1]) ?? 0;
104 $notifyModel = new Notify(); 109 $notifyModel = new Notify();
@@ -117,4 +122,81 @@ class WeekProject extends Command @@ -117,4 +122,81 @@ class WeekProject extends Command
117 $v6WeeklyReportModel->add($data); 122 $v6WeeklyReportModel->add($data);
118 return true; 123 return true;
119 } 124 }
  125 +
  126 + /**
  127 + * @remark :推送消息
  128 + * @name :workChatMessage
  129 + * @author :lyh
  130 + * @method :post
  131 + * @time :2025/2/26 10:15
  132 + */
  133 + public function workChatMessage($data,$project_id){
  134 + //项目是否有绑定群
  135 + $friend_id = ProjectAssociation::where('project_id', $project_id)
  136 + ->where('status', ProjectAssociation::STATUS_NORMAL)
  137 + ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
  138 + ->value('friend_id');
  139 + if(!$friend_id){
  140 + echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL;
  141 + return false;
  142 + }
  143 + $content1 = '';
  144 + if(!empty($data['inquiry_total'])){
  145 + $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';
  146 + if(!empty($data['week_inquiry_total'])){
  147 + $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';
  148 + }
  149 + if(!empty($data['inquiry_country'])){
  150 + $data['inquiry_country'] = json_decode($data['inquiry_country']);
  151 + arsort($data);
  152 + $data['inquiry_country'] = array_slice($data, 0, 4, true);
  153 + $country = '';
  154 + foreach ($data['inquiry_country'] as $k => $v){
  155 + $country .= $k.'、';
  156 + };
  157 + trim($country,'、');
  158 + $content1 = '询盘主要来源于'.$country.'等国家地区';
  159 + }
  160 + $content1 .= '如有高质量客户,请您密切关注与跟进;';
  161 + }
  162 + $content2 = '';
  163 + if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){
  164 + $content2 .= '项目截止目前';
  165 + if(!empty($data['google_indexed_num'])){
  166 + $content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,';
  167 + }
  168 + if(!empty($data['google_links_num'])){
  169 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  170 + }
  171 + if(!empty($data['keyword_home_num'])){
  172 + $content2 .= '谷歌搜索排名首页关键词数量为:'.$data['keyword_home_num'].'个,';
  173 + }
  174 + if(!empty($data['keyword_three_num'])){
  175 + $content2 .= '前三页关键词数量为:'.$data['keyword_three_num'].'个,';
  176 + }
  177 + if(!empty($data['keyword_five_num'])){
  178 + $content2 .= '前五页关键词数量为:'.$data['keyword_five_num'].'个,';
  179 + }
  180 + if(!empty($data['keyword_ten_num'])){
  181 + $content2 .= '前十页关键词数量为:'.$data['keyword_ten_num'].'个,';
  182 + }
  183 + if(!empty($data['daily_average_num'])){
  184 + $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';
  185 + }
  186 + $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
  187 + }
  188 + $content3 = '';
  189 + if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){
  190 +
  191 + }
  192 + $param = [
  193 + 'project_id'=>$project_id,
  194 + 'friend_id'=>$friend_id,
  195 + 'type'=>MessagePush::TYPE_WEEK,
  196 + 'content'=>'',
  197 + ];
  198 + //写入一条推送消息 自动消费
  199 + $messagePushModel = new MessagePush();
  200 +
  201 + }
120 } 202 }
@@ -64,7 +64,9 @@ class AiBlogController extends BaseController @@ -64,7 +64,9 @@ class AiBlogController extends BaseController
64 if(!empty($lists) && !empty($lists['list'])){ 64 if(!empty($lists) && !empty($lists['list'])){
65 foreach ($lists['list'] as $k => $v){ 65 foreach ($lists['list'] as $k => $v){
66 $v['image'] = getImageUrl($v['image']); 66 $v['image'] = getImageUrl($v['image']);
67 - $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route']; 67 + if(!empty($v['route'])){
  68 + $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route'];
  69 + }
68 $lists['list'][$k] = $v; 70 $lists['list'][$k] = $v;
69 } 71 }
70 } 72 }
@@ -171,7 +173,9 @@ class AiBlogController extends BaseController @@ -171,7 +173,9 @@ class AiBlogController extends BaseController
171 $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']); 173 $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']);
172 if(!empty($lists) && !empty($lists['list'])){ 174 if(!empty($lists) && !empty($lists['list'])){
173 foreach ($lists['list'] as $k => $v){ 175 foreach ($lists['list'] as $k => $v){
174 - $v['route'] = $this->user['test_domain'] . 'top-blog/' . $v['route']; 176 + if(!empty($v['route'])){
  177 + $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route'];
  178 + }
175 $lists['list'][$k] = $v; 179 $lists['list'][$k] = $v;
176 } 180 }
177 } 181 }
@@ -60,11 +60,15 @@ class WebSettingTextLogic extends BaseLogic @@ -60,11 +60,15 @@ class WebSettingTextLogic extends BaseLogic
60 DB::beginTransaction(); 60 DB::beginTransaction();
61 try { 61 try {
62 //更新描文本设置 62 //更新描文本设置
  63 + if($this->param['anchor_is_enable'] == 0){
  64 + $this->param['anchor_keyword_is_enable'] = 0;
  65 + }
63 $data = [ 66 $data = [
64 'anchor_setting'=>$this->param['anchor_setting'], 67 'anchor_setting'=>$this->param['anchor_setting'],
65 'anchor_is_enable'=>$this->param['anchor_is_enable'], 68 'anchor_is_enable'=>$this->param['anchor_is_enable'],
66 'anchor_num'=>$this->param['anchor_num'] ?? 0, 69 'anchor_num'=>$this->param['anchor_num'] ?? 0,
67 - 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0 70 + 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0,
  71 + 'anchor_keyword_is_enable'=>$this->param['anchor_keyword_is_enable'] ?? 0
68 ]; 72 ];
69 $web_setting->edit($data,['project_id'=>$this->user['project_id']]); 73 $web_setting->edit($data,['project_id'=>$this->user['project_id']]);
70 $this->model->del(['project_id'=>$this->user['project_id']]); 74 $this->model->del(['project_id'=>$this->user['project_id']]);
@@ -25,7 +25,7 @@ class MessagePush extends Base @@ -25,7 +25,7 @@ class MessagePush extends Base
25 const STATUS_ERROR = 9; 25 const STATUS_ERROR = 9;
26 26
27 const TYPE_INQUIRY = 'inquiry'; 27 const TYPE_INQUIRY = 'inquiry';
28 - 28 + const TYPE_WEEK = 'week';
29 //设置关联表名 29 //设置关联表名
30 /** 30 /**
31 * @var mixed 31 * @var mixed