正在显示
4 个修改的文件
包含
33 行增加
和
10 行删除
| @@ -337,20 +337,22 @@ class ProjectLogic extends BaseLogic | @@ -337,20 +337,22 @@ class ProjectLogic extends BaseLogic | ||
| 337 | 'bill' => $param['images'], | 337 | 'bill' => $param['images'], |
| 338 | ], | 338 | ], |
| 339 | ]; | 339 | ]; |
| 340 | - DB::beginTransaction(); | ||
| 341 | - try { | 340 | +// DB::beginTransaction(); |
| 341 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(111, true) . PHP_EOL, FILE_APPEND); | ||
| 342 | +// try { | ||
| 342 | $res = parent::save($data); | 343 | $res = parent::save($data); |
| 344 | + @file_put_contents(storage_path('logs/lyh_error.log'), var_export(222, true) . PHP_EOL, FILE_APPEND); | ||
| 343 | $data['id'] = $res['id']; | 345 | $data['id'] = $res['id']; |
| 344 | $this->setPostId($data['deploy_build']['plan'],$res['id']); | 346 | $this->setPostId($data['deploy_build']['plan'],$res['id']); |
| 345 | $this->savePayment($data); | 347 | $this->savePayment($data); |
| 346 | $this->saveDeployBuild($data); | 348 | $this->saveDeployBuild($data); |
| 347 | $this->saveDeployOptimize($data); | 349 | $this->saveDeployOptimize($data); |
| 348 | - DB::commit(); | ||
| 349 | - }catch (\Exception $e){ | ||
| 350 | - DB::rollBack(); | ||
| 351 | - errorLog('项目同步失败', $data, $e); | ||
| 352 | - $this->fail('同步失败'); | ||
| 353 | - } | 350 | +// DB::commit(); |
| 351 | +// }catch (\Exception $e){ | ||
| 352 | +// DB::rollBack(); | ||
| 353 | +// errorLog('项目同步失败', $data, $e); | ||
| 354 | +// $this->fail('同步失败'); | ||
| 355 | +// } | ||
| 354 | } | 356 | } |
| 355 | 357 | ||
| 356 | /** | 358 | /** |
| @@ -121,6 +121,8 @@ class ProductLogic extends BaseLogic | @@ -121,6 +121,8 @@ class ProductLogic extends BaseLogic | ||
| 121 | $info = $this->model->read(['id'=>$this->param['id']]); | 121 | $info = $this->model->read(['id'=>$this->param['id']]); |
| 122 | $param = $this->setProductParams($info); | 122 | $param = $this->setProductParams($info); |
| 123 | $save_id = $this->model->insertGetId($param); | 123 | $save_id = $this->model->insertGetId($param); |
| 124 | + //同步路由信息 | ||
| 125 | + $this->copyRoute($save_id,$param['route'].'-'.$save_id); | ||
| 124 | //同步关联分类 | 126 | //同步关联分类 |
| 125 | CategoryRelated::saveRelated($save_id, explode(",", $param['category_id'])); | 127 | CategoryRelated::saveRelated($save_id, explode(",", $param['category_id'])); |
| 126 | //同步关联关键词 | 128 | //同步关联关键词 |
| @@ -154,6 +156,24 @@ class ProductLogic extends BaseLogic | @@ -154,6 +156,24 @@ class ProductLogic extends BaseLogic | ||
| 154 | } | 156 | } |
| 155 | 157 | ||
| 156 | /** | 158 | /** |
| 159 | + * @remark :同步路由表 | ||
| 160 | + * @name :copyRoute | ||
| 161 | + * @author :lyh | ||
| 162 | + * @method :post | ||
| 163 | + * @time :2023/8/19 11:53 | ||
| 164 | + */ | ||
| 165 | + public function copyRoute($news_id,$new_route){ | ||
| 166 | + $routeModel = new RouteMap(); | ||
| 167 | + $data = [ | ||
| 168 | + 'source'=>$routeModel::SOURCE_PRODUCT, | ||
| 169 | + 'source_id'=>$news_id, | ||
| 170 | + 'project_id'=>$this->user['project_id'], | ||
| 171 | + 'route'=>$new_route, | ||
| 172 | + ]; | ||
| 173 | + return $routeModel->add($data); | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + /** | ||
| 157 | * @remark :组装模版数据 | 177 | * @remark :组装模版数据 |
| 158 | * @name :setTemplateParams | 178 | * @name :setTemplateParams |
| 159 | * @author :lyh | 179 | * @author :lyh |
| @@ -208,6 +228,7 @@ class ProductLogic extends BaseLogic | @@ -208,6 +228,7 @@ class ProductLogic extends BaseLogic | ||
| 208 | 'product_type'=>$info['product_type'], | 228 | 'product_type'=>$info['product_type'], |
| 209 | 'created_uid'=>$this->user['id'], | 229 | 'created_uid'=>$this->user['id'], |
| 210 | 'icon'=>Arr::a2s($info['icon']), | 230 | 'icon'=>Arr::a2s($info['icon']), |
| 231 | + 'route'=>$info['route']."-copy", | ||
| 211 | 'created_at'=>date('Y-m-d H:i:s'), | 232 | 'created_at'=>date('Y-m-d H:i:s'), |
| 212 | 'updated_at'=>date('Y-m-d H:i:s'), | 233 | 'updated_at'=>date('Y-m-d H:i:s'), |
| 213 | ]; | 234 | ]; |
| @@ -70,7 +70,7 @@ class Base extends Model | @@ -70,7 +70,7 @@ class Base extends Model | ||
| 70 | public function lists($map, $page, $row, $order = 'id', $fields = ['*']): array | 70 | public function lists($map, $page, $row, $order = 'id', $fields = ['*']): array |
| 71 | { | 71 | { |
| 72 | $query = $this->formatQuery($map); | 72 | $query = $this->formatQuery($map); |
| 73 | - $lists = $query->select($fields)->orderBy($order,'desc')->paginate($row, ['*'], 'page', $page); | 73 | + $lists = $query->select($fields)->orderBy($order,'desc')->orderBy('created_at','desc')->paginate($row, ['*'], 'page', $page); |
| 74 | if (empty($lists)) { | 74 | if (empty($lists)) { |
| 75 | return []; | 75 | return []; |
| 76 | } | 76 | } |
| @@ -315,7 +315,7 @@ Route::middleware(['bloginauth'])->group(function () { | @@ -315,7 +315,7 @@ Route::middleware(['bloginauth'])->group(function () { | ||
| 315 | Route::any('/getIpPvCount', [\App\Http\Controllers\Bside\HomeCount\MonthCountController::class, 'getIpPvCount'])->name('month_getIpPvCount'); | 315 | Route::any('/getIpPvCount', [\App\Http\Controllers\Bside\HomeCount\MonthCountController::class, 'getIpPvCount'])->name('month_getIpPvCount'); |
| 316 | Route::any('/getKeyword', [\App\Http\Controllers\Bside\HomeCount\MonthCountController::class, 'getKeyword'])->name('month_getKeyword'); | 316 | Route::any('/getKeyword', [\App\Http\Controllers\Bside\HomeCount\MonthCountController::class, 'getKeyword'])->name('month_getKeyword'); |
| 317 | }); | 317 | }); |
| 318 | - | 318 | + |
| 319 | //更新tdk | 319 | //更新tdk |
| 320 | Route::prefix('tdk')->group(function () { | 320 | Route::prefix('tdk')->group(function () { |
| 321 | Route::any('/', [\App\Http\Controllers\Bside\BCom\UpdateController::class, 'updateSeoTdk'])->name('tdk_updateSeoTdk'); | 321 | Route::any('/', [\App\Http\Controllers\Bside\BCom\UpdateController::class, 'updateSeoTdk'])->name('tdk_updateSeoTdk'); |
-
请 注册 或 登录 后发表评论