正在显示
1 个修改的文件
包含
192 行增加
和
177 行删除
| @@ -16,6 +16,8 @@ use App\Models\Manage\BelongingGroup; | @@ -16,6 +16,8 @@ use App\Models\Manage\BelongingGroup; | ||
| 16 | use App\Models\Manage\Dept; | 16 | use App\Models\Manage\Dept; |
| 17 | use App\Models\Manage\EntryPosition; | 17 | use App\Models\Manage\EntryPosition; |
| 18 | use App\Models\Manage\ManageHr; | 18 | use App\Models\Manage\ManageHr; |
| 19 | +use App\Models\Project\Project; | ||
| 20 | +use App\Models\WebSetting\WebSettingService; | ||
| 19 | use App\Services\ProjectServer; | 21 | use App\Services\ProjectServer; |
| 20 | use App\Services\SyncService; | 22 | use App\Services\SyncService; |
| 21 | use GuzzleHttp\Client; | 23 | use GuzzleHttp\Client; |
| @@ -76,187 +78,200 @@ class Demo extends Command | @@ -76,187 +78,200 @@ class Demo extends Command | ||
| 76 | /** | 78 | /** |
| 77 | * @return bool | 79 | * @return bool |
| 78 | */ | 80 | */ |
| 79 | - public function handle() | ||
| 80 | - { | ||
| 81 | - return $this->domain(); | ||
| 82 | - $result = app(SyncService::class)->projectAcceptAddress(1); | ||
| 83 | - dd($result); | ||
| 84 | - $data = [ | ||
| 85 | - 'key' => 'productkey_keyword', | ||
| 86 | - 'keywords' => 'apple watch' | ||
| 87 | - ]; | ||
| 88 | - $result = Common::send_openai_msg('v2/openai_chat', $data); | ||
| 89 | - dd(); | ||
| 90 | - $string = 'demo.globalso.site/'; | ||
| 91 | - $domain_array = parse_url($string); | ||
| 92 | - $domain = $domain_array['host'] ?? $domain_array['path']; | ||
| 93 | - dd($domain); | ||
| 94 | - $data = []; | ||
| 95 | - dd(isset($data['a']['b'])); | ||
| 96 | - $url = 'https://demo.globalso.site/'; | ||
| 97 | - $action = 'api/updateHtmlNotify/'; | ||
| 98 | - $data = [ | ||
| 99 | - 'project_id' => 1, | ||
| 100 | - 'type' => 1, | ||
| 101 | - 'route' => 1 | ||
| 102 | - ];; | ||
| 103 | - $method = 'GET'; | ||
| 104 | - $result = $this->curlRequest($url . $action, $data, $method); | ||
| 105 | - dd($result); | ||
| 106 | - | ||
| 107 | - $context = stream_context_create([ | ||
| 108 | - 'ssl' => [ | ||
| 109 | - 'capture_peer_cert' => true, | ||
| 110 | - 'capture_peer_cert_chain' => false, | ||
| 111 | - ], | ||
| 112 | - ]); | ||
| 113 | - | ||
| 114 | - $stream = stream_socket_client('ssl://oa.quanqiusou.cn:443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context); | ||
| 115 | - | ||
| 116 | - if(!$stream) { | ||
| 117 | - die("Failed to connect: $errno - $errstr"); | ||
| 118 | - } | ||
| 119 | - | ||
| 120 | - $remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate']; | ||
| 121 | - | ||
| 122 | - if(!$remote_cert) { | ||
| 123 | - die("Failed to retrieve certificate"); | ||
| 124 | - } | ||
| 125 | - | ||
| 126 | - $valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']); | ||
| 127 | - $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']); | ||
| 128 | - | ||
| 129 | - fclose($stream); | ||
| 130 | - | ||
| 131 | - echo "Certificate Valid From: $valid_from<br>"; | ||
| 132 | - echo "Certificate Valid To: $valid_to<br>"; | ||
| 133 | - | ||
| 134 | - dd('end'); | ||
| 135 | - $dept_array = [ | ||
| 136 | - '品牌部', | ||
| 137 | - '综合部', | ||
| 138 | - '渠道部', | ||
| 139 | - '广告推广部', | ||
| 140 | - 'AICC运营部', | ||
| 141 | - '黑格运营部', | ||
| 142 | - '直营运营部', | ||
| 143 | - '直营销售部', | ||
| 144 | - '深圳跨境部', | ||
| 145 | - '外贸部', | ||
| 146 | - '研发部', | ||
| 147 | - '技术部', | ||
| 148 | - '售后部', | ||
| 149 | - ]; | ||
| 150 | - foreach ($dept_array as $v) { | ||
| 151 | - $dept = Dept::where(['title' => $v])->first(); | ||
| 152 | - if (FALSE == empty($dept)) | ||
| 153 | - continue; | ||
| 154 | - $dept = new Dept(); | ||
| 155 | - $dept->title = $v; | ||
| 156 | - $dept->save(); | ||
| 157 | - } | ||
| 158 | -// dd('dept end'); | ||
| 159 | - $dept_map = Dept::pluck('title', 'id')->toArray(); | ||
| 160 | - $belonging_map = BelongingGroup::pluck('name', 'id')->toArray(); | ||
| 161 | -// dd($belonging_map); | ||
| 162 | - | ||
| 163 | - $filename = storage_path('logs/oa_hr.txt'); | ||
| 164 | - $string = file_get_contents($filename); | ||
| 165 | - $data = explode("\r\n", $string); | ||
| 166 | - $data = array_filter($data); | ||
| 167 | - $dept = ''; | ||
| 168 | - foreach ($data as $k=>$v) { | ||
| 169 | -// var_dump($v) . PHP_EOL; | ||
| 170 | - if ($k == 1) | ||
| 171 | - continue; | ||
| 172 | - $tmp = explode("\t", $v); | ||
| 173 | - if (count($tmp) == 3) { | ||
| 174 | - $dept = $tmp[0] ? : $dept; | ||
| 175 | - $position = $tmp[1]; | ||
| 176 | - $name = $tmp[2]; | ||
| 177 | - } else if (count($tmp) == 2) { | ||
| 178 | - $position = $tmp[0]; | ||
| 179 | - $name = $tmp[1]; | ||
| 180 | - } else { | ||
| 181 | - Log::info($v . PHP_EOL); | ||
| 182 | - continue; | ||
| 183 | - } | ||
| 184 | - | ||
| 185 | - | ||
| 186 | -// Log::info($dept . '---' . $position . '---' . $name . PHP_EOL); | ||
| 187 | -// continue; | ||
| 188 | - | ||
| 189 | - $dept_id = array_search($dept, $dept_map); | ||
| 190 | - $belonging_id = 17; | ||
| 191 | - if (FALSE !== strpos($dept,'技术部')) { | ||
| 192 | - $belonging_string = str_replace('技术部', '', $dept); | ||
| 193 | - if ($belonging_string) { | ||
| 194 | - $belonging_string = $belonging_string . '组'; | ||
| 195 | - $belonging_id = array_search($belonging_string, $belonging_map); | ||
| 196 | - } | ||
| 197 | - | ||
| 198 | - $dept_tmp = '技术部'; | ||
| 199 | - $dept_id = array_search($dept_tmp, $dept_map); | ||
| 200 | - } | ||
| 201 | - if (FALSE !== strpos($dept,'售后')) { | ||
| 202 | - $belonging_string = str_replace('售后', '', $dept); | ||
| 203 | - if ($belonging_string) | ||
| 204 | - $belonging_id = array_search($belonging_string, $belonging_map); | ||
| 205 | - $dept_tmp = '售后部'; | ||
| 206 | - $dept_id = array_search($dept_tmp, $dept_map); | ||
| 207 | - } | ||
| 208 | - | ||
| 209 | - $position_log = EntryPosition::where(['name' => $position])->first(); | ||
| 210 | - if (empty($position_log)) { | ||
| 211 | - $position_log = new EntryPosition(); | ||
| 212 | - $position_log->name = $position; | ||
| 213 | - $position_log->save(); | ||
| 214 | - } | ||
| 215 | - $position_id = $position_log->id; | ||
| 216 | - | ||
| 217 | - $hr = ManageHr::where(['name' => $name])->first(); | ||
| 218 | - if (empty($hr)) { | ||
| 219 | - Log::info($k . '-' . $name . '-' . $dept . '-' . $dept_id . '-' . $position . '-' . $position_id); | ||
| 220 | - continue; | ||
| 221 | - } | ||
| 222 | - | ||
| 223 | - $hr->belong_group = $belonging_id; | ||
| 224 | - $hr->dept_id = $dept_id; | ||
| 225 | - $hr->entry_position = $position_id; | ||
| 226 | - $hr->save(); | ||
| 227 | - echo $k . '-' . $name . '-' . $dept . '-' . $dept_id . '-' . $position . '-' . $position_id . '-' . '组' . '-' . $belonging_id . PHP_EOL; | ||
| 228 | - | ||
| 229 | - } | ||
| 230 | - dd('end'); | ||
| 231 | - exit; | 81 | +// public function handle() |
| 82 | +// { | ||
| 83 | +// return $this->domain(); | ||
| 84 | +// $result = app(SyncService::class)->projectAcceptAddress(1); | ||
| 85 | +// dd($result); | ||
| 86 | +// $data = [ | ||
| 87 | +// 'key' => 'productkey_keyword', | ||
| 88 | +// 'keywords' => 'apple watch' | ||
| 89 | +// ]; | ||
| 90 | +// $result = Common::send_openai_msg('v2/openai_chat', $data); | ||
| 91 | +// dd(); | ||
| 92 | +// $string = 'demo.globalso.site/'; | ||
| 93 | +// $domain_array = parse_url($string); | ||
| 94 | +// $domain = $domain_array['host'] ?? $domain_array['path']; | ||
| 95 | +// dd($domain); | ||
| 96 | +// $data = []; | ||
| 97 | +// dd(isset($data['a']['b'])); | ||
| 98 | +// $url = 'https://demo.globalso.site/'; | ||
| 99 | +// $action = 'api/updateHtmlNotify/'; | ||
| 100 | +// $data = [ | ||
| 101 | +// 'project_id' => 1, | ||
| 102 | +// 'type' => 1, | ||
| 103 | +// 'route' => 1 | ||
| 104 | +// ];; | ||
| 105 | +// $method = 'GET'; | ||
| 106 | +// $result = $this->curlRequest($url . $action, $data, $method); | ||
| 107 | +// dd($result); | ||
| 108 | +// | ||
| 109 | +// $context = stream_context_create([ | ||
| 110 | +// 'ssl' => [ | ||
| 111 | +// 'capture_peer_cert' => true, | ||
| 112 | +// 'capture_peer_cert_chain' => false, | ||
| 113 | +// ], | ||
| 114 | +// ]); | ||
| 115 | +// | ||
| 116 | +// $stream = stream_socket_client('ssl://oa.quanqiusou.cn:443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context); | ||
| 117 | +// | ||
| 118 | +// if(!$stream) { | ||
| 119 | +// die("Failed to connect: $errno - $errstr"); | ||
| 120 | +// } | ||
| 121 | +// | ||
| 122 | +// $remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate']; | ||
| 123 | +// | ||
| 124 | +// if(!$remote_cert) { | ||
| 125 | +// die("Failed to retrieve certificate"); | ||
| 126 | +// } | ||
| 127 | +// | ||
| 128 | +// $valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']); | ||
| 129 | +// $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']); | ||
| 130 | +// | ||
| 131 | +// fclose($stream); | ||
| 132 | +// | ||
| 133 | +// echo "Certificate Valid From: $valid_from<br>"; | ||
| 134 | +// echo "Certificate Valid To: $valid_to<br>"; | ||
| 135 | +// | ||
| 136 | +// dd('end'); | ||
| 137 | +// $dept_array = [ | ||
| 138 | +// '品牌部', | ||
| 139 | +// '综合部', | ||
| 140 | +// '渠道部', | ||
| 141 | +// '广告推广部', | ||
| 142 | +// 'AICC运营部', | ||
| 143 | +// '黑格运营部', | ||
| 144 | +// '直营运营部', | ||
| 145 | +// '直营销售部', | ||
| 146 | +// '深圳跨境部', | ||
| 147 | +// '外贸部', | ||
| 148 | +// '研发部', | ||
| 149 | +// '技术部', | ||
| 150 | +// '售后部', | ||
| 151 | +// ]; | ||
| 152 | +// foreach ($dept_array as $v) { | ||
| 153 | +// $dept = Dept::where(['title' => $v])->first(); | ||
| 154 | +// if (FALSE == empty($dept)) | ||
| 155 | +// continue; | ||
| 156 | +// $dept = new Dept(); | ||
| 157 | +// $dept->title = $v; | ||
| 158 | +// $dept->save(); | ||
| 159 | +// } | ||
| 160 | +//// dd('dept end'); | ||
| 161 | +// $dept_map = Dept::pluck('title', 'id')->toArray(); | ||
| 162 | +// $belonging_map = BelongingGroup::pluck('name', 'id')->toArray(); | ||
| 163 | +//// dd($belonging_map); | ||
| 164 | +// | ||
| 165 | +// $filename = storage_path('logs/oa_hr.txt'); | ||
| 166 | +// $string = file_get_contents($filename); | ||
| 167 | +// $data = explode("\r\n", $string); | ||
| 168 | +// $data = array_filter($data); | ||
| 169 | +// $dept = ''; | ||
| 170 | +// foreach ($data as $k=>$v) { | ||
| 171 | +//// var_dump($v) . PHP_EOL; | ||
| 172 | +// if ($k == 1) | ||
| 173 | +// continue; | ||
| 174 | +// $tmp = explode("\t", $v); | ||
| 175 | +// if (count($tmp) == 3) { | ||
| 176 | +// $dept = $tmp[0] ? : $dept; | ||
| 177 | +// $position = $tmp[1]; | ||
| 178 | +// $name = $tmp[2]; | ||
| 179 | +// } else if (count($tmp) == 2) { | ||
| 180 | +// $position = $tmp[0]; | ||
| 181 | +// $name = $tmp[1]; | ||
| 182 | +// } else { | ||
| 183 | +// Log::info($v . PHP_EOL); | ||
| 184 | +// continue; | ||
| 185 | +// } | ||
| 186 | +// | ||
| 187 | +// | ||
| 188 | +//// Log::info($dept . '---' . $position . '---' . $name . PHP_EOL); | ||
| 189 | +//// continue; | ||
| 190 | +// | ||
| 191 | +// $dept_id = array_search($dept, $dept_map); | ||
| 192 | +// $belonging_id = 17; | ||
| 193 | +// if (FALSE !== strpos($dept,'技术部')) { | ||
| 194 | +// $belonging_string = str_replace('技术部', '', $dept); | ||
| 195 | +// if ($belonging_string) { | ||
| 196 | +// $belonging_string = $belonging_string . '组'; | ||
| 197 | +// $belonging_id = array_search($belonging_string, $belonging_map); | ||
| 198 | +// } | ||
| 199 | +// | ||
| 200 | +// $dept_tmp = '技术部'; | ||
| 201 | +// $dept_id = array_search($dept_tmp, $dept_map); | ||
| 202 | +// } | ||
| 203 | +// if (FALSE !== strpos($dept,'售后')) { | ||
| 204 | +// $belonging_string = str_replace('售后', '', $dept); | ||
| 205 | +// if ($belonging_string) | ||
| 206 | +// $belonging_id = array_search($belonging_string, $belonging_map); | ||
| 207 | +// $dept_tmp = '售后部'; | ||
| 208 | +// $dept_id = array_search($dept_tmp, $dept_map); | ||
| 209 | +// } | ||
| 210 | +// | ||
| 211 | +// $position_log = EntryPosition::where(['name' => $position])->first(); | ||
| 212 | +// if (empty($position_log)) { | ||
| 213 | +// $position_log = new EntryPosition(); | ||
| 214 | +// $position_log->name = $position; | ||
| 215 | +// $position_log->save(); | ||
| 216 | +// } | ||
| 217 | +// $position_id = $position_log->id; | ||
| 218 | +// | ||
| 219 | +// $hr = ManageHr::where(['name' => $name])->first(); | ||
| 220 | +// if (empty($hr)) { | ||
| 221 | +// Log::info($k . '-' . $name . '-' . $dept . '-' . $dept_id . '-' . $position . '-' . $position_id); | ||
| 222 | +// continue; | ||
| 223 | +// } | ||
| 224 | +// | ||
| 225 | +// $hr->belong_group = $belonging_id; | ||
| 226 | +// $hr->dept_id = $dept_id; | ||
| 227 | +// $hr->entry_position = $position_id; | ||
| 228 | +// $hr->save(); | ||
| 229 | +// echo $k . '-' . $name . '-' . $dept . '-' . $dept_id . '-' . $position . '-' . $position_id . '-' . '组' . '-' . $belonging_id . PHP_EOL; | ||
| 230 | +// | ||
| 231 | +// } | ||
| 232 | +// dd('end'); | ||
| 233 | +// exit; | ||
| 234 | +// | ||
| 235 | +// if (($handle = fopen($filename, 'r')) !== false) { | ||
| 236 | +// while (($data = fgetcsv($handle, 1000, ',')) !== false) { | ||
| 237 | +// // 处理每行数据 | ||
| 238 | +// Log::info(var_export($data, true)); | ||
| 239 | +// } | ||
| 240 | +// fclose($handle); | ||
| 241 | +// } | ||
| 242 | +// exit; | ||
| 243 | +// | ||
| 244 | +// $group = BelongingGroup::get(); | ||
| 245 | +// dd($group->toArray()); | ||
| 246 | +// $domain = parse_url('https//:dev.golbalso.site/'); | ||
| 247 | +// dd($domain); | ||
| 248 | +// echo time() . PHP_EOL; | ||
| 249 | +// $blogModel = new Image(); | ||
| 250 | +// $list = $blogModel->list(); | ||
| 251 | +// echo time() . PHP_EOL; | ||
| 252 | +// dd(count($list)); | ||
| 253 | +// | ||
| 254 | +// return; | ||
| 255 | +// preg_match_all("/\@include\(\"([a-z0-9_]+)\"\)/i",' | ||
| 256 | +//@include("asdf")@include("")@include("asdtrw2erf") | ||
| 257 | +// ',$include); | ||
| 258 | +// | ||
| 259 | +// print_r($include); | ||
| 260 | +// } | ||
| 232 | 261 | ||
| 233 | - if (($handle = fopen($filename, 'r')) !== false) { | ||
| 234 | - while (($data = fgetcsv($handle, 1000, ',')) !== false) { | ||
| 235 | - // 处理每行数据 | ||
| 236 | - Log::info(var_export($data, true)); | 262 | + public function handle(){ |
| 263 | + $projectModel = new Project(); | ||
| 264 | + $list = $projectModel->list(['delete_status'=>0]); | ||
| 265 | + foreach ($list as $v){ | ||
| 266 | + ProjectServer::useProject($v['id']); | ||
| 267 | + $webSettingServiceModel = new WebSettingService(); | ||
| 268 | + $info = $webSettingServiceModel->read(['values'=>['like','%+86%']]); | ||
| 269 | + if($info !== false){ | ||
| 270 | + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; | ||
| 237 | } | 271 | } |
| 238 | - fclose($handle); | 272 | + DB::disconnect('custom_mysql'); |
| 239 | } | 273 | } |
| 240 | - exit; | ||
| 241 | - | ||
| 242 | - $group = BelongingGroup::get(); | ||
| 243 | - dd($group->toArray()); | ||
| 244 | - $domain = parse_url('https//:dev.golbalso.site/'); | ||
| 245 | - dd($domain); | ||
| 246 | - echo time() . PHP_EOL; | ||
| 247 | - $blogModel = new Image(); | ||
| 248 | - $list = $blogModel->list(); | ||
| 249 | - echo time() . PHP_EOL; | ||
| 250 | - dd(count($list)); | ||
| 251 | - | ||
| 252 | - return; | ||
| 253 | - preg_match_all("/\@include\(\"([a-z0-9_]+)\"\)/i",' | ||
| 254 | -@include("asdf")@include("")@include("asdtrw2erf") | ||
| 255 | - ',$include); | ||
| 256 | - | ||
| 257 | - print_r($include); | ||
| 258 | } | 274 | } |
| 259 | - | ||
| 260 | public function printMessage() | 275 | public function printMessage() |
| 261 | { | 276 | { |
| 262 | $client = new Client(); | 277 | $client = new Client(); |
-
请 注册 或 登录 后发表评论