正在显示
5 个修改的文件
包含
59 行增加
和
52 行删除
| @@ -25,6 +25,7 @@ class ATemplateModuleController extends BaseController | @@ -25,6 +25,7 @@ class ATemplateModuleController extends BaseController | ||
| 25 | */ | 25 | */ |
| 26 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ | 26 | public function lists(ATemplateModuleLogic $ATemplateModuleLogic){ |
| 27 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); | 27 | $lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order); |
| 28 | + | ||
| 28 | $this->response('success',Code::SUCCESS,$lists); | 29 | $this->response('success',Code::SUCCESS,$lists); |
| 29 | } | 30 | } |
| 30 | 31 |
| @@ -108,7 +108,7 @@ class BaseController extends Controller | @@ -108,7 +108,7 @@ class BaseController extends Controller | ||
| 108 | $result = [ | 108 | $result = [ |
| 109 | 'msg' => $msg == ' ' ? $code->description : $msg, | 109 | 'msg' => $msg == ' ' ? $code->description : $msg, |
| 110 | 'code' => $code->value, | 110 | 'code' => $code->value, |
| 111 | - 'data' => $this->_extents($data), | 111 | + 'data' => ($data), |
| 112 | ]; | 112 | ]; |
| 113 | $this->header['Content-Type'] = $type; | 113 | $this->header['Content-Type'] = $type; |
| 114 | $this->header['token'] = $this->token; | 114 | $this->header['token'] = $this->token; |
| @@ -137,38 +137,7 @@ class BaseController extends Controller | @@ -137,38 +137,7 @@ class BaseController extends Controller | ||
| 137 | $this->header['token'] = $this->token; | 137 | $this->header['token'] = $this->token; |
| 138 | return response()->json($response,200,$this->header); | 138 | return response()->json($response,200,$this->header); |
| 139 | } | 139 | } |
| 140 | - /** | ||
| 141 | - * @param $data | ||
| 142 | - * @name :返回参数处理 | ||
| 143 | - * @return array|string | ||
| 144 | - * @author :liyuhang | ||
| 145 | - * @method | ||
| 146 | - */ | ||
| 147 | - protected function _extents($data) { | ||
| 148 | - if (empty($data) || !is_array($data)) { | ||
| 149 | - return empty($data) ? is_array($data) ? [] : '' : $data; | ||
| 150 | - } | ||
| 151 | - foreach ($data as $k => $v) { | ||
| 152 | - if (is_array($v)) { | ||
| 153 | - $data[$k] = $this->_extents($v); | ||
| 154 | - } else { | ||
| 155 | - if (is_null($v)) { | ||
| 156 | - $data[$k] = ''; | ||
| 157 | - continue; | ||
| 158 | - } | ||
| 159 | - //获取操作人 | ||
| 160 | - switch ((string) $k) { | ||
| 161 | - case 'operator_id': | ||
| 162 | - if(!empty($v)){ | ||
| 163 | - $name = (new UserModel())->read(['id'=>$v],['id','name']); | ||
| 164 | - $data['operator_name'] = (isset($name['name']) && !empty($name['name'])) ? $name['name'] : '管理员'; | ||
| 165 | - } | ||
| 166 | - break; | ||
| 167 | - } | ||
| 168 | - } | ||
| 169 | - } | ||
| 170 | - return $data; | ||
| 171 | - } | 140 | + |
| 172 | 141 | ||
| 173 | /** | 142 | /** |
| 174 | * @name :写入操作日志 | 143 | * @name :写入操作日志 |
| 1 | -<?php | ||
| 2 | - | ||
| 3 | -namespace App\Http\Controllers\Bside\Project; | ||
| 4 | - | ||
| 5 | -use App\Http\Controllers\Bside\BaseController; | ||
| 6 | - | ||
| 7 | -class ProjectController extends BaseController | ||
| 8 | -{ | ||
| 9 | - /** | ||
| 10 | - * @name :lists | ||
| 11 | - * @author :lyh | ||
| 12 | - * @method :post | ||
| 13 | - * @time :2023/4/28 14:48 | ||
| 14 | - */ | ||
| 15 | - public function lists(){ | ||
| 16 | - | ||
| 17 | - } | ||
| 18 | -} |
| @@ -12,7 +12,6 @@ class ProcessRecords extends Base | @@ -12,7 +12,6 @@ class ProcessRecords extends Base | ||
| 12 | protected $table = 'gl_project_process_records'; | 12 | protected $table = 'gl_project_process_records'; |
| 13 | 13 | ||
| 14 | public function setRecordAttribute($value){ | 14 | public function setRecordAttribute($value){ |
| 15 | - | ||
| 16 | foreach ($value as &$v){ | 15 | foreach ($value as &$v){ |
| 17 | if(isset($v['image']) && !empty($v['image'])){ | 16 | if(isset($v['image']) && !empty($v['image'])){ |
| 18 | foreach ($v['image'] as $kImage => $vImage){ | 17 | foreach ($v['image'] as $kImage => $vImage){ |
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Models\Template; | 3 | namespace App\Models\Template; |
| 4 | 4 | ||
| 5 | +use App\Helper\Arr; | ||
| 5 | use App\Models\Base; | 6 | use App\Models\Base; |
| 6 | 7 | ||
| 7 | /** | 8 | /** |
| @@ -13,4 +14,59 @@ use App\Models\Base; | @@ -13,4 +14,59 @@ use App\Models\Base; | ||
| 13 | class TemplateModule extends Base | 14 | class TemplateModule extends Base |
| 14 | { | 15 | { |
| 15 | protected $table = 'gl_public_template_module'; | 16 | protected $table = 'gl_public_template_module'; |
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @remark :写入器image | ||
| 20 | + * @name :setImageAttribute | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/8/3 16:17 | ||
| 24 | + */ | ||
| 25 | + public function setImageAttribute($value){ | ||
| 26 | + $this->attributes['image'] = basename($value); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * @remark :获取器image | ||
| 31 | + * @name :getImageAttribute | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2023/8/3 16:17 | ||
| 35 | + */ | ||
| 36 | + public function getImageAttribute($value){ | ||
| 37 | + $value = getImageUrl($value); | ||
| 38 | + return $value; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * @remark :写入器images | ||
| 43 | + * @name :setImageAttribute | ||
| 44 | + * @author :lyh | ||
| 45 | + * @method :post | ||
| 46 | + * @time :2023/8/3 16:17 | ||
| 47 | + */ | ||
| 48 | + public function setImagesAttribute($value){ | ||
| 49 | + $arr = explode(',',trim($value,',')); | ||
| 50 | + $arr_images = []; | ||
| 51 | + foreach ($arr as $v){ | ||
| 52 | + $arr_images[] = basename($v); | ||
| 53 | + } | ||
| 54 | + $this->attributes['images'] = implode(',',$arr_images); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * @remark :获取器images | ||
| 59 | + * @name :getImageAttribute | ||
| 60 | + * @author :lyh | ||
| 61 | + * @method :post | ||
| 62 | + * @time :2023/8/3 16:17 | ||
| 63 | + */ | ||
| 64 | + public function getImagesAttribute($value){ | ||
| 65 | + $arr = explode(',',$value); | ||
| 66 | + $value = []; | ||
| 67 | + foreach ($arr as $v){ | ||
| 68 | + $value[] = getImageUrl($v); | ||
| 69 | + } | ||
| 70 | + return $value; | ||
| 71 | + } | ||
| 16 | } | 72 | } |
-
请 注册 或 登录 后发表评论