作者 Your Name
... ... @@ -53,7 +53,7 @@ class UpdateRoute extends Command
*/
public function handle(){
$projectModel = new Project();
$list = $projectModel->list(['id'=>688]);
$list = $projectModel->list(['id'=>783]);
$data = [];
foreach ($list as $v){
echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
... ... @@ -145,9 +145,9 @@ class UpdateRoute extends Command
throw new \Exception('路由生成失败');
}
try {
$route_map = self::where('project_id', $project_id)->where('source_id', $source_id)->where('source', $source)->first();
$route_map = RouteMap::where('project_id', $project_id)->where('source_id', $source_id)->where('source', $source)->first();
if(!$route_map){
$route_map = new self();
$route_map = new RouteMap();
$route_map->source = $source;
$route_map->source_id = $source_id;
$route_map->project_id = $project_id;
... ... @@ -177,7 +177,7 @@ class UpdateRoute extends Command
if($length > 100){
$sign = trim(mb_substr($sign, 0, 100, 'UTF-8'),'-');
}
$info = self::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first();
$info = RouteMap::where(['project_id' => $project_id, 'source' => $source, 'source_id'=>$source_id])->first();
$suffix = '';
if(empty($info)){
if($source == 'product'){
... ... @@ -185,7 +185,7 @@ class UpdateRoute extends Command
}
}
$route = $sign.$suffix;
while(self::isExist($route, $source_id, $project_id)){
while(RouteMap::isExist($route, $source_id, $project_id)){
$route = $sign .'-'.$i.$suffix;
$i++;
}
... ...