作者 lyh

gx脚本

@@ -41,7 +41,7 @@ class DownloadProject extends Command @@ -41,7 +41,7 @@ class DownloadProject extends Command
41 41
42 public function handle(){ 42 public function handle(){
43 $v6WeekModel = new V6WeeklyReport(); 43 $v6WeekModel = new V6WeeklyReport();
44 - $lists = $v6WeekModel->list([],'id',['*'],'desc',100); 44 + $lists = $v6WeekModel->list(['id'=>1431],'id',['*'],'desc',100);
45 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 45 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
46 foreach ($lists as $data){ 46 foreach ($lists as $data){
47 $this->workChatMessage($data,$data['project_id']); 47 $this->workChatMessage($data,$data['project_id']);
@@ -218,7 +218,7 @@ class DownloadProject extends Command @@ -218,7 +218,7 @@ class DownloadProject extends Command
218 $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。'; 218 $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';
219 } 219 }
220 if(!empty($data['inquiry_country'])){ 220 if(!empty($data['inquiry_country'])){
221 - $data['inquiry_country'] = json_decode($data['inquiry_country'],true); 221 + $data['inquiry_country'] = json_decode($data['inquiry_country'],JSON_UNESCAPED_UNICODE);
222 arsort($data['inquiry_country']); 222 arsort($data['inquiry_country']);
223 $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true); 223 $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true);
224 $country = ''; 224 $country = '';
@@ -306,16 +306,19 @@ class DownloadProject extends Command @@ -306,16 +306,19 @@ class DownloadProject extends Command
306 } 306 }
307 $arr[] = $content4; 307 $arr[] = $content4;
308 foreach ($arr as $key => $val){ 308 foreach ($arr as $key => $val){
309 - $content .= ($key+1).','.$val."\n"; 309 + $content .= ($key+1).','.$val.PHP_EOL;
310 } 310 }
311 $timestamp = strtotime('tomorrow 9:00 AM'); 311 $timestamp = strtotime('tomorrow 9:00 AM');
312 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp); 312 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
313 $content = preg_replace('/[\x00-\x1F\x7F]/u', '', $content); 313 $content = preg_replace('/[\x00-\x1F\x7F]/u', '', $content);
  314 + if(empty($content)){
  315 + return true;
  316 + }
314 $param = [ 317 $param = [
315 'project_id'=>$project_id, 318 'project_id'=>$project_id,
316 'friend_id'=>17667, 319 'friend_id'=>17667,
317 'type'=>MessagePush::TYPE_WEEK, 320 'type'=>MessagePush::TYPE_WEEK,
318 - 'content'=>"【全球搜V6.0周报】--项目id:$project_id"."\n".$content, 321 + 'content'=>"【全球搜V6.0周报】--项目id:$project_id".PHP_EOL.$content,
319 'ref_ids'=>'', 322 'ref_ids'=>'',
320 'send_time'=>$tomorrowNineAM, 323 'send_time'=>$tomorrowNineAM,
321 'status'=>0, 324 'status'=>0,
@@ -259,6 +259,9 @@ class WeekProject extends Command @@ -259,6 +259,9 @@ class WeekProject extends Command
259 $timestamp = strtotime('tomorrow 9:00 AM'); 259 $timestamp = strtotime('tomorrow 9:00 AM');
260 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp); 260 $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
261 $content = preg_replace('/[\x00-\x1F\x7F]/u', '', $content); 261 $content = preg_replace('/[\x00-\x1F\x7F]/u', '', $content);
  262 + if(empty($content)){
  263 + return true;
  264 + }
262 $param = [ 265 $param = [
263 'project_id'=>$project_id, 266 'project_id'=>$project_id,
264 'friend_id'=>$friend_id, 267 'friend_id'=>$friend_id,