作者 lyh

gx

... ... @@ -66,7 +66,6 @@ class ShareUser extends Command
//删除用户第三方配置
if(!empty($v['profile_key'])){
$this->del_profiles($v);
continue;
}
//更新数据库
$this->save_ayr_share($ayr_share_model,$v);
... ...
... ... @@ -131,7 +131,7 @@ class BaseController extends Controller
];
$this->header['Content-Type'] = $type;
$this->header['token'] = $this->token;
$response = response($result,$result_code,$this->header);;
$response = response($result,$result_code,$this->header);
throw new HttpResponseException($response);
}
... ... @@ -145,7 +145,6 @@ class BaseController extends Controller
* @time :2023/6/17 16:34
*/
protected function _extents($data) {
if (empty($data) || !is_array($data)) {
return empty($data) ? is_array($data) ? [] : '' : $data;
}
... ...
<?php
namespace App\Http\Controllers\Aside;
use App\Enums\Common\Code;
use App\Http\Logic\Aside\Service\ServiceLogic;
class ServiceController extends BaseController
{
/**
* @remark :列表
* @name :lists
* @author :lyh
* @method :post
* @time :2023/6/25 14:31
*/
public function lists(ServiceLogic $serviceLogic){
$lists = $serviceLogic->serviceLists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
/**
* @remark :企业服务通知详情
* @name :read
* @author :lyh
* @method :post
* @time :2023/6/25 11:50
*/
public function read(ServiceLogic $serviceLogic){
$this->request->validate([
'id' => 'required',
],[
'id.required' => '主键不能为空',
]);
$info = $serviceLogic->serviceRead();
$this->response('success',Code::SUCCESS,$info);
}
/**
* @remark :新增或编辑
* @name :save
* @author :lyh
* @method :post
* @time :2023/6/25 11:51
*/
public function save(ServiceLogic $serviceLogic){
if(isset($this->param['id'])){
$this->request->validate([
'id' => 'required',
],[
'id.required' => '主键不能为空',
]);
}
//参数验证
$this->verifyParam();
$serviceLogic->serviceSave();
$this->response('success');
}
/**
* @remark :编辑指定状态
* @name :status
* @author :lyh
* @method :post
* @time :2023/6/25 14:15
*/
public function status(ServiceLogic $serviceLogic){
$this->request->validate([
'id' => 'required',
],[
'id.required' => '主键不能为空',
]);
$serviceLogic->serviceStatus();
$this->response('success');
}
/**
* @param ServiceLogic $serviceLogic
* @remark :删除信息
* @name :del
* @author :lyh
* @method :post
* @time :2023/6/25 14:26
*/
public function del(ServiceLogic $serviceLogic){
$this->request->validate([
'id' => 'required|array',
],[
'id.required' => '主键不能为空',
]);
$serviceLogic->serviceDel();
$this->response('success');
}
/**
* @remark :参数验证
* @name :validParam
* @author :lyh
* @method :post
* @time :2023/6/25 14:03
*/
public function verifyParam(){
$this->request->validate([
'address' => 'required',
'duty_phone' => 'required',
'landline_telephone' => 'required',
'free_hotline' => 'required',
'enterprise_qq' => 'required',
'android' => 'required',
'official_account' => 'required',
'ios' => 'required',
'status' => 'required',
],[
'address.required' => '地址不能为空',
'duty_phone.required' => '值班电话不能为空',
'landline_telephone.required' => '座机电话不能为空',
'free_hotline.required' => '免费热线不能为空',
'enterprise_qq.required' => '企业qq不能为空',
'android.required' => '安卓不能为空',
'official_account.required' => '公众号不能为空',
'ios.required' => 'ios下载地址不能为空',
'status.required' => '状态不能为空',
]);
}
}
... ...
<?php
namespace App\Http\Logic\Aside\Service;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Service;
use Illuminate\Support\Facades\DB;
class ServiceLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new Service();
$this->param = $this->requestAll;
}
/**
* @remark :企业服务列表
* @name :serviceLists
* @author :lyh
* @method :post
* @time :2023/6/25 14:32
*/
public function serviceLists($map,$page,$row,$order = 'id',$filed = ['*']){
$lists = $this->model->lists($map,$page,$row,$order,$filed);
return $this->success($lists);
}
/**
* @remark :获取详情
* @name :serviceRead
* @author :lyh
* @method :post
* @time :2023/6/25 13:44
*/
public function serviceRead(){
$info = $this->model->read(['id'=>$this->param['id'],'status'=>0]);
return $this->success($info);
}
/**
* @remark :新增或编辑
* @name :serviceSave
* @author :lyh
* @method :post
* @time :2023/6/25 13:45
*/
public function serviceSave(){
$info = $this->model->read(['id'=>$this->param['id']]);
if($info === false){
$rs = $this->model->add($this->param);
}else{
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
}
if($rs === false){
$this->fail('error');
}
return $this->success();
}
/**
* @remark :指定状态始终为一条数据
* @name :serviceStatus
* @author :lyh
* @method :post
* @time :2023/6/25 14:09
*/
public function serviceStatus(){
DB::beginTransaction();
try {
$this->model->edit(['status'=>1],['id'=>['!=',$this->param['id']]]);
$this->model->edit(['status'=>0],['id'=>$this->param['id']]);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
return $this->success();
}
/**
* @remark :删除企业服务信息
* @name :serviceDel
* @author :lyh
* @method :post
* @time :2023/6/25 14:22
*/
public function serviceDel(){
$rs = $this->model->del(['id'=>['in',$this->param['id']]]);
if($rs === false){
$this->fail('error');
}
return $this->success();
}
}
... ...
<?php
namespace App\Models;
/**
* @remark :企业服务中心
* @name :Service
* @author :lyh
* @time :2023/6/25 11:53
*/
class Service extends Base
{
protected $table = 'gl_enterprise_service';
}
... ...
... ... @@ -112,6 +112,15 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/empowerDomain', [Aside\Project\OptimizeController::class, 'empowerDomain'])->name('admin.empowerDomain');
});
//企业服务配置
Route::prefix('service')->group(function () {
Route::any('/', [Aside\ServiceController::class, 'lists'])->name('admin.service_lists');
Route::any('/read', [Aside\ServiceController::class, 'read'])->name('admin.service_read');
Route::any('/save', [Aside\ServiceController::class, 'save'])->name('admin.service_save');
Route::any('/status', [Aside\ServiceController::class, 'status'])->name('admin.service_status');
Route::any('/del', [Aside\ServiceController::class, 'del'])->name('admin.service_del');
});
//项目管理
Route::prefix('project')->group(function () {
Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project');
... ...