作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

... ... @@ -83,17 +83,11 @@ class IndexController extends BaseController
$this->request->validate([
'data' => 'required|array',
'identifying'=>'required',
'code'=>'required'
], [
'data.required' => '自定义询盘数据不为空',
'data.array' => '必须为数组',
'identifying.required' => '唯一标识不为空',
'code'=>'加密串不能为空'
]);
$code = base64_encode(md5($this->param['identifying']));
if($code != $this->param['code']){
$this->response('签名错误',Code::SYSTEM_ERROR);
}
$inquiryModel = new InquiryData();
$rs = $inquiryModel->add($this->param);
if($rs === false){
... ...
... ... @@ -817,11 +817,41 @@ class ProjectController extends BaseController
* @time :2023/11/17 15:23
*/
public function saveOtherProject(ProjectLogic $logic){
$this->request->validate([
'id'=>'required',
'aicc'=>'required',
'hagro'=>'required',
'exclusive_aicc_day'=>'required',
'exclusive_hagro_day'=>'required',
],[
'id.required' => 'id不能为空',
'aicc.required' => 'aicc是否开启不能为空',
'hagro.required' => 'hagro是否开启不能为空',
'exclusive_aicc_day.required' => '服务天数不能为空',
'exclusive_hagro_day.required' => '服务天数不能为空',
]);
$logic->saveOtherProject();
$this->response('success');
}
/**
* @remark :获取其他项目配置
* @name :getOtherProject
* @author :lyh
* @method :post
* @time :2023/11/17 15:23
*/
public function getOtherProject(ProjectLogic $logic){
$this->request->validate([
'id'=>'required',
],[
'id.required' => 'id不能为空',
]);
$info = $logic->getOtherProject();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :获取渠道信息
* @name :getChannel
* @author :lyh
... ...
... ... @@ -110,4 +110,13 @@ class NavController extends BaseController
$navLogic->navSort();
$this->response('success');
}
/**
* 一键导入子菜单
* @author zbj
* @date 2023/11/21
*/
public function import(){
}
}
... ...
... ... @@ -710,4 +710,16 @@ class ProjectLogic extends BaseLogic
return $this->success($this->param);
}
/**
* @remark :获取其他配置
* @name :getOtherProject
* @author :lyh
* @method :post
* @time :2023/11/21 15:45
*/
public function getOtherProject(){
$info = $this->model->read(['id'=>$this->param['id']],['aicc','hagro','exclusive_aicc_day','exclusive_hagro_day']);
return $this->success($info);
}
}
... ...
... ... @@ -51,8 +51,8 @@ class ProductLogic extends BaseLogic
$category_ids = $this->getLastCategoryArr($this->param['category_id']);
$this->param['category_id'] = ','.implode(',',$category_ids).',';
}
DB::connection('custom_mysql')->beginTransaction();
try {
// DB::connection('custom_mysql')->beginTransaction();
// try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
//查看路由是否更新
... ... @@ -68,11 +68,11 @@ class ProductLogic extends BaseLogic
CategoryRelated::saveRelated($id, $category_ids);
//保存扩展字段
$this->saveExtendInfo($id,$extend);
DB::connection('custom_mysql')->commit();
}catch (\Exception $e){
DB::connection('custom_mysql')->rollBack();
$this->fail('系统错误请联系管理员');
}
// DB::connection('custom_mysql')->commit();
// }catch (\Exception $e){
// DB::connection('custom_mysql')->rollBack();
// $this->fail('系统错误请联系管理员');
// }
//通知更新
$this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$this->param['route']]);
return $this->success();
... ... @@ -144,7 +144,7 @@ class ProductLogic extends BaseLogic
$this->param['thumb'] = Arr::a2s($this->param['gallery'][0] ?? []);
$this->param['gallery'] = Arr::a2s($this->param['gallery'] ?? []);
}else{
$this->param['thumb'] = [];
$this->param['thumb'] = Arr::a2s([]);
}
$this->model->edit($this->param,['id'=>$this->param['id']]);
return $this->success();
... ... @@ -202,7 +202,7 @@ class ProductLogic extends BaseLogic
$param['thumb'] = Arr::a2s($param['gallery'][0] ?? []);
$param['gallery'] = Arr::a2s($param['gallery'] ?? []);
}else{
$param['thumb'] = [];
$param['thumb'] = Arr::a2s([]);
}
$param['attrs'] = Arr::a2s($param['attrs'] ?? []);
$param['attr_id'] = Arr::arrToSet($param['attr_id'] ?? '');
... ...
... ... @@ -21,6 +21,7 @@ class BNav extends Base
use SoftDeletes;
public $hidden = ['deleted_at'];
public $appends = ['able_import'];
/**
... ... @@ -74,4 +75,19 @@ class BNav extends Base
$value = getImageUrl($value);
return $value;
}
/**
* 是否支持一键导入
* @param $value
* @return int
* @author zbj
* @date 2023/11/21
*/
public function getAbleImportAttribute($value)
{
if(in_array($this->url, ['products','news','blogs'])){
return 1;
}
return 0;
}
}
... ...
... ... @@ -81,8 +81,10 @@ class Product extends Base
public function getThumbAttribute($value){
if(!empty($value)){
$value = json_decode($value,true);
if(!empty($value['url'])){
$value['url'] = getImageUrl($value['url']);
}
}
return $value;
}
... ... @@ -91,7 +93,9 @@ class Product extends Base
if(!empty($value)){
$value = Arr::s2a($value);
foreach ($value as $k => $v){
if(!empty($v['url'])){
$v['url'] = getImageUrl($v['url']);
}
$value[$k] = $v;
}
}
... ...
... ... @@ -5,6 +5,8 @@ namespace App\Models\RouteMap;
use App\Helper\Translate;
use App\Http\Logic\Aside\Project\ProjectLogic;
use App\Models\Base;
use App\Models\Project\Project;
use App\Models\Template\BTemplate;
/**
* 路由映射表
... ... @@ -112,19 +114,20 @@ class RouteMap extends Base
$project = ProjectLogic::instance()->getInfo($project_id);
if($project['type'] !== Project::STATUS_ONE){
return $route_map->route;
// throw new \Exception('站点已上线,禁止修改链接');
}
}
if(!$route_map){
$route_map = new self();
$route_map->source = $source;
$route_map->source_id = $source_id;
$route_map->project_id = $project_id;
if ($source == self::SOURCE_PRODUCT_KEYWORD){
$route = $route.'-tag';
$route = self::setKeywordRoute($route);
//查看当前路由是否存在
}elseif ($source == self::SOURCE_PRODUCT){
$route = $route.'-product';
//产品单独处理路由
$route = self::setProductRoute($route);
}
$route_map->source_id = $source_id;
$route_map->project_id = $project_id;
}
if($source == self::SOURCE_NEWS){
$route_map->path = self::SOURCE_NEWS;
... ... @@ -141,6 +144,46 @@ class RouteMap extends Base
/**
* @remark :产品新增单独处理路由
* @name :setProductRoute
* @author :lyh
* @method :post
* @time :2023/11/21 18:48
*/
public static function setProductRoute($route,$i = 0){
$route = $route.'-product';
$routeMapModel = new RouteMap();
$routeInfo = $routeMapModel->read(['route'=>$route]);
if($routeInfo === false){
return $route;
}else{
$i = $i + 1;
$route = $route.'-'.$i;
return self::setProductRoute($route,$i);
}
}
/**
* @remark :关键字新增单独处理路由
* @name :setProductRoute
* @author :lyh
* @method :post
* @time :2023/11/21 18:48
*/
public static function setKeywordRoute($route,$i = 0){
$route = $route.'-tag';
$routeMapModel = new RouteMap();
$routeInfo = $routeMapModel->read(['route'=>$route]);
if($routeInfo === false){
return $route;
}else{
$i = $i + 1;
$route = $route.'-'.$i;
return self::setProductRoute($route,$i);
}
}
/**
* @param $route
* @param $project_id
* @return mixed
... ...
... ... @@ -16,10 +16,18 @@ class BTemplate extends Base
const SOURCE_PRODUCT = 2;//产品
const SOURCE_BLOG = 3;//博客
const SOURCE_NEWS = 4;//新闻详情页
const SOURCE_KEYWORD = 5;//聚合页
const STATUS = 0;
const TYPE_ONE = 0;
const TYPE_TWO = 0;
const TYPE_THREE = 0;
const TYPE_FOUR = 0;
const TYPE_FIVE = 0;
const TYPE_SIX = 0;
const TYPE_SEVEN = 0;
const TYPE_ = 0;
protected $table = 'gl_web_template';
//连接数据库
protected $connection = 'custom_mysql';
... ...
... ... @@ -172,6 +172,7 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/copyProject', [Aside\Project\ProjectController::class, 'copyProject'])->name('admin.project_copyProject');
Route::any('/site_token', [Aside\Project\ProjectController::class, 'site_token'])->name('admin.project_site_token');
Route::any('/saveOtherProject', [Aside\Project\ProjectController::class, 'saveOtherProject'])->name('admin.project_saveOtherProject');//其他项目设置
Route::any('/getOtherProject', [Aside\Project\ProjectController::class, 'getOtherProject'])->name('admin.project_getOtherProject');//获取其他项目设置
Route::any('/getChannel', [Aside\Project\ProjectController::class, 'getChannel'])->name('admin.project_getChannel');//其他项目设置
//获取关键词前缀和后缀
Route::prefix('keyword')->group(function () {
... ...