作者 lyh

gx脚本

... ... @@ -210,15 +210,6 @@ class DownloadProject extends Command
public function workChatMessage($data,$project_id){
$arr = [];
// //项目是否有绑定群
// $friend_id = ProjectAssociation::where('project_id', $project_id)
// ->where('status', ProjectAssociation::STATUS_NORMAL)
// ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
// ->value('friend_id');
// if(!$friend_id){
// echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL;
// return false;
// }
$content = '';
$content1 = '';
if(!empty($data['inquiry_total'])){
... ... @@ -227,7 +218,7 @@ class DownloadProject extends Command
$content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';
}
if(!empty($data['inquiry_country'])){
$data['inquiry_country'] = json_decode($data['inquiry_country']);
$data['inquiry_country'] = json_decode($data['inquiry_country'],true);
arsort($data['inquiry_country']);
$data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true);
$country = '';
... ... @@ -296,7 +287,7 @@ class DownloadProject extends Command
}
}
$content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
$data[] = $content3;
$arr[] = $content3;
$content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。';
if(!empty($data['main_update_num'])){
$content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';
... ... @@ -313,20 +304,24 @@ class DownloadProject extends Command
if(!empty($data['aggregation_minor_update_num'])){
$content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
}
$data[] = $content4;
$arr[] = $content4;
foreach ($data as $key => $val){
$content = $key.','.$val;
}
$timestamp = strtotime('tomorrow 9:00 AM');
$tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
// $param = [
// 'project_id'=>$project_id,
// 'friend_id'=>$friend_id,
// 'type'=>MessagePush::TYPE_WEEK,
// 'content'=>$content,
// 'ref_ids'=>'',
// 'send_time'=>$tomorrowNineAM
// ];
$param = [
'project_id'=>$project_id,
'friend_id'=>1,
'type'=>MessagePush::TYPE_WEEK,
'content'=>$content,
'ref_ids'=>'',
'send_time'=>$tomorrowNineAM,
'status'=>3,
];
//写入一条推送消息 自动消费
$messagePushModel = new MessagePush();
$messagePushModel->add($param);
echo date('Y-m-d H:i:s') . '数据:'. $content . PHP_EOL;
}
}
... ...
... ... @@ -52,7 +52,7 @@ class WeekProject extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']);
$list = $projectModel->list(['delete_status'=>0,'is_weekly_report'=>1,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']);
foreach ($list as $k => $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
ProjectServer::useProject($v['id']);
... ... @@ -120,6 +120,7 @@ class WeekProject extends Command
}
$v6WeeklyReportModel = new V6WeeklyReport();
$v6WeeklyReportModel->add($data);
$this->workChatMessage($data,$value['id']);
return true;
}
... ... @@ -141,7 +142,6 @@ class WeekProject extends Command
echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL;
return false;
}
$content = '';
$content1 = '';
if(!empty($data['inquiry_total'])){
$content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';
... ... @@ -157,7 +157,7 @@ class WeekProject extends Command
$country .= $k.'、';
};
trim($country,'、');
$content1 = '询盘主要来源于'.$country.'等国家地区';
$content1 .= '询盘主要来源于'.$country.'等国家地区';
}
$content1 .= '如有高质量客户,请您密切关注与跟进;';
}
... ... @@ -218,7 +218,7 @@ class WeekProject extends Command
}
}
$content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
$data[] = $content3;
$arr[] = $content3;
$content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。';
if(!empty($data['main_update_num'])){
$content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';
... ... @@ -235,9 +235,9 @@ class WeekProject extends Command
if(!empty($data['aggregation_minor_update_num'])){
$content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
}
$data[] = $content4;
foreach ($data as $key => $val){
$content = $key.','.$val;
$arr[] = $content4;
foreach ($arr as $key => $val){
$content = ($key + 1) .','.$val;
}
$timestamp = strtotime('tomorrow 9:00 AM');
$tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
... ...