作者 Your Name

Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev

<?php
namespace App\Helper;
class Country
{
public static $tls_list = [
'en' => [
'text' => '英语',
'lang_text' => 'English',
'con_flag' => 'con_flag/en.jfif',
'shop_lang' => 'en-gb',
],
'zh' => [
'text' => '中文',
'lang_text' => '简体中文',
'con_flag' => 'con_flag/zh.jfif',
'shop_lang' => 'zh-cn',
],
'fr' => [
'text' => '法语',
'lang_text' => 'En français',
'con_flag' => '',
],
'de' => [
'text' => '德语',
'lang_text' => 'Das ist Deutsch.',
'con_flag' => '',
],
'ko' => [
'text' => '韩语',
'lang_text' => '',
'con_flag' => '',
],
'ja' => [
'text' => '日语',
'lang_text' => '',
'con_flag' => '',
],
'es' => [
'text' => '西班牙语',
'lang_text' => 'Español.',
'con_flag' => '',
],
'ar' => [
'text' => '阿拉伯语',
'lang_text' => '',
'con_flag' => '',
],
'pt' => [
'text' => '葡萄牙语(葡萄牙、巴西)',
'lang_text' => 'Língua portuguesa',
'con_flag' => '',
],
'ru' => [
'text' => '俄语',
'lang_text' => '',
'con_flag' => '',
],
'af' => [
'text' => '南非荷兰语',
'lang_text' => '',
'con_flag' => '',
],
'sq' => [
'text' => '阿尔巴尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'am' => [
'text' => '阿姆哈拉语',
'lang_text' => '',
'con_flag' => '',
],
'hy' => [
'text' => '亚美尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'az' => [
'text' => '阿塞拜疆语',
'lang_text' => '',
'con_flag' => '',
],
'eu' => [
'text' => '巴斯克语',
'lang_text' => '',
'con_flag' => '',
],
'be' => [
'text' => '白俄罗斯语',
'lang_text' => '',
'con_flag' => '',
],
'bn' => [
'text' => '孟加拉语',
'lang_text' => '',
'con_flag' => '',
],
'bs' => [
'text' => '波斯尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'bg' => [
'text' => '保加利亚语',
'lang_text' => '',
'con_flag' => '',
],
'ca' => [
'text' => '加泰罗尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'ceb' => [
'text' => '宿务语',
'lang_text' => '',
'con_flag' => '',
],
'zh-CN' => [
'text' => '中文(简体)',
'lang_text' => '简体中文',
'con_flag' => 'con_flag/zh.jfif',
'shop_lang' => 'zh-cn',
],
'zh-TW' => [
'text' => '中文(繁体)',
'lang_text' => '繁体中文',
'con_flag' => 'con_flag/zh.jfif',
],
'co' => [
'text' => '科西嘉语',
'lang_text' => '',
'con_flag' => '',
],
'hr' => [
'text' => '克罗地亚语',
'lang_text' => '',
'con_flag' => '',
],
'cs' => [
'text' => '捷克语',
'lang_text' => '',
'con_flag' => '',
],
'da' => [
'text' => '丹麦语',
'lang_text' => '',
'con_flag' => '',
],
'nl' => [
'text' => '荷兰语',
'lang_text' => '',
'con_flag' => '',
],
'eo' => [
'text' => '世界语',
'lang_text' => '',
'con_flag' => '',
],
'et' => [
'text' => '爱沙尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'fi' => [
'text' => '芬兰语',
'lang_text' => '',
'con_flag' => '',
],
'fy' => [
'text' => '弗里斯兰语',
'lang_text' => '',
'con_flag' => '',
],
'gl' => [
'text' => '加利西亚语',
'lang_text' => '',
'con_flag' => '',
],
'ka' => [
'text' => '格鲁吉亚语',
'lang_text' => '',
'con_flag' => '',
],
'el' => [
'text' => '希腊语',
'lang_text' => '',
'con_flag' => '',
],
'gu' => [
'text' => '古吉拉特语',
'lang_text' => '',
'con_flag' => '',
],
'ht' => [
'text' => '海地克里奥尔语',
'lang_text' => '',
'con_flag' => '',
],
'ha' => [
'text' => '豪萨语',
'lang_text' => '',
'con_flag' => '',
],
'haw' => [
'text' => '夏威夷语',
'lang_text' => '',
'con_flag' => '',
],
'iw' => [
'text' => '希伯来语',
'lang_text' => '',
'con_flag' => '',
],
'hi' => [
'text' => '印地语',
'lang_text' => '',
'con_flag' => '',
],
'hmn' => [
'text' => '苗语',
'lang_text' => '',
'con_flag' => '',
],
'hu' => [
'text' => '匈牙利语',
'lang_text' => '',
'con_flag' => '',
],
'is' => [
'text' => '冰岛语',
'lang_text' => '',
'con_flag' => '',
],
'ig' => [
'text' => '伊博语',
'lang_text' => '',
'con_flag' => '',
],
'id' => [
'text' => '印度尼西亚语',
'lang_text' => 'Bahasa Indonesia',
'con_flag' => 'con_flag/id.jfif',
'shop_lang' => 'id',
],
'ga' => [
'text' => '爱尔兰语',
'lang_text' => '',
'con_flag' => '',
],
'it' => [
'text' => '意大利语',
'lang_text' => 'Lingua italiana',
'con_flag' => '',
],
'jw' => [
'text' => '爪哇语',
'lang_text' => '',
'con_flag' => '',
],
'kn' => [
'text' => '卡纳达语',
'lang_text' => '',
'con_flag' => '',
],
'kk' => [
'text' => '哈萨克语',
'lang_text' => '',
'con_flag' => '',
],
'km' => [
'text' => '高棉语',
'lang_text' => '',
'con_flag' => '',
],
'rw' => [
'text' => '卢旺达语',
'lang_text' => '',
'con_flag' => '',
],
'ku' => [
'text' => '库尔德语',
'lang_text' => '',
'con_flag' => '',
],
'ky' => [
'text' => '吉尔吉斯语',
'lang_text' => '',
'con_flag' => '',
],
'lo' => [
'text' => '老挝文',
'lang_text' => '',
'con_flag' => '',
],
'la' => [
'text' => '拉丁文',
'lang_text' => '',
'con_flag' => '',
],
'lv' => [
'text' => '拉脱维亚语',
'lang_text' => '',
'con_flag' => '',
],
'lt' => [
'text' => '立陶宛语',
'lang_text' => '',
'con_flag' => '',
],
'lb' => [
'text' => '卢森堡语',
'lang_text' => '',
'con_flag' => '',
],
'mk' => [
'text' => '马其顿语',
'lang_text' => '',
'con_flag' => '',
],
'mg' => [
'text' => '马尔加什语',
'lang_text' => '',
'con_flag' => '',
],
'ms' => [
'text' => '马来语',
'lang_text' => 'Bahasa Melayu',
'con_flag' => 'con_flag/ms.jfif',
'shop_lang' => 'ms-my',
],
'ml' => [
'text' => '马拉雅拉姆文',
'lang_text' => '',
'con_flag' => '',
],
'mt' => [
'text' => '马耳他语',
'lang_text' => '',
'con_flag' => '',
],
'mi' => [
'text' => '毛利语',
'lang_text' => '',
'con_flag' => '',
],
'mr' => [
'text' => '马拉地语',
'lang_text' => '',
'con_flag' => '',
],
'mn' => [
'text' => '蒙古文',
'lang_text' => '',
'con_flag' => '',
],
'my' => [
'text' => '缅甸语',
'lang_text' => '',
'con_flag' => '',
],
'ne' => [
'text' => '尼泊尔语',
'lang_text' => '',
'con_flag' => '',
],
'no' => [
'text' => '挪威语',
'lang_text' => '',
'con_flag' => '',
],
'ny' => [
'text' => '尼杨扎语(齐切瓦语)',
'lang_text' => '',
'con_flag' => '',
],
'or' => [
'text' => '奥里亚语(奥里亚)',
'lang_text' => '',
'con_flag' => '',
],
'ps' => [
'text' => '普什图语',
'lang_text' => '',
'con_flag' => '',
],
'fa' => [
'text' => '波斯语',
'lang_text' => '',
'con_flag' => '',
],
'pl' => [
'text' => '波兰语',
'lang_text' => '',
'con_flag' => '',
],
'pa' => [
'text' => '旁遮普语',
'lang_text' => '',
'con_flag' => '',
],
'ro' => [
'text' => '罗马尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'sm' => [
'text' => '萨摩亚语',
'lang_text' => '',
'con_flag' => '',
],
'gd' => [
'text' => '苏格兰盖尔语',
'lang_text' => '',
'con_flag' => '',
],
'sr' => [
'text' => '塞尔维亚语',
'lang_text' => '',
'con_flag' => '',
],
'st' => [
'text' => '塞索托语',
'lang_text' => '',
'con_flag' => '',
],
'sn' => [
'text' => '修纳语',
'lang_text' => '',
'con_flag' => '',
],
'sd' => [
'text' => '信德语',
'lang_text' => '',
'con_flag' => '',
],
'si' => [
'text' => '僧伽罗语',
'lang_text' => '',
'con_flag' => '',
],
'sk' => [
'text' => '斯洛伐克语',
'lang_text' => '',
'con_flag' => '',
],
'sl' => [
'text' => '斯洛文尼亚语',
'lang_text' => '',
'con_flag' => '',
],
'so' => [
'text' => '索马里语',
'lang_text' => '',
'con_flag' => '',
],
'su' => [
'text' => '巽他语',
'lang_text' => '',
'con_flag' => '',
],
'sw' => [
'text' => '斯瓦希里语',
'lang_text' => '',
'con_flag' => '',
],
'sv' => [
'text' => '瑞典语',
'lang_text' => '',
'con_flag' => '',
],
'tl' => [
'text' => '塔加路语(菲律宾语)',
'lang_text' => 'Pilipino',
'con_flag' => 'con_flag/tl.jfif',
'shop_lang' => 'tl',
],
'tg' => [
'text' => '塔吉克语',
'lang_text' => '',
'con_flag' => '',
],
'ta' => [
'text' => '泰米尔语',
'lang_text' => '',
'con_flag' => '',
],
'tt' => [
'text' => '鞑靼语',
'lang_text' => '',
'con_flag' => '',
],
'te' => [
'text' => '泰卢固语',
'lang_text' => '',
'con_flag' => '',
],
'th' => [
'text' => '泰文',
'lang_text' => 'ไทย',
'con_flag' => 'con_flag/th.jfif',
'shop_lang' => 'th',
],
'tr' => [
'text' => '土耳其语',
'lang_text' => '',
'con_flag' => '',
],
'tk' => [
'text' => '土库曼语',
'lang_text' => '',
'con_flag' => '',
],
'uk' => [
'text' => '乌克兰语',
'lang_text' => '',
'con_flag' => '',
],
'ur' => [
'text' => '乌尔都语',
'lang_text' => '',
'con_flag' => '',
],
'ug' => [
'text' => '维吾尔语',
'lang_text' => '',
'con_flag' => '',
],
'uz' => [
'text' => '乌兹别克语',
'lang_text' => '',
'con_flag' => '',
],
'vi' => [
'text' => '越南语',
'lang_text' => '',
'con_flag' => '',
],
'cy' => [
'text' => '威尔士语',
'lang_text' => '',
'con_flag' => '',
],
'xh' => [
'text' => '班图语',
'lang_text' => '',
'con_flag' => '',
],
'yi' => [
'text' => '意第绪语',
'lang_text' => '',
'con_flag' => '',
],
'yo' => [
'text' => '约鲁巴语',
'lang_text' => '',
'con_flag' => '',
],
'zu' => [
'text' => '祖鲁语',
'lang_text' => '',
'con_flag' => '',
],
];
}
... ...
<?php
namespace App\Http\Controllers\Bside;
use App\Helper\Arr;
use App\Http\Logic\Bside\InquiryLogic;
use App\Http\Requests\Bside\InquiryRequest;
use App\Rules\Ids;
use Illuminate\Http\Request;
/**
* 精准询盘
* Class InquiryController
* @package App\Http\Controllers\Bside
* @author zbj
* @date 2023/5/4
*/
class InquiryController extends BaseController
{
public function index(InquiryLogic $logic)
{
$map = [];
if(!empty($this->param['search'])){
$map[] = ['name|email|content', 'like', "%{$this->param['search']}%"];
}
$sort = ['id' => 'desc'];
$data = $logic->getList($map, $sort, ['id', 'name', 'email', 'phone', 'url', 'ip', 'ip_country', 'status', 'created_at']);
return $this->success($data);
}
public function info(Request $request, InquiryLogic $logic){
$request->validate([
'id'=>'required'
],[
'id.required' => 'ID不能为空'
]);
$data = $logic->getInfo($this->param['id']);
return $this->success(Arr::twoKeepKeys($data, ['id', 'name', 'email', 'phone', 'url', 'ip', 'ip_country', 'status', 'content', 'trans_content', 'created_at']));
}
public function save(InquiryRequest $request, InquiryLogic $logic)
{
$data = $logic->save($this->param);
return $this->success($data);
}
public function delete(Request $request, InquiryLogic $logic)
{
$request->validate([
'ids'=>['required', new Ids()]
],[
'ids.required' => 'ID不能为空'
]);
$data = $logic->delete($this->param['ids']);
return $this->success($data);
}
}
... ...
... ... @@ -29,7 +29,10 @@ class CategoryController extends BaseController
foreach ($data as &$v){
$v['product_num'] = $logic->getProductNum($v['id']);
}
return $this->success(Arr::listToTree($data));
if(!$map){
$data = Arr::listToTree($data);
}
return $this->success($data);
}
public function info(Request $request, CategoryLogic $logic){
... ...
... ... @@ -6,6 +6,7 @@ use App\Helper\Arr;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Product\KeywordLogic;
use App\Http\Requests\Bside\Product\KeywordRequest;
use App\Models\Project\Project;
use App\Rules\Ids;
use Illuminate\Http\Request;
... ... @@ -25,7 +26,13 @@ class KeywordController extends BaseController
$map[] = ['title', 'like', "%{$this->param['search']}%"];
}
$sort = ['id' => 'desc'];
$data = $logic->getList($map, $sort, ['id', 'title', 'route', 'status', 'created_at']);
$data = $logic->getList($map, $sort, ['id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'status', 'created_at']);
foreach ($data['list'] as &$v){
$v['product_num'] = $logic->getProductNum($v['title']);
$v['tdk'] = boolval($v['seo_title']) * boolval($v['seo_keywords']) * boolval($v['seo_description']);
//todo 获取域名 拼接链接
$v['url'] = $v['route'];
}
return $this->success($data);
}
... ... @@ -36,7 +43,7 @@ class KeywordController extends BaseController
'id.required' => 'ID不能为空'
]);
$data = $logic->getInfo($this->param['id']);
return $this->success(Arr::twoKeepKeys($data, ['id', 'title', 'route', 'created_at']));
return $this->success(Arr::twoKeepKeys($data, ['id', 'title', 'seo_title', 'seo_keywords', 'seo_description', 'created_at']));
}
public function save(KeywordRequest $request, KeywordLogic $logic)
... ...
... ... @@ -2,17 +2,54 @@
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingFromLogic;
class WebSettingFromController extends BaseController
{
/**
* @name :lists
* @name :(表单设置详情)info
* @author :lyh
* @method :post
* @time :2023/5/4 13:44
*/
public function info(WebSettingFromLogic $webSettingFromLogic){
$info = $webSettingFromLogic->setting_from_info();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @name :(添加或编辑表单设置)lists
* @author :lyh
* @method :post
* @time :2023/4/28 14:41
*/
public function lists(){
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');
}
}
... ...
... ... @@ -2,17 +2,20 @@
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingHtmlLogic;
class WebSettingHtmlController extends BaseController
{
/**
* @name :lists
* @name :(获取并设置第三方代码)read
* @author :lyh
* @method :post
* @time :2023/4/28 14:45
*/
public function lists(){
public function save(WebSettingHtmlLogic $webSettingHtmlLogic){
$info = $webSettingHtmlLogic->setting_html_save();
$this->response('success',Code::SUCCESS,$info);
}
}
... ...
... ... @@ -2,7 +2,9 @@
namespace App\Http\Controllers\Bside\Setting;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Setting\WebSettingServiceLogic;
class WebSettingServiceController extends BaseController
{
... ... @@ -10,9 +12,31 @@ class WebSettingServiceController extends BaseController
* @name :lists
* @author :lyh
* @method :post
* @time :2023/5/4 11:28
*/
public function lists(WebSettingServiceLogic $webSettingServiceLogic){
$lists = $webSettingServiceLogic->setting_service_info();
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @name :save
* @author :lyh
* @method :post
* @time :2023/4/28 14:46
*/
public function lists(){
public function save(WebSettingServiceLogic $webSettingServiceLogic){
$webSettingServiceLogic->setting_service_save();
$this->response('success');
}
/**
* @name :del
* @author :lyh
* @method :post
* @time :2023/5/4 11:28
*/
public function del(WebSettingServiceLogic $webSettingServiceLogic){
$webSettingServiceLogic->setting_service_del();
$this->response('success');
}
}
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Logic\Bside;
use App\Enums\Common\Code;
use App\Exceptions\BsideGlobalException;
use App\Helper\Common;
use App\Http\Controllers\ImageLogic;
use App\Http\Logic\Logic;
use App\Models\Image as ImageModel;
use Illuminate\Http\Request;
... ... @@ -98,30 +99,8 @@ class BaseLogic extends Logic
* @method
*/
public function upload(){
$image = $this->request->file('image');
if(empty($image)){
return $this->fail('没有上传图片');
}
$hash = hash_file('md5', $image->getPathname());
$url = './../uploads/images/';
$filename = date('ymdHis').rand(10000,99999);
$res = $this->request->file('image')->move($url,$filename);
if ($res === false) {
return $this->fail($image->getError());
}
$imageModel = new ImageModel();
$data = [
'path' => $url.$filename,
'created_at' => date('Y-m-d H:i:s',time()),
'size' => $res->getSize(),
'hash' => $hash.$filename,
'type'=>$image->getClientOriginalExtension(),
];
$rs = $imageModel->add($data);
if ($rs === false) {
return $this->fail('error');
}
return $hash.$filename;
$imageLogic = new ImageLogic();
return $imageLogic->upload();
}
/**
... ...
... ... @@ -110,7 +110,7 @@ class BlogLogic extends BaseLogic
//TODO::删除资源
$imageModel = new Image();
$image_info = $imageModel->read(['hash'=>$info['image']],['id','path']);
shell_exec('sudo rm -rf '.$image_info['path'] .'./../uploads/images/cache_'. $info['image'] . '*');
shell_exec('sudo rm -rf '.$image_info['path'] .' ./../uploads/images/cache_'. $info['image'] . '*');
$imageModel->del(['hash'=>$info['image']]);
}
$this->param['image'] = $this->upload();
... ...
<?php
namespace App\Http\Logic\Bside;
use App\Helper\Arr;
use App\Models\Inquiry;
/**
* Class InquiryLogic
* @package App\Http\Logic\Bside
* @author zbj
* @date 2023/5/4
*/
class InquiryLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new Inquiry();
}
public function getInfo($id)
{
$info = $this->getCacheInfo($id);
if(!$info){
$this->fail('数据不存在或者已经删除');
}
//标记已读
if($info->status == Inquiry::STATUS_UNREAD){
parent::save(['id' => $info['id'], 'status' => Inquiry::STATUS_READ]);
}
return $this->success($info->toArray());
}
public function save($param)
{
$param['ip_info'] = Arr::s2a($param['ip_info']);
$param['ip'] = $param['ip_info']['ip'] ?? '';
$param['ip_country'] = $param['ip_info']['country'] ?? '';
return parent::save($param);
}
}
... ...
... ... @@ -64,7 +64,8 @@ class CategoryLogic extends BaseLogic
* @date 2023/4/28
*/
public function getProductNum($cate_id){
$ids = $this->model->getChildIdsArr($cate_id);
return CategoryRelated::whereIn('cate_id', $ids)->count();
$cate_ids = $this->model->getChildIdsArr($cate_id);
$product_ids = CategoryRelated::whereIn('cate_id', $cate_ids)->pluck('id');
return Product::whereIn('id', $product_ids)->count();
}
}
... ...
... ... @@ -59,4 +59,8 @@ class KeywordLogic extends BaseLogic
return $this->success();
}
public function getProductNum($title){
return Product::whereRaw("find_in_set('{$title}',`keywords`)")->count();
}
}
... ...
... ... @@ -14,4 +14,52 @@ class WebSettingFromLogic extends BaseLogic
$this->model = new WebSettingForm();
$this->param = $this->requestAll;
}
/**
* @name :(获取表单设置详情)setting_from_info
* @author :lyh
* @method :post
* @time :2023/5/4 13:43
*/
public function setting_from_info(){
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->fail('当前数据不存在,或者已被删除');
}
return $this->success($info);
}
/**
* @name :(表单设置)setting_from_save
* @param :(is_required是否必填,name名称)
* @author :lyh
* @method :post
* @time :2023/5/4 10:39
*/
public function setting_from_save(){
if(isset($this->param['id']) && !empty($this->param['id'])){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$this->param['project_id'] = $this->user['project_id'];
$rs = $this->model->add($this->param);
}
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @name :(删除表单设置)setting_from_del
* @param : (id主键)
* @author :lyh
* @method :post
* @time :2023/5/4 11:01
*/
public function setting_from_del(){
$rs = $this->model->del($this->param);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
}
... ...
... ... @@ -14,4 +14,30 @@ class WebSettingHtmlLogic extends BaseLogic
$this->model = new WebSettingHtml();
$this->param = $this->requestAll;
}
/**
* @name :(设置第三方代码)setting_html_info
* @param : (head_html头,body_html中,footer_html尾)
* @author :lyh
* @method :post
* @time :2023/5/4 10:18
*/
public function setting_html_save(){
if(isset($this->param) && !empty($this->param)){
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->param['project_id'] = $this->user['project_id'];
$rs = $this->model->add($this->param);
}else{
$rs = $this->model->edit($this->param,['project_id'=>$this->user['project_id']]);
}
if($rs === false){
$this->fail('error');
}
$info = $this->param;
}else{
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
}
return $this->success($info);
}
}
... ...
... ... @@ -2,8 +2,11 @@
namespace App\Http\Logic\Bside\Setting;
use App\Http\Controllers\ImageLogic;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Image;
use App\Models\WebSetting\WebSettingService;
use Illuminate\Support\Facades\DB;
class WebSettingServiceLogic extends BaseLogic
{
... ... @@ -14,4 +17,58 @@ class WebSettingServiceLogic extends BaseLogic
$this->model = new WebSettingService();
$this->param = $this->requestAll;
}
/**
* @name : (客服设置列表)setting_service_list
* @author :lyh
* @method :post
* @time :2023/5/4 11:23
*/
public function setting_service_info(){
$info = $this->model->read(['project_id'=>$this->param['project_id']]);
return $this->success($info);
}
/**
* @name : (客服设置)setting_service_save
* @author :lyh
* @method :post
* @time :2023/5/4 11:10
*/
public function setting_service_save(){
if(isset($this->param['id'])){
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}else{
$rs = $this->model->add($this->param);
}
if($rs === false){
$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']]);
//删除资源文件
shell_exec('rm -rf '.$info['path']);
}
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
}
}
... ...
... ... @@ -7,6 +7,7 @@ use App\Models\Image as ImageModel;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Facades\Image;
... ... @@ -70,6 +71,34 @@ class ImageLogic
}
return $hash.$filename;
}
/**
* @name :(删除资源及对应表数据)del
* @author :lyh
* @method :post
* @time :2023/5/4 14:57
*/
public function del($hash){
DB::beginTransaction();
$imageModel = new ImageModel();
try {
if(is_array($hash)){
foreach ($hash as $k => $v){
$this->del($v);
}
}else{
$info = $imageModel->read(['hash'=>$hash]);
if($info !== false){
shell_exec('sudo rm -rf '.$info['path']. ' '.$this->path . $info['hash'] .'*');
}
}
$imageModel->del(['hash'=>['in',$hash]]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->response('error',Code::USER_ERROR);
}
}
/**
* 生成缩略图缓存
* @param type $info
... ...
<?php
namespace App\Http\Requests\Bside;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class InquiryRequest
* @package App\Http\Requests\Bside
* @author zbj
* @date 2023/5/4
*/
class InquiryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|max:200',
'email' => 'required|email|max:200',
'phone' => 'max:200',
'content' => 'required',
];
}
public function messages()
{
return [];
}
}
... ...
... ... @@ -7,4 +7,19 @@ class Image extends Base
protected $table = 'gl_image';
public $timestamps = true;
/**
* @param $hash
* @name :(获取图片详情)image_read
* @author :lyh
* @method :post
* @time :2023/5/4 11:50
*/
public function image_read($hash){
$info = $this->read(['hash'=>$hash]);
if(empty($info)){
return false;
}
return $info;
}
}
... ...
<?php
namespace App\Models;
use App\Helper\Arr;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Inquiry
* @package App\Models
* @author zbj
* @date 2023/5/4
*/
class Inquiry extends Base
{
use SoftDeletes;
//设置关联表名
protected $table = 'gl_inquiry';
const STATUS_UNREAD = 0;
const STATUS_READ = 1;
public function setIpInfoAttribute($value){
$this->attributes['ip_info'] = Arr::a2s($value);
}
public function getIpInfoAttribute($value){
return Arr::s2a($value);
}
}
... ...
... ... @@ -111,13 +111,27 @@ Route::middleware(['bloginauth'])->group(function () {
//首页设置
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'lists'])->name('web_setting_lists');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingController::class, 'save'])->name('web_setting_save');
//第三方代码获取与设置
Route::prefix('html')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingHtmlController::class, 'save'])->name('web_setting_html_save');
});
//表单设置
Route::prefix('from')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'info'])->name('web_setting_from_info');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingFromController::class, 'save'])->name('web_setting_from_info');
});
//多语言设置
Route::prefix('country')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingCountryController::class, 'lists'])->name('web_setting_country_lists');
//项目多语言设置详情
Route::any('/info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'info'])->name('web_setting_country_info');
Route::any('/edit', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'edit'])->name('web_setting_country_edit');
});
//客服设置
Route::prefix('service')->group(function () {
Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingServiceController::class, 'lists'])->name('web_setting_service_lists');
Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingServiceController::class, 'save'])->name('web_setting_service_save');
Route::any('/del', [\App\Http\Controllers\Bside\Setting\WebSettingServiceController::class, 'del'])->name('web_setting_service_del');
});
});
//产品
... ... @@ -168,6 +182,13 @@ Route::middleware(['bloginauth'])->group(function () {
Route::prefix('images')->group(function () {
Route::post('/upload', [\App\Http\Controllers\ImageController::class, 'upload'])->name('image_upload');
});
//精准询盘
Route::prefix('inquiry')->group(function () {
Route::get('/', [\App\Http\Controllers\Bside\InquiryController::class, 'index'])->name('inquiry');
Route::get('/info', [\App\Http\Controllers\Bside\InquiryController::class, 'info'])->name('inquiry_info');
Route::any('/delete', [\App\Http\Controllers\Bside\InquiryController::class, 'delete'])->name('inquiry_delete');
});
});
//无需登录验证的路由组
... ... @@ -175,4 +196,7 @@ Route::group([], function () {
Route::any('/login', [\App\Http\Controllers\Bside\ComController::class, 'login'])->name('login');
Route::get('/file/download', [\App\Http\Controllers\Bside\FileController::class, 'download'])->name('file_download');
Route::any('/image/{hash}/{w?}/{h?}', [\App\Http\Controllers\ImageController::class,'index'])->name('image_show');
//添加询盘信息
Route::post('/inquiry/save', [\App\Http\Controllers\Bside\InquiryController::class, 'save'])->name('inquiry_save');
});
... ...