WebSettingTextLogic.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\WebSetting\WebSetting;
use App\Models\WebSetting\WebSettingText;
use Illuminate\Support\Facades\DB;
class WebSettingTextLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new WebSettingText();
$this->param = $this->requestAll;
}
/**
* @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['anchor_text'] = $anchor_text;
$this->success($lists);
}
/**
* @name :(设置描文本)setting_text_save
* @author :lyh
* @method :post
* @time :2023/5/8 14:39
*/
public function setting_text_save(){
DB::beginTransaction();
try {
//更新描文本设置
$web_setting = new WebSetting();
$web_setting->edit(['anchor_setting'=>$this->param['anchor_setting']],['project_id'=>$this->user['project_id']]);
$this->model->del(['project_id'=>$this->user['project_id']]);
$this->model->add($this->param['data']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('更新失败');
}
$this->success();
}
}