作者 lyh

gx

@@ -66,7 +66,6 @@ class ShareUser extends Command @@ -66,7 +66,6 @@ class ShareUser extends Command
66 //删除用户第三方配置 66 //删除用户第三方配置
67 if(!empty($v['profile_key'])){ 67 if(!empty($v['profile_key'])){
68 $this->del_profiles($v); 68 $this->del_profiles($v);
69 - continue;  
70 } 69 }
71 //更新数据库 70 //更新数据库
72 $this->save_ayr_share($ayr_share_model,$v); 71 $this->save_ayr_share($ayr_share_model,$v);
@@ -131,7 +131,7 @@ class BaseController extends Controller @@ -131,7 +131,7 @@ class BaseController extends Controller
131 ]; 131 ];
132 $this->header['Content-Type'] = $type; 132 $this->header['Content-Type'] = $type;
133 $this->header['token'] = $this->token; 133 $this->header['token'] = $this->token;
134 - $response = response($result,$result_code,$this->header);; 134 + $response = response($result,$result_code,$this->header);
135 throw new HttpResponseException($response); 135 throw new HttpResponseException($response);
136 } 136 }
137 137
@@ -145,7 +145,6 @@ class BaseController extends Controller @@ -145,7 +145,6 @@ class BaseController extends Controller
145 * @time :2023/6/17 16:34 145 * @time :2023/6/17 16:34
146 */ 146 */
147 protected function _extents($data) { 147 protected function _extents($data) {
148 -  
149 if (empty($data) || !is_array($data)) { 148 if (empty($data) || !is_array($data)) {
150 return empty($data) ? is_array($data) ? [] : '' : $data; 149 return empty($data) ? is_array($data) ? [] : '' : $data;
151 } 150 }
  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Aside;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Logic\Aside\Service\ServiceLogic;
  7 +
  8 +class ServiceController extends BaseController
  9 +{
  10 +
  11 + /**
  12 + * @remark :列表
  13 + * @name :lists
  14 + * @author :lyh
  15 + * @method :post
  16 + * @time :2023/6/25 14:31
  17 + */
  18 + public function lists(ServiceLogic $serviceLogic){
  19 + $lists = $serviceLogic->serviceLists($this->map,$this->page,$this->row,$this->order);
  20 + $this->response('success',Code::SUCCESS,$lists);
  21 + }
  22 +
  23 + /**
  24 + * @remark :企业服务通知详情
  25 + * @name :read
  26 + * @author :lyh
  27 + * @method :post
  28 + * @time :2023/6/25 11:50
  29 + */
  30 + public function read(ServiceLogic $serviceLogic){
  31 + $this->request->validate([
  32 + 'id' => 'required',
  33 + ],[
  34 + 'id.required' => '主键不能为空',
  35 + ]);
  36 + $info = $serviceLogic->serviceRead();
  37 + $this->response('success',Code::SUCCESS,$info);
  38 + }
  39 +
  40 + /**
  41 + * @remark :新增或编辑
  42 + * @name :save
  43 + * @author :lyh
  44 + * @method :post
  45 + * @time :2023/6/25 11:51
  46 + */
  47 + public function save(ServiceLogic $serviceLogic){
  48 + if(isset($this->param['id'])){
  49 + $this->request->validate([
  50 + 'id' => 'required',
  51 + ],[
  52 + 'id.required' => '主键不能为空',
  53 + ]);
  54 + }
  55 + //参数验证
  56 + $this->verifyParam();
  57 + $serviceLogic->serviceSave();
  58 + $this->response('success');
  59 + }
  60 +
  61 + /**
  62 + * @remark :编辑指定状态
  63 + * @name :status
  64 + * @author :lyh
  65 + * @method :post
  66 + * @time :2023/6/25 14:15
  67 + */
  68 + public function status(ServiceLogic $serviceLogic){
  69 + $this->request->validate([
  70 + 'id' => 'required',
  71 + ],[
  72 + 'id.required' => '主键不能为空',
  73 + ]);
  74 + $serviceLogic->serviceStatus();
  75 + $this->response('success');
  76 + }
  77 +
  78 + /**
  79 + * @param ServiceLogic $serviceLogic
  80 + * @remark :删除信息
  81 + * @name :del
  82 + * @author :lyh
  83 + * @method :post
  84 + * @time :2023/6/25 14:26
  85 + */
  86 + public function del(ServiceLogic $serviceLogic){
  87 + $this->request->validate([
  88 + 'id' => 'required|array',
  89 + ],[
  90 + 'id.required' => '主键不能为空',
  91 + ]);
  92 + $serviceLogic->serviceDel();
  93 + $this->response('success');
  94 + }
  95 +
  96 + /**
  97 + * @remark :参数验证
  98 + * @name :validParam
  99 + * @author :lyh
  100 + * @method :post
  101 + * @time :2023/6/25 14:03
  102 + */
  103 + public function verifyParam(){
  104 + $this->request->validate([
  105 + 'address' => 'required',
  106 + 'duty_phone' => 'required',
  107 + 'landline_telephone' => 'required',
  108 + 'free_hotline' => 'required',
  109 + 'enterprise_qq' => 'required',
  110 + 'android' => 'required',
  111 + 'official_account' => 'required',
  112 + 'ios' => 'required',
  113 + 'status' => 'required',
  114 + ],[
  115 + 'address.required' => '地址不能为空',
  116 + 'duty_phone.required' => '值班电话不能为空',
  117 + 'landline_telephone.required' => '座机电话不能为空',
  118 + 'free_hotline.required' => '免费热线不能为空',
  119 + 'enterprise_qq.required' => '企业qq不能为空',
  120 + 'android.required' => '安卓不能为空',
  121 + 'official_account.required' => '公众号不能为空',
  122 + 'ios.required' => 'ios下载地址不能为空',
  123 + 'status.required' => '状态不能为空',
  124 + ]);
  125 + }
  126 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Aside\Service;
  4 +
  5 +use App\Http\Logic\Aside\BaseLogic;
  6 +use App\Models\Service;
  7 +use Illuminate\Support\Facades\DB;
  8 +
  9 +class ServiceLogic extends BaseLogic
  10 +{
  11 + public function __construct()
  12 + {
  13 + parent::__construct();
  14 + $this->model = new Service();
  15 + $this->param = $this->requestAll;
  16 + }
  17 +
  18 + /**
  19 + * @remark :企业服务列表
  20 + * @name :serviceLists
  21 + * @author :lyh
  22 + * @method :post
  23 + * @time :2023/6/25 14:32
  24 + */
  25 + public function serviceLists($map,$page,$row,$order = 'id',$filed = ['*']){
  26 + $lists = $this->model->lists($map,$page,$row,$order,$filed);
  27 + return $this->success($lists);
  28 + }
  29 +
  30 + /**
  31 + * @remark :获取详情
  32 + * @name :serviceRead
  33 + * @author :lyh
  34 + * @method :post
  35 + * @time :2023/6/25 13:44
  36 + */
  37 + public function serviceRead(){
  38 + $info = $this->model->read(['id'=>$this->param['id'],'status'=>0]);
  39 + return $this->success($info);
  40 + }
  41 +
  42 + /**
  43 + * @remark :新增或编辑
  44 + * @name :serviceSave
  45 + * @author :lyh
  46 + * @method :post
  47 + * @time :2023/6/25 13:45
  48 + */
  49 + public function serviceSave(){
  50 + $info = $this->model->read(['id'=>$this->param['id']]);
  51 + if($info === false){
  52 + $rs = $this->model->add($this->param);
  53 + }else{
  54 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
  55 + }
  56 + if($rs === false){
  57 + $this->fail('error');
  58 + }
  59 + return $this->success();
  60 + }
  61 +
  62 + /**
  63 + * @remark :指定状态始终为一条数据
  64 + * @name :serviceStatus
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2023/6/25 14:09
  68 + */
  69 + public function serviceStatus(){
  70 + DB::beginTransaction();
  71 + try {
  72 + $this->model->edit(['status'=>1],['id'=>['!=',$this->param['id']]]);
  73 + $this->model->edit(['status'=>0],['id'=>$this->param['id']]);
  74 + DB::commit();
  75 + }catch (\Exception $e){
  76 + DB::rollBack();
  77 + $this->fail('error');
  78 + }
  79 + return $this->success();
  80 + }
  81 +
  82 + /**
  83 + * @remark :删除企业服务信息
  84 + * @name :serviceDel
  85 + * @author :lyh
  86 + * @method :post
  87 + * @time :2023/6/25 14:22
  88 + */
  89 + public function serviceDel(){
  90 + $rs = $this->model->del(['id'=>['in',$this->param['id']]]);
  91 + if($rs === false){
  92 + $this->fail('error');
  93 + }
  94 + return $this->success();
  95 + }
  96 +}
  1 +<?php
  2 +
  3 +namespace App\Models;
  4 +
  5 +/**
  6 + * @remark :企业服务中心
  7 + * @name :Service
  8 + * @author :lyh
  9 + * @time :2023/6/25 11:53
  10 + */
  11 +class Service extends Base
  12 +{
  13 + protected $table = 'gl_enterprise_service';
  14 +}
@@ -112,6 +112,15 @@ Route::middleware(['aloginauth'])->group(function () { @@ -112,6 +112,15 @@ Route::middleware(['aloginauth'])->group(function () {
112 Route::any('/empowerDomain', [Aside\Project\OptimizeController::class, 'empowerDomain'])->name('admin.empowerDomain'); 112 Route::any('/empowerDomain', [Aside\Project\OptimizeController::class, 'empowerDomain'])->name('admin.empowerDomain');
113 }); 113 });
114 114
  115 + //企业服务配置
  116 + Route::prefix('service')->group(function () {
  117 + Route::any('/', [Aside\ServiceController::class, 'lists'])->name('admin.service_lists');
  118 + Route::any('/read', [Aside\ServiceController::class, 'read'])->name('admin.service_read');
  119 + Route::any('/save', [Aside\ServiceController::class, 'save'])->name('admin.service_save');
  120 + Route::any('/status', [Aside\ServiceController::class, 'status'])->name('admin.service_status');
  121 + Route::any('/del', [Aside\ServiceController::class, 'del'])->name('admin.service_del');
  122 + });
  123 +
115 //项目管理 124 //项目管理
116 Route::prefix('project')->group(function () { 125 Route::prefix('project')->group(function () {
117 Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); 126 Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project');