作者 Your Name

gx

  1 +<?php
  2 +
  3 +namespace App\Http\Controllers\Bside\Setting;
  4 +
  5 +use App\Enums\Common\Code;
  6 +use App\Http\Controllers\Bside\BaseController;
  7 +use App\Http\Logic\Bside\Setting\WebSettingReceivingLogic;
  8 +
  9 +/**
  10 + * @name:项目收信设置
  11 + */
  12 +class WebSettingReceivingController extends BaseController
  13 +{
  14 + /**
  15 + * @name :(收信设置列表)lists
  16 + * @author :lyh
  17 + * @method :post
  18 + * @time :2023/5/8 16:22
  19 + */
  20 + public function lists(WebSettingReceivingLogic $webSettingReceivingLogic){
  21 + $lists = $webSettingReceivingLogic->setting_receiving_lists();
  22 + $this->response('success',Code::SUCCESS,$lists);
  23 + }
  24 +
  25 + /**
  26 + * @name :(更新)save
  27 + * @author :lyh
  28 + * @method :post
  29 + * @time :2023/5/8 16:23
  30 + */
  31 + public function save(WebSettingReceivingLogic $webSettingReceivingLogic){
  32 + $lists = $webSettingReceivingLogic->setting_receiving_save();
  33 + $this->response('success');
  34 + }
  35 +}
  1 +<?php
  2 +
  3 +namespace App\Http\Logic\Bside\Setting;
  4 +
  5 +use App\Http\Logic\Bside\BaseLogic;
  6 +use App\Models\WebSetting\WebSettingReceiving;
  7 +use App\Models\WebSetting\WebSettingText;
  8 +
  9 +class WebSettingReceivingLogic extends BaseLogic
  10 +{
  11 + public function __construct()
  12 + {
  13 + parent::__construct();
  14 + $this->model = new WebSettingReceiving();
  15 + $this->param = $this->requestAll;
  16 + }
  17 +
  18 + /**
  19 + * @name :(列表数据)setting_receiving_lists
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2023/5/8 16:17
  23 + */
  24 + public function setting_receiving_lists(){
  25 + $lists = $this->model->list(['project_id'=>$this->user['project_id']]);
  26 + return $this->success($lists);
  27 + }
  28 +
  29 + /**
  30 + * @name :(设置收信账号)setting_receiving_save
  31 + * @author :lyh
  32 + * @method :post
  33 + * @time :2023/5/8 16:26
  34 + */
  35 + public function setting_receiving_save(){
  36 + try {
  37 + $this->model->del(['project_id'=>$this->user['project_id']]);
  38 + foreach ($this->param['data'] as $k => $v){
  39 + $v['project_id'] = $this->user['project_id'];
  40 + $this->param['data'][$k] = $v;
  41 + }
  42 + $this->model->add($this->param['data']);
  43 + }catch (\Exception $e){
  44 + $this->fail('error');
  45 + }
  46 + return $this->success();
  47 + }
  48 +}