作者 lyh

gx

... ... @@ -25,6 +25,7 @@ class ATemplateModuleController extends BaseController
*/
public function lists(ATemplateModuleLogic $ATemplateModuleLogic){
$lists = $ATemplateModuleLogic->aTemplateModuleLists($this->map,$this->page,$this->row,$this->order);
$this->response('success',Code::SUCCESS,$lists);
}
... ...
... ... @@ -108,7 +108,7 @@ class BaseController extends Controller
$result = [
'msg' => $msg == ' ' ? $code->description : $msg,
'code' => $code->value,
'data' => $this->_extents($data),
'data' => ($data),
];
$this->header['Content-Type'] = $type;
$this->header['token'] = $this->token;
... ... @@ -137,38 +137,7 @@ class BaseController extends Controller
$this->header['token'] = $this->token;
return response()->json($response,200,$this->header);
}
/**
* @param $data
* @name :返回参数处理
* @return array|string
* @author :liyuhang
* @method
*/
protected function _extents($data) {
if (empty($data) || !is_array($data)) {
return empty($data) ? is_array($data) ? [] : '' : $data;
}
foreach ($data as $k => $v) {
if (is_array($v)) {
$data[$k] = $this->_extents($v);
} else {
if (is_null($v)) {
$data[$k] = '';
continue;
}
//获取操作人
switch ((string) $k) {
case 'operator_id':
if(!empty($v)){
$name = (new UserModel())->read(['id'=>$v],['id','name']);
$data['operator_name'] = (isset($name['name']) && !empty($name['name'])) ? $name['name'] : '管理员';
}
break;
}
}
}
return $data;
}
/**
* @name :写入操作日志
... ...
<?php
namespace App\Http\Controllers\Bside\Project;
use App\Http\Controllers\Bside\BaseController;
class ProjectController extends BaseController
{
/**
* @name :lists
* @author :lyh
* @method :post
* @time :2023/4/28 14:48
*/
public function lists(){
}
}
... ... @@ -12,7 +12,6 @@ class ProcessRecords extends Base
protected $table = 'gl_project_process_records';
public function setRecordAttribute($value){
foreach ($value as &$v){
if(isset($v['image']) && !empty($v['image'])){
foreach ($v['image'] as $kImage => $vImage){
... ...
... ... @@ -2,6 +2,7 @@
namespace App\Models\Template;
use App\Helper\Arr;
use App\Models\Base;
/**
... ... @@ -13,4 +14,59 @@ use App\Models\Base;
class TemplateModule extends Base
{
protected $table = 'gl_public_template_module';
/**
* @remark :写入器image
* @name :setImageAttribute
* @author :lyh
* @method :post
* @time :2023/8/3 16:17
*/
public function setImageAttribute($value){
$this->attributes['image'] = basename($value);
}
/**
* @remark :获取器image
* @name :getImageAttribute
* @author :lyh
* @method :post
* @time :2023/8/3 16:17
*/
public function getImageAttribute($value){
$value = getImageUrl($value);
return $value;
}
/**
* @remark :写入器images
* @name :setImageAttribute
* @author :lyh
* @method :post
* @time :2023/8/3 16:17
*/
public function setImagesAttribute($value){
$arr = explode(',',trim($value,','));
$arr_images = [];
foreach ($arr as $v){
$arr_images[] = basename($v);
}
$this->attributes['images'] = implode(',',$arr_images);
}
/**
* @remark :获取器images
* @name :getImageAttribute
* @author :lyh
* @method :post
* @time :2023/8/3 16:17
*/
public function getImagesAttribute($value){
$arr = explode(',',$value);
$value = [];
foreach ($arr as $v){
$value[] = getImageUrl($v);
}
return $value;
}
}
... ...