DiverseYouthNightSchool/application/common/model/school/classes/order/Detail.php

49 lines
925 B
PHP
Raw Normal View History

<?php
namespace app\common\model\school\classes\order;
use think\Model;
class Detail extends Model
{
// 表名
protected $name = 'school_classes_order_detail';
public function setImagesAttr($value, $data)
{
$imagesArray = $value;
if (!empty($value) && is_array($value)) {
//转成逗号拼接字符串
$imagesArray = implode(',', $value);
}
return $imagesArray;
}
public function getHeadimageAttr($value, $data)
{
if (!empty($value)) return cdnurl($value, true);
}
public function getImagesAttr($value, $data)
{
$imagesArray = [];
if (!empty($value)) {
$imagesArray = explode(',', $value);
foreach ($imagesArray as &$v) {
$v = cdnurl($v, true);
}
return $imagesArray;
}
return $imagesArray;
}
}