Merge remote-tracking branch 'origin/master' into akun
正在显示
10 个修改的文件
包含
115 行增加
和
13 行删除
| @@ -36,16 +36,9 @@ class InitKeywordComment extends Command | @@ -36,16 +36,9 @@ class InitKeywordComment extends Command | ||
| 36 | public $number = 100; | 36 | public $number = 100; |
| 37 | 37 | ||
| 38 | public function handle(){ | 38 | public function handle(){ |
| 39 | - $projectModel = new Project(); | ||
| 40 | - $lists = $projectModel->list(['delete_status' => 0,'id'=>['<',1368],'project_type'=>0,'extend_type'=>0,'type'=>['in',[1,2,3,4,6]]], 'id', ['id']); | ||
| 41 | - foreach ($lists as $val) { | ||
| 42 | - echo date('Y-m-d H:i:s') . '开始--项目的id:' . $val['id'] . PHP_EOL; | ||
| 43 | - $this->_action($val['id']); | ||
| 44 | - } | ||
| 45 | - return true; | ||
| 46 | $keywordCommentModel = new AggregateKeywordComment(); | 39 | $keywordCommentModel = new AggregateKeywordComment(); |
| 47 | while (true){ | 40 | while (true){ |
| 48 | - $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMON)->where('status', NoticeLog::STATUS_PENDING)->get(); | 41 | + $list = NoticeLog::where('type', NoticeLog::TYPE_INIT_KEYWORD_COMMENT)->where('status', NoticeLog::STATUS_PENDING)->get(); |
| 49 | if(empty($list)){ | 42 | if(empty($list)){ |
| 50 | sleep(200); | 43 | sleep(200); |
| 51 | continue; | 44 | continue; |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\WorkOrder; | ||
| 4 | + | ||
| 5 | +use App\Models\ProjectAssociation\ProjectAssociation; | ||
| 6 | +use App\Models\Workchat\MessagePush; | ||
| 7 | +use App\Models\WorkOrder\Tickets; | ||
| 8 | +use Illuminate\Console\Command; | ||
| 9 | + | ||
| 10 | +class PushNotify extends Command | ||
| 11 | +{ | ||
| 12 | + /** | ||
| 13 | + * The name and signature of the console command. | ||
| 14 | + * | ||
| 15 | + * @var string | ||
| 16 | + */ | ||
| 17 | + protected $signature = 'workorder:push-notify'; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * The console command description. | ||
| 21 | + * | ||
| 22 | + * @var string | ||
| 23 | + */ | ||
| 24 | + protected $description = 'tickets push notify'; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Create a new command instance. | ||
| 28 | + * | ||
| 29 | + * @return void | ||
| 30 | + */ | ||
| 31 | + public function __construct() | ||
| 32 | + { | ||
| 33 | + parent::__construct(); | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * Execute the console command. | ||
| 38 | + * | ||
| 39 | + * @return int | ||
| 40 | + */ | ||
| 41 | + public function handle() | ||
| 42 | + { | ||
| 43 | + while (true) { | ||
| 44 | + try { | ||
| 45 | + $tick = Tickets::where('ding', 0) | ||
| 46 | + ->where('submit_side', 2) | ||
| 47 | +// ->where('project_id', 1) | ||
| 48 | + ->first(); | ||
| 49 | + if (!$tick) { | ||
| 50 | + echo now() . " WARNING | 没有待推送的工单\n"; | ||
| 51 | + sleep(3); | ||
| 52 | + continue; | ||
| 53 | + } | ||
| 54 | + $project = $tick->project; | ||
| 55 | + if ($project->version != 6 || $project->is_del == 1) { | ||
| 56 | + echo now() . " WARNING | 项目版本或状态异常 \n"; | ||
| 57 | + $tick->ding = 1; | ||
| 58 | + $tick->save(); | ||
| 59 | + continue; | ||
| 60 | + } | ||
| 61 | + $message_push = new MessagePush(); | ||
| 62 | + $message_push->project_id = $project->table_id; | ||
| 63 | + $message_push->friend_id = ProjectAssociation::where('project_id', $project->table_id) | ||
| 64 | + ->where('status', ProjectAssociation::STATUS_NORMAL) | ||
| 65 | + ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT) | ||
| 66 | + ->value('friend_id'); | ||
| 67 | + if (empty($message_push->friend_id)) | ||
| 68 | + { | ||
| 69 | + echo now() . " WARNING | 项目ID:{$project->table_id} 没有绑定企微群\n"; | ||
| 70 | + $tick->ding = 1; | ||
| 71 | + $tick->save(); | ||
| 72 | + continue; | ||
| 73 | + } | ||
| 74 | + $message_push->content_type = 'Link'; | ||
| 75 | + $message_push->content = json_encode([ | ||
| 76 | + 'title' => '工单查看 - ' . $project->company_name, | ||
| 77 | + 'desc' => $tick->title, | ||
| 78 | + 'size' => 0, | ||
| 79 | + 'thumbSize' => 0, | ||
| 80 | + 'thumbUrl' => 'https://www.cmer.com/uploads/logo1.png', | ||
| 81 | + 'url' => 'https://oa.quanqiusou.cn/tickets?project_id='.$project->uuid | ||
| 82 | + ], JSON_UNESCAPED_UNICODE); | ||
| 83 | + $message_push->send_time = now(); | ||
| 84 | + $message_push->type = MessagePush::TYPE_TICKET; | ||
| 85 | + $message_push->save(); | ||
| 86 | + $tick->ding = 1; | ||
| 87 | + $tick->save(); | ||
| 88 | + echo now() . " INFO | 项目ID:{$project->table_id} 工单ID:{$tick->id} 推送成功\n"; | ||
| 89 | + }catch (\Exception $exception){ | ||
| 90 | + echo date('Y-m-d H:i:s')." ERROR | ".$exception->getMessage()."\n"; | ||
| 91 | + break; | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | +} |
| @@ -3,7 +3,6 @@ | @@ -3,7 +3,6 @@ | ||
| 3 | namespace App\Console\Commands\WorkOrder; | 3 | namespace App\Console\Commands\WorkOrder; |
| 4 | 4 | ||
| 5 | use App\Models\WorkOrder\TicketLog; | 5 | use App\Models\WorkOrder\TicketLog; |
| 6 | -use App\Models\WorkOrder\WorkOrderLog; | ||
| 7 | use App\Services\DingTalkService; | 6 | use App\Services\DingTalkService; |
| 8 | use Illuminate\Console\Command; | 7 | use Illuminate\Console\Command; |
| 9 | use Illuminate\Support\Facades\Http; | 8 | use Illuminate\Support\Facades\Http; |
| @@ -26,7 +26,7 @@ class AsideTicketController extends BaseController | @@ -26,7 +26,7 @@ class AsideTicketController extends BaseController | ||
| 26 | 'logs.engineer:id,name', | 26 | 'logs.engineer:id,name', |
| 27 | 'project', | 27 | 'project', |
| 28 | ]) | 28 | ]) |
| 29 | - ->when($validated['engineer_id'], function ($query) use ($validated) { | 29 | + ->when(!empty($validated['engineer_id']), function ($query) use ($validated) { |
| 30 | // 查 gl_tickets 表 submit_user_id 或 gl_ticket_logs 表 engineer_id | 30 | // 查 gl_tickets 表 submit_user_id 或 gl_ticket_logs 表 engineer_id |
| 31 | $engineerId = $validated['engineer_id']; | 31 | $engineerId = $validated['engineer_id']; |
| 32 | return $query->where(function ($q) use ($engineerId) { | 32 | return $query->where(function ($q) use ($engineerId) { |
| @@ -59,16 +59,23 @@ class EnterpriseProductLogic extends BaseLogic | @@ -59,16 +59,23 @@ class EnterpriseProductLogic extends BaseLogic | ||
| 59 | ProjectServer::useProject($this->param['project_id']); | 59 | ProjectServer::useProject($this->param['project_id']); |
| 60 | $linkModel = new LinkData(); | 60 | $linkModel = new LinkData(); |
| 61 | $data = []; | 61 | $data = []; |
| 62 | + $count = count($this->param['data']); | ||
| 63 | + $error_num = 0; | ||
| 62 | foreach ($this->param['data'] as $v){ | 64 | foreach ($this->param['data'] as $v){ |
| 65 | + if(empty($v['send_time'])){ | ||
| 66 | + $error_num++; | ||
| 67 | + continue; | ||
| 68 | + } | ||
| 63 | $data[] = [ | 69 | $data[] = [ |
| 64 | 'url'=>$v['url'], | 70 | 'url'=>$v['url'], |
| 65 | 'da_values'=>$v['da_values'], | 71 | 'da_values'=>$v['da_values'], |
| 72 | + 'send_time'=>$v['send_time'] ?? date('Y-m-d H:i:s') | ||
| 66 | ]; | 73 | ]; |
| 67 | } | 74 | } |
| 68 | if(!empty($data)){ | 75 | if(!empty($data)){ |
| 69 | $linkModel->insertAll($data); | 76 | $linkModel->insertAll($data); |
| 70 | } | 77 | } |
| 71 | DB::disconnect('custom_mysql'); | 78 | DB::disconnect('custom_mysql'); |
| 72 | - return $this->success(); | 79 | + return $this->success(['success'=>'成功数量:'.$count-$error_num,'error'=>'失败数量:'.$error_num]); |
| 73 | } | 80 | } |
| 74 | } | 81 | } |
| @@ -432,7 +432,7 @@ class ProjectLogic extends BaseLogic | @@ -432,7 +432,7 @@ class ProjectLogic extends BaseLogic | ||
| 432 | $keywordCommentModel = new AggregateKeywordComment(); | 432 | $keywordCommentModel = new AggregateKeywordComment(); |
| 433 | $commentNum = $keywordCommentModel->counts(['project_id'=>$param['id']]); | 433 | $commentNum = $keywordCommentModel->counts(['project_id'=>$param['id']]); |
| 434 | if(empty($commentNum)){ | 434 | if(empty($commentNum)){ |
| 435 | - NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD_COMMON, ['project_id' => $param['id']]); | 435 | + NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD_COMMENT, ['project_id' => $param['id']]); |
| 436 | } | 436 | } |
| 437 | } | 437 | } |
| 438 | if($param['type'] == Project::TYPE_FIVE){ | 438 | if($param['type'] == Project::TYPE_FIVE){ |
| @@ -52,7 +52,12 @@ class CustomTemplateLogic extends BaseLogic | @@ -52,7 +52,12 @@ class CustomTemplateLogic extends BaseLogic | ||
| 52 | if(!empty($info['html'])){ | 52 | if(!empty($info['html'])){ |
| 53 | $info['is_renovation'] = 1; | 53 | $info['is_renovation'] = 1; |
| 54 | }else{ | 54 | }else{ |
| 55 | + if(strpos($info['text'],"<main>") === false){ | ||
| 56 | + $info['html'] = "<main>".$info['text']."</main>"; | ||
| 57 | + }else{ | ||
| 55 | $info['html'] = $info['text']; | 58 | $info['html'] = $info['text']; |
| 59 | + } | ||
| 60 | + $info['html_style'] = "<style id='globalsojs-styles'></style>"; | ||
| 56 | $info['is_renovation'] = 0; | 61 | $info['is_renovation'] = 0; |
| 57 | } | 62 | } |
| 58 | $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); | 63 | $info['image'] = getImageUrl($info['image'],$this->user['storage_type'],$this->user['project_location']); |
| @@ -13,7 +13,7 @@ class NoticeLog extends Base | @@ -13,7 +13,7 @@ class NoticeLog extends Base | ||
| 13 | const TYPE_PROJECT = 'project'; | 13 | const TYPE_PROJECT = 'project'; |
| 14 | const TYPE_RANK_DATA = 'rank_data'; | 14 | const TYPE_RANK_DATA = 'rank_data'; |
| 15 | const TYPE_INIT_PROJECT = 'init_project'; | 15 | const TYPE_INIT_PROJECT = 'init_project'; |
| 16 | - const TYPE_INIT_KEYWORD_COMMON = 'init_keyword_common';//聚合页关键词评论 | 16 | + const TYPE_INIT_KEYWORD_COMMENT = 'init_keyword_comment';//聚合页关键词评论 |
| 17 | const TYPE_GENERATE_COUNT_CHARTS = 'generate_count_charts';//聚合页关键字图表生成 | 17 | const TYPE_GENERATE_COUNT_CHARTS = 'generate_count_charts';//聚合页关键字图表生成 |
| 18 | const TYPE_COPY_PROJECT = 'copy_project'; | 18 | const TYPE_COPY_PROJECT = 'copy_project'; |
| 19 | const TYPE_INIT_KEYWORD = 'init_keyword'; | 19 | const TYPE_INIT_KEYWORD = 'init_keyword'; |
| @@ -27,6 +27,7 @@ class MessagePush extends Base | @@ -27,6 +27,7 @@ class MessagePush extends Base | ||
| 27 | 27 | ||
| 28 | const TYPE_INQUIRY = 'inquiry'; | 28 | const TYPE_INQUIRY = 'inquiry'; |
| 29 | const TYPE_WEEK = 'week'; | 29 | const TYPE_WEEK = 'week'; |
| 30 | + const TYPE_TICKET = 'ticket'; | ||
| 30 | //设置关联表名 | 31 | //设置关联表名 |
| 31 | /** | 32 | /** |
| 32 | * @var mixed | 33 | * @var mixed |
| @@ -28,10 +28,12 @@ class AiVideoService | @@ -28,10 +28,12 @@ class AiVideoService | ||
| 28 | if($project_id){ | 28 | if($project_id){ |
| 29 | $projectAiSettingModel = new ProjectAiSetting(); | 29 | $projectAiSettingModel = new ProjectAiSetting(); |
| 30 | $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]); | 30 | $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]); |
| 31 | + if($aiSettingInfo !== false){ | ||
| 31 | $this->mch_id = $aiSettingInfo['mch_id']; | 32 | $this->mch_id = $aiSettingInfo['mch_id']; |
| 32 | $this->key = $aiSettingInfo['key']; | 33 | $this->key = $aiSettingInfo['key']; |
| 33 | } | 34 | } |
| 34 | } | 35 | } |
| 36 | + } | ||
| 35 | 37 | ||
| 36 | /** | 38 | /** |
| 37 | * @remark :设置路由 | 39 | * @remark :设置路由 |
-
请 注册 或 登录 后发表评论