格式化日期
This commit is contained in:
@@ -74,7 +74,7 @@ class FollowController
|
|||||||
// $host = $request->host();
|
// $host = $request->host();
|
||||||
$url = 'http:'.$request->url();
|
$url = 'http:'.$request->url();
|
||||||
foreach ($data as &$value){
|
foreach ($data as &$value){
|
||||||
$value = Follow::getFollow($value,$url);
|
$value = Follow::getFollow($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Util::success($data,trans('success'));
|
return Util::success($data,trans('success'));
|
||||||
|
|||||||
+10
-6
@@ -41,10 +41,10 @@ class Customer extends Model
|
|||||||
protected $dates = ['deleted_at'];
|
protected $dates = ['deleted_at'];
|
||||||
|
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
// 'updated_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
|
'updated_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
|
||||||
// 'created_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
|
'created_at' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
|
||||||
'updated_at' => 'timestamp', // 指定序列化格式
|
// 'updated_at' => 'timestamp', // 指定序列化格式
|
||||||
'created_at' => 'timestamp', // 指定序列化格式
|
// 'created_at' => 'timestamp', // 指定序列化格式
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function getCustomer($customer)
|
public static function getCustomer($customer)
|
||||||
@@ -70,9 +70,13 @@ class Customer extends Model
|
|||||||
$begin_follow = Follow::select('id','created_at','updated_at')
|
$begin_follow = Follow::select('id','created_at','updated_at')
|
||||||
->where($where)
|
->where($where)
|
||||||
->min('created_at');
|
->min('created_at');
|
||||||
|
|
||||||
|
|
||||||
$customer['begin_follow'] = Util::timeTotDate($begin_follow);
|
$customer['begin_follow'] = Util::timeTotDate($begin_follow);
|
||||||
$customer['created_at'] = Util::timeTotDate($customer['created_at']);
|
// $customer['created_at'] = Util::timeTotDate($customer['created_at']);
|
||||||
$customer['updated_at'] = Util::timeTotDate($customer['updated_at']);
|
// $customer['updated_at'] = Util::timeTotDate($customer['updated_at']);
|
||||||
|
|
||||||
|
$customer = Util::formatDate($customer,['follow_last']);
|
||||||
$customer['car_type_name'] = empty($customer['car_type_id'])?'':CarType::where(['id'=>$customer['car_type_id']])->value('name');
|
$customer['car_type_name'] = empty($customer['car_type_id'])?'':CarType::where(['id'=>$customer['car_type_id']])->value('name');
|
||||||
// $customer['last_follow'] = $last_follow;
|
// $customer['last_follow'] = $last_follow;
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class Follow extends Model
|
|||||||
'created_at' => 'timestamp', // 指定序列化格式
|
'created_at' => 'timestamp', // 指定序列化格式
|
||||||
];
|
];
|
||||||
|
|
||||||
public static function getFollow($follow,$domain = '')
|
public static function getFollow($follow,$domain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com')
|
||||||
{
|
{
|
||||||
$follow['type_txt'] = Constants::FOLLOW[$follow['type']];
|
$follow['type_txt'] = Constants::FOLLOW[$follow['type']];
|
||||||
$follow['oss_picture'] = $domain.'/'.$follow['picture'];
|
$follow['oss_picture'] = $domain.'/'.$follow['picture'];
|
||||||
|
|||||||
Reference in New Issue
Block a user