|
@@ -2,9 +2,7 @@
|
|
|
|
|
|
namespace App\Service;
|
|
|
|
|
|
-use App\Model\Depart;
|
|
|
use App\Model\Employee;
|
|
|
-use App\Model\EmployeeRole;
|
|
|
use App\Model\FollowUpRecord;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Hash;
|
|
@@ -17,19 +15,14 @@ class FollowUpRecordService extends Service
|
|
|
|
|
|
$model = new FollowUpRecord();
|
|
|
$model = $model->where('id',$data['id'])->first();
|
|
|
- $model->id_card = $data['id_card']??'';
|
|
|
- $model->number = $data['number'] ;
|
|
|
- $model->mobile = $data['mobile'];
|
|
|
- $model->emp_name = $data['emp_name'];
|
|
|
- $model->is_admin = $data['is_admin'];
|
|
|
- if($model->is_admin == 1){
|
|
|
- $model->account = $data['account'];
|
|
|
- if($data['password'] !== '********'){
|
|
|
- $model->password = Hash::make($data['password']);
|
|
|
- }
|
|
|
- }
|
|
|
+ $model->customer_id = $data['customer_id'];
|
|
|
+ $model->basic_type_id = $data['basic_type_id'] ;
|
|
|
+ $model->visit_time = $data['visit_time'];
|
|
|
+ $model->content = $data['content'];
|
|
|
+ $model->is_remind = $data['is_remind'];
|
|
|
$model->save();
|
|
|
- return [true,'保存成功!'];
|
|
|
+
|
|
|
+ return [true,''];
|
|
|
}
|
|
|
|
|
|
public function followUpRecordAdd($data,$user){
|
|
@@ -37,23 +30,18 @@ class FollowUpRecordService extends Service
|
|
|
if(!$status) return [$status,$msg];
|
|
|
|
|
|
$model = new FollowUpRecord();
|
|
|
- $model->id_card = $data['id_card']??'';
|
|
|
- $model->number = $data['number'] ;
|
|
|
- $model->mobile = $data['mobile'];
|
|
|
- $model->emp_name = $data['emp_name'];
|
|
|
- $model->state = 1;
|
|
|
+ $model->customer_id = $data['customer_id'];
|
|
|
+ $model->basic_type_id = $data['basic_type_id'] ;
|
|
|
+ $model->visit_time = $data['visit_time'];
|
|
|
+ $model->content = $data['content'];
|
|
|
+ $model->is_remind = $data['is_remind'];
|
|
|
$model->crt_id = $user['id'];
|
|
|
- $model->is_admin = $data['is_admin'];
|
|
|
- if($model->is_admin == 1){
|
|
|
- $model->account = $data['account'];
|
|
|
- $model->password = Hash::make($data['password']);
|
|
|
- }
|
|
|
$model->save();
|
|
|
|
|
|
- return [true,'保存成功!'];
|
|
|
+ return [true,''];
|
|
|
}
|
|
|
|
|
|
- public function followUpRecordDel($data,){
|
|
|
+ public function followUpRecordDel($data){
|
|
|
if($this->isEmpty($data,'id')) return [false,'ID必须!'];
|
|
|
|
|
|
FollowUpRecord::where('id',$data['id'])->update([
|
|
@@ -65,12 +53,12 @@ class FollowUpRecordService extends Service
|
|
|
|
|
|
public function followUpRecordList($data,$user){
|
|
|
$model = FollowUpRecord::where('del_time',0)
|
|
|
- ->select('number','mobile','emp_name','id','entry_time','leave_time','is_technical','is_admin','state')
|
|
|
+ ->select('customer_id','basic_type_id','visit_time','id','content','is_remind','crt_time','crt_id')
|
|
|
->orderBy('id','desc');
|
|
|
|
|
|
- if(! empty($data['state'])) $model->where('state',$data['state']);
|
|
|
- if(! empty($data['mobile'])) $model->where('mobile', 'LIKE', '%'.$data['mobile'].'%');
|
|
|
- if(! isset($data['all_emp'])) $model->where('id','<>',Employee::SPECIAL_ADMIN);
|
|
|
+ if(! empty($data['customer_id'])) $model->where('customer_id',$data['customer_id']);
|
|
|
+ if(! empty($data['basic_type_id'])) $model->where('basic_type_id', $data['basic_type_id']);
|
|
|
+ if(! empty($data['crt_id'])) $model->where('crt_id',$data['crt_id']);
|
|
|
|
|
|
$list = $this->limit($model,'',$data);
|
|
|
|
|
@@ -89,16 +77,16 @@ class FollowUpRecordService extends Service
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
- public function followUpRecordRule($data,$is_add = true){
|
|
|
- if($this->isEmpty($data,'number')) return [false,'工号不存在!'];
|
|
|
- if($this->isEmpty($data,'mobile')) return [false,'手机号不存在!'];
|
|
|
- if($this->isEmpty($data,'emp_name')) return [false,'姓名不存在!'];
|
|
|
+ public function followUpRecordRule(&$data,$is_add = true){
|
|
|
+ if($this->isEmpty($data,'customer_id')) return [false,'客户不能为空'];
|
|
|
+ if($this->isEmpty($data,'basic_type_id')) return [false,'跟进方式不能为空'];
|
|
|
+ if($this->isEmpty($data,'visit_time')) return [false,'拜访时间不能为空'];
|
|
|
+ if($this->isEmpty($data,'content')) return [false,'跟进内容不能为空'];
|
|
|
+
|
|
|
if(! $is_add){
|
|
|
if($this->isEmpty($data,'id')) return [false,'ID不能为空!'];
|
|
|
-
|
|
|
- }else{
|
|
|
-
|
|
|
}
|
|
|
+ $data['visit_time'] = $this->changeDateToDate($data['visit_time']);
|
|
|
|
|
|
return [true,''];
|
|
|
}
|