跟进时间

This commit is contained in:
2025-03-20 10:01:21 +08:00
parent 7fb921dc9f
commit cd580fea23
3 changed files with 11 additions and 6 deletions
+2 -2
View File
@@ -139,13 +139,13 @@ class FollowController
'lat'=>Util::getParam($request,'lat',0), 'lat'=>Util::getParam($request,'lat',0),
'lng'=>Util::getParam($request,'lng',0), 'lng'=>Util::getParam($request,'lng',0),
'address'=>Util::getParam($request,'address'), 'address'=>Util::getParam($request,'address'),
'follow_time'=>Util::getParam($request,'firstFollowtime',0), 'follow_time'=>strtotime(Util::getParam($request,'firstFollowtime',0)),
]; ];
$res = Follow::create($data); $res = Follow::create($data);
$customer = Customer::find($customer_id); $customer = Customer::find($customer_id);
$customer->follow_last = $res->created_at; $customer->follow_last = strtotime($res->created_at);
$customer->save(); $customer->save();
if ($res) { if ($res) {
+1
View File
@@ -90,6 +90,7 @@ class Customer extends Model
$customer = Util::formatDate($customer,['follow_last']); $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['country_name'] = empty($customer['country_id'])?'':Country::where(['id'=>$customer['country_id']])->value('cn_addr');
// $customer['last_follow'] = $last_follow; // $customer['last_follow'] = $last_follow;
return $customer; return $customer;
+8 -4
View File
@@ -37,16 +37,20 @@ class Follow extends Model
*/ */
public $timestamps = true; public $timestamps = true;
protected $dates = ['created_at', 'updated_at', 'follow_time'];
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', // 指定序列化格式 'follow_time' => 'datetime:Y-m-d H:i:s', // 指定序列化格式
'created_at' => 'timestamp', // 指定序列化格式 // 'updated_at' => 'timestamp', // 指定序列化格式
// 'created_at' => 'timestamp', // 指定序列化格式
]; ];
public static function getFollow($follow,$domain = 'https://vehicle-album.oss-cn-beijing.aliyuncs.com') 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['firstFollowtime'] = $follow['follow_time'];
$follow['oss_picture'] = $domain.'/'.$follow['picture']; $follow['oss_picture'] = $domain.'/'.$follow['picture'];
$follow = Util::formatDate($follow); $follow = Util::formatDate($follow);
return $follow; return $follow;