正在显示
1 个修改的文件
包含
4 行增加
和
5 行删除
| @@ -321,12 +321,11 @@ class SyncProject extends Command | @@ -321,12 +321,11 @@ class SyncProject extends Command | ||
| 321 | * @time :2023/8/9 14:47 | 321 | * @time :2023/8/9 14:47 |
| 322 | */ | 322 | */ |
| 323 | public function setPostId($plan,$id){ | 323 | public function setPostId($plan,$id){ |
| 324 | - $length = strlen((string)$id); // 获取变量的位数 | ||
| 325 | - $paddingLength = Project::TYPE_FIVE - $length; // 计算填充前面的 0 的位数 | ||
| 326 | - $zeros = str_repeat("0", $paddingLength); | ||
| 327 | - $number = Project::TYPE_SIX.$plan.$zeros.$id; | 324 | + $letters = range('A', 'X'); // 只取前 24 个字母(A ~ X) |
| 325 | + $randomLetter = $letters[array_rand($letters)]; | ||
| 326 | + $post_id = $randomLetter.mt_rand(100000, 999999).$id; | ||
| 328 | $projectModel = new Project(); | 327 | $projectModel = new Project(); |
| 329 | - $projectModel->edit(['post_id'=>$number],['id'=>$id]); | 328 | + $projectModel->edit(['post_id'=>$post_id],['id'=>$id]); |
| 330 | return true; | 329 | return true; |
| 331 | } | 330 | } |
| 332 | 331 |
-
请 注册 或 登录 后发表评论