ServiceLogic.php
1.8 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
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace App\Http\Logic\Aside\Service;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Service\Service;
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){
$map['type'] = 1;
$lists = $this->model->list($map,'created_at');
foreach ($lists as $k => $v){
switch ($v['key']){
case 'images':
$arr = explode(',',$v['values']);
foreach ($arr as $k1 => $v1){
$v['images_link'][$k1] = getImageUrl($v1);
}
break;
case 'android':
$v['android_link'] = getImageUrl($v['values']);
break;
case 'official_account':
$v['android_link'] = getImageUrl($v['values']);
break;
case 'ios':
$v['ios_link'] = getImageUrl($v['values']);
break;
}
$lists[$k] = $v;
}
return $this->success($lists);
}
/**
* @remark :新增或编辑
* @name :serviceSave
* @author :lyh
* @method :post
* @time :2023/6/25 13:45
*/
public function serviceSave(){
//删除以前的配置
try {
$this->model->del(['type'=>1]);
$this->model->insert($this->param['data']);
}catch (\Exception $e){
$this->fail('error');
}
return $this->success();
}
}