作者 lyh

gx

... ... @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\ProjectCountryLogic;
/**
* @name:项目配置多语言设置
*/
class ProjectCountryController extends BaseController
{
/**
... ...
... ... @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingLogic;
/**
* @name:项目首页设置
*/
class WebSettingController extends BaseController
{
/**
... ...
... ... @@ -7,6 +7,9 @@ use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingCountryLogic;
use App\Models\Project\Country as CountryModel;
/**
* @name:多语言国家配置列
*/
class WebSettingCountryController extends BaseController
{
/**
... ...
... ... @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingFromLogic;
/**
* @name:表单设置
*/
class WebSettingFromController extends BaseController
{
/**
... ... @@ -26,30 +29,7 @@ class WebSettingFromController extends BaseController
* @time :2023/4/28 14:41
*/
public function save(WebSettingFromLogic $webSettingFromLogic){
if(isset($this->param['id']) && !empty($this->param['id'])){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
}
$webSettingFromLogic->setting_from_save();
$this->response('success');
}
/**
* @name :(删除表单)del
* @author :lyh
* @method :post
* @time :2023/5/4 13:38
*/
public function del(WebSettingFromLogic $webSettingFromLogic){
$this->request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$webSettingFromLogic->setting_from_del();
$this->response('success');
}
}
... ...
... ... @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingHtmlLogic;
/**
* @name:第三方代码设置
*/
class WebSettingHtmlController extends BaseController
{
/**
... ...
<?php
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingReceivingLogic;
/**
* @name:项目收信设置
*/
class WebSettingReceivingController extends BaseController
{
/**
* @name :(收信设置列表)lists
* @author :lyh
* @method :post
* @time :2023/5/8 16:22
*/
public function lists(WebSettingReceivingLogic $webSettingReceivingLogic){
$lists = $webSettingReceivingLogic->setting_receiving_lists();
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @name :(更新)save
* @author :lyh
* @method :post
* @time :2023/5/8 16:23
*/
public function save(WebSettingReceivingLogic $webSettingReceivingLogic){
$lists = $webSettingReceivingLogic->setting_receiving_save();
$this->response('success');
}
}
... ...
... ... @@ -6,6 +6,9 @@ use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingServiceLogic;
/**
* @name:客服设置
*/
class WebSettingServiceController extends BaseController
{
/**
... ...
... ... @@ -2,6 +2,7 @@
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingTextLogic;
... ...
... ... @@ -22,7 +22,7 @@ class WebSettingFromLogic extends BaseLogic
* @time :2023/5/4 13:43
*/
public function setting_from_info(){
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
$info = $this->model->list(['project_id'=>$this->user['project_id']],'created_at');
if($info === false){
$this->fail('当前数据不存在,或者已被删除');
}
... ... @@ -39,10 +39,9 @@ class WebSettingFromLogic extends BaseLogic
public function setting_from_save(){
try {
//删除以前的数据
$param['project_id'] = ['in',$this->user['project_id']];
$this->model->del($param);
$this->model->del(['project_id'=>$this->user['project_id']]);
//新增
$this->model->add($this->param);
$this->model->add($this->param['data']);
}catch (\Exception $e){
$this->fail('error');
}
... ...
... ... @@ -44,7 +44,6 @@ class WebSettingLogic extends BaseLogic
//查看数据是否存在
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->param['operator_id'] = $this->user['id'];
$this->param['project_id'] = $this->user['project_id'];
$rs = $this->model->add($this->param);
}else{
... ...
<?php
namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\WebSetting\WebSettingReceiving;
use App\Models\WebSetting\WebSettingText;
class WebSettingReceivingLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new WebSettingReceiving();
$this->param = $this->requestAll;
}
/**
* @name :(列表数据)setting_receiving_lists
* @author :lyh
* @method :post
* @time :2023/5/8 16:17
*/
public function setting_receiving_lists(){
$lists = $this->model->list(['project_id'=>$this->user['project_id']]);
return $this->success($lists);
}
/**
* @name :(设置收信账号)setting_receiving_save
* @author :lyh
* @method :post
* @time :2023/5/8 16:26
*/
public function setting_receiving_save(){
try {
$this->model->del(['project_id'=>$this->user['project_id']]);
foreach ($this->param['data'] as $k => $v){
$v['project_id'] = $this->user['project_id'];
$this->param['data'][$k] = $v;
}
$this->model->add($this->param['data']);
}catch (\Exception $e){
$this->fail('error');
}
return $this->success();
}
}
... ...
... ... @@ -37,35 +37,15 @@ class WebSettingServiceLogic extends BaseLogic
public function setting_service_save(){
try {
//删除以前的数据
$param['project_id'] = $this->user['project_id'];
$this->model->del($param);
$this->model->del(['project_id'=>$this->user['project_id']]);
foreach ($this->param['data'] as $k => $v){
$v['project_id'] = $this->user['project_id'];
$this->param['data'][$k] = $v;
}
$this->model->add($this->param['data']);
}catch (\Exception $e){
$this->fail('error');
}
return $this->success();
}
/**
* @name :(删除客服图片)setting_service_del
* @author :lyh
* @method :post
* @time :2023/5/4 11:29
*/
public function setting_service_del(){
DB::beginTransaction();
try {
//获取当前图片资源
$image = new Image();
$info = $image->read(['hash'=>$this->param['hash']]);
if($info !== false){
$image->del(['id'=>$info['id']]);
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
}
}
... ...
... ... @@ -18,19 +18,29 @@ class WebSettingTextLogic extends BaseLogic
}
/**
* @name :(查询设置详情)setting_read
* @author :lyh
* @method :post
* @time :2023/5/8 15:56
*/
public function setting_read(){
$web_setting = new WebSetting();
$setting_info = $web_setting->read(['project_id'=>$this->user['project_id']],['anchor_setting','anchor_is_enable','anchor_num']);
return $setting_info;
}
/**
* @name :(描文本详情)setting_text_lists
* @author :lyh
* @method :post
* @time :2023/5/8 14:18
*/
public function setting_text_lists(){
$lists = $this->model->list(['project_id'=>$this->user['project_id']],'created_at');
$web_setting = new WebSetting();
$setting_info = $web_setting->read(['project_id'=>$this->user['project_id']],['anchor_setting']);
$lists['anchor_info'] = $setting_info;
$anchor_text = config('setting.anchor_text');
$lists['data'] = $this->model->list(['project_id'=>$this->user['project_id']],'created_at',['key_words','url']);
$lists['anchor_info'] = $this->setting_read();
$anchor_text = $this->model->anchor_text;
$lists['anchor_text'] = $anchor_text;
$this->success($lists);
return $this->success($lists);
}
/**
... ... @@ -40,12 +50,25 @@ class WebSettingTextLogic extends BaseLogic
* @time :2023/5/8 14:39
*/
public function setting_text_save(){
$web_setting = new WebSetting();
$setting_info = $this->setting_read();
if(count($this->param['data']) > $setting_info['anchor_num']){
$this->fail('超过最大设置限制');
}
DB::beginTransaction();
try {
//更新描文本设置
$web_setting = new WebSetting();
$web_setting->edit(['anchor_setting'=>$this->param['anchor_setting']],['project_id'=>$this->user['project_id']]);
$data = [
'anchor_setting'=>$this->param['anchor_setting'],
'anchor_is_enable'=>$this->param['anchor_is_enable'],
'anchor_num'=>$this->param['anchor_num']
];
$web_setting->edit($data,['project_id'=>$this->user['project_id']]);
$this->model->del(['project_id'=>$this->user['project_id']]);
foreach ($this->param['data'] as $k => $v){
$v['project_id'] = $this->user['project_id'];
$this->param['data'][$k] = $v;
}
$this->model->add($this->param['data']);
DB::commit();
}catch (\Exception $e){
... ...
... ... @@ -112,6 +112,17 @@ class Base extends Model
$info = $info->toArray();
return $info;
}
/**
* @name :(获取数据条数)count
* @author :lyh
* @method :post
* @time :2023/5/8 15:51
*/
public function get_count($condition){
$query = $this->formatQuery($condition);
$query->count();
}
/**
* @name :新增
* @return void
... ...
... ... @@ -7,4 +7,5 @@ use App\Models\Base;
class WebSetting extends Base
{
protected $table = 'gl_web_setting';
}
... ...
<?php
namespace App\Models\WebSetting;
use App\Models\Base;
class WebSettingReceiving extends Base
{
protected $table = 'gl_web_setting_receiving';
}
... ...
... ... @@ -7,4 +7,21 @@ use App\Models\Base;
class WebSettingText extends Base
{
protected $table = 'gl_web_setting_text';
//定义常量参数
const TYPE_PAGE = 1;
const TYPE_PRODUCT = 2;
const TYPE_KEYWORD = 3;
const TYPE_NEWS = 4;
const TYPE_BLOG = 6;
/**
* @var :描文本设置
*/
public $anchor_text = [
self::TYPE_PAGE => '单页面',
self::TYPE_PRODUCT=>'产品页',
self::TYPE_KEYWORD=>'关键词页',
self::TYPE_NEWS=>'新闻页',
self::TYPE_BLOG=>'博客页',
];
}
... ...
<?php
return [
//锚文本相关设置
'anchor_text'=>[
'is_enable'=>false,
'num'=>3,
'text_view'=>[
'单页面'=>1,
'产品页'=>2,
'关键词也'=>3,
'新闻页'=>4,
'博客页'=>5,
],
],
];
... ...
... ... @@ -136,6 +136,11 @@ Route::middleware(['bloginauth'])->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'lists'])->name('web_setting_text_lists');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingTextController::class, 'save'])->name('web_setting_text_save');
});
//收信设置
Route::prefix('receiving')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingReceivingController::class, 'lists'])->name('web_setting_receiving_lists');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingReceivingController::class, 'save'])->name('web_setting_receiving_save');
});
});
//产品
... ...