作者 Your Name
@@ -14,11 +14,8 @@ use Illuminate\Support\Facades\Config; @@ -14,11 +14,8 @@ use Illuminate\Support\Facades\Config;
14 use Illuminate\Support\Facades\Mail; 14 use Illuminate\Support\Facades\Mail;
15 15
16 /** 16 /**
17 - *  
18 * Class WorkchatMessageSend 17 * Class WorkchatMessageSend
19 - * @package App\Console\Commands  
20 - * @author zbj  
21 - * @date 2023/11/28 18 + * @package App\Console\Commands\Task
22 */ 19 */
23 class WorkchatMessageSend extends Command 20 class WorkchatMessageSend extends Command
24 { 21 {
@@ -56,20 +56,38 @@ class UpdateRoute extends Command @@ -56,20 +56,38 @@ class UpdateRoute extends Command
56 */ 56 */
57 public function handle(){ 57 public function handle(){
58 $projectModel = new Project(); 58 $projectModel = new Project();
59 - $list = $projectModel->list(['id'=>['in',[1646]]]); 59 + $list = $projectModel->list(['id'=>['in',[1799]]]);
60 $data = []; 60 $data = [];
61 foreach ($list as $v){ 61 foreach ($list as $v){
62 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 62 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
63 ProjectServer::useProject($v['id']); 63 ProjectServer::useProject($v['id']);
64 - $this->getProduct(); 64 +// $this->getProduct();
65 // $this->setProductKeyword(); 65 // $this->setProductKeyword();
66 // $this->getBlog(); 66 // $this->getBlog();
67 // $this->setCustomRoute($v['id']); 67 // $this->setCustomRoute($v['id']);
  68 + $this->editProductAlt();
68 DB::disconnect('custom_mysql'); 69 DB::disconnect('custom_mysql');
69 } 70 }
70 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 71 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
71 } 72 }
72 73
  74 + public function editProductAlt(){
  75 + $productModel = new Product();
  76 + $lists = $productModel->list(['status'=>1],'id',['id','route','thumb','gallery']);
  77 + foreach ($lists as $k => $v){
  78 + $v['thumb']['alt'] = $v['route'];
  79 + if(!empty($v['gallery'])){
  80 + foreach ($v['gallery'] as $keys => $values){
  81 + $values = (array)$values;
  82 + $values['alt'] = $v['route'];
  83 + $v['gallery'][$keys] = $values;
  84 + }
  85 + }
  86 + $productModel->edit(['thumb'=>$v['thumb'],'gallery'=>$v['gallery']],['id'=>$v['id']]);
  87 + }
  88 + return true;
  89 + }
  90 +
73 public function setCustomRoute($project_id){ 91 public function setCustomRoute($project_id){
74 $customModel = new CustomModuleContent(); 92 $customModel = new CustomModuleContent();
75 $list = $customModel->list(); 93 $list = $customModel->list();
@@ -33,7 +33,15 @@ class MessagePush extends Base @@ -33,7 +33,15 @@ class MessagePush extends Base
33 protected $table = 'gl_workchat_message_push'; 33 protected $table = 'gl_workchat_message_push';
34 34
35 35
36 - public static function addInquiryMessage($id, $project_id, $country, $submit_at){ 36 + /**
  37 + * @param $id
  38 + * @param $project_id
  39 + * @param $country
  40 + * @param $name
  41 + * @param $submit_at
  42 + * @return bool
  43 + */
  44 + public static function addInquiryMessage($id, $project_id, $country, $name, $submit_at){
37 if(!ProjectServer::useProject($project_id)){ 45 if(!ProjectServer::useProject($project_id)){
38 return false; 46 return false;
39 } 47 }
@@ -56,7 +64,7 @@ class MessagePush extends Base @@ -56,7 +64,7 @@ class MessagePush extends Base
56 $model->friend_id = $friend_id; 64 $model->friend_id = $friend_id;
57 $model->type = self::TYPE_INQUIRY; 65 $model->type = self::TYPE_INQUIRY;
58 $model->ref_ids = $id; 66 $model->ref_ids = $id;
59 - $model->content = '[' . date('H:i', strtotime($submit_at)) . '] 您的全球搜网站收到来自【' . $country . '】的询盘信息,请登录后台或APP进行查看!'; 67 + $model->content = '[' . date('H:i', strtotime($submit_at)) . '] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!';
60 }else{ 68 }else{
61 //定时发送时间 69 //定时发送时间
62 $send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime('+1 day')) : date('Y-m-d 09:00:00'); 70 $send_time = $hour >= 9 ? date('Y-m-d 09:00:00', strtotime('+1 day')) : date('Y-m-d 09:00:00');
@@ -69,7 +77,7 @@ class MessagePush extends Base @@ -69,7 +77,7 @@ class MessagePush extends Base
69 $model->type = self::TYPE_INQUIRY; 77 $model->type = self::TYPE_INQUIRY;
70 $model->ref_ids = $id; 78 $model->ref_ids = $id;
71 $model->send_time = $send_time; 79 $model->send_time = $send_time;
72 - $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . '】的询盘信息,请登录后台或APP进行查看!'; 80 + $model->content = '[09:00] 您的全球搜网站收到来自【' . $country . $name . '】的询盘信息,请登录后台或APP进行查看!';
73 }else{ 81 }else{
74 $ref_ids = explode(',', $model->ref_ids); 82 $ref_ids = explode(',', $model->ref_ids);
75 $ref_ids[] = $id; 83 $ref_ids[] = $id;
@@ -160,7 +160,8 @@ class SyncSubmitTaskService @@ -160,7 +160,8 @@ class SyncSubmitTaskService
160 160
161 //推送企微消息 161 //推送企微消息
162 try { 162 try {
163 - MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $data['submit_at']); 163 + $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name'];
  164 + MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']);
164 }catch (\Exception $e){ 165 }catch (\Exception $e){
165 LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage()); 166 LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage());
166 } 167 }