crm
This commit is contained in:
@@ -40,7 +40,8 @@ class FollowController extends BaseController
|
||||
{
|
||||
try {
|
||||
$data = $this->validate(new FollowValidate(), $request->get(), 'list');
|
||||
$result = (new FollowService())->list($request->all(),$request->user->uid);
|
||||
$request->setGet('corp_abbr', $request->basic_data['corp_abbr']);
|
||||
$result = (new FollowService())->list($request->all(), $request->user->uid);
|
||||
return $this->success($result);
|
||||
} catch (\Throwable $e) {
|
||||
return $this->error($e->getMessage());
|
||||
@@ -55,17 +56,17 @@ class FollowController extends BaseController
|
||||
public function detail(Request $request)
|
||||
{
|
||||
//跟进id
|
||||
$id = Util::getParam($request,'id');
|
||||
if(Util::isEmpty($id)){
|
||||
return $this->error('id'.trans('not_null'));
|
||||
$id = Util::getParam($request, 'id');
|
||||
if (Util::isEmpty($id)) {
|
||||
return $this->error('id' . trans('not_null'));
|
||||
}
|
||||
|
||||
$res = Follow::select('id','user_id','customer_id','type','picture','remark','audio','audio_text','lat','lng','address')
|
||||
->where('id',$id)
|
||||
$res = Follow::select('id', 'user_id', 'customer_id', 'type', 'picture', 'remark', 'audio', 'audio_text', 'lat', 'lng', 'address')
|
||||
->where('id', $id)
|
||||
->first();
|
||||
if($res){
|
||||
if ($res) {
|
||||
$res->toArray();
|
||||
}else{
|
||||
} else {
|
||||
return $this->error('记录不存在');
|
||||
}
|
||||
|
||||
@@ -81,32 +82,33 @@ class FollowController extends BaseController
|
||||
*/
|
||||
public function save(Request $request)
|
||||
{
|
||||
$customer_id = Util::getParam($request,'customer_id');
|
||||
$customer_id = Util::getParam($request, 'customer_id');
|
||||
|
||||
if(Util::isEmpty($customer_id)){
|
||||
return $this->error('customer_id'.trans('not_null'));
|
||||
if (Util::isEmpty($customer_id)) {
|
||||
return $this->error('customer_id' . trans('not_null'));
|
||||
}
|
||||
$type = Util::getParam($request,'type');
|
||||
if(Util::isEmpty($type)){
|
||||
return $this->error('type'.trans('not_null'));
|
||||
$type = Util::getParam($request, 'type');
|
||||
if (Util::isEmpty($type)) {
|
||||
return $this->error('type' . trans('not_null'));
|
||||
}
|
||||
$picture = Util::getParam($request,'picture');
|
||||
if(Util::isEmpty($picture)){
|
||||
$picture = Util::getParam($request, 'picture');
|
||||
if (Util::isEmpty($picture)) {
|
||||
return $this->error(trans('picture_not_null'));
|
||||
}
|
||||
|
||||
$data = [
|
||||
'user_id'=>$request->user->uid,
|
||||
'customer_id'=>$customer_id,
|
||||
'type'=>$type,
|
||||
'picture'=>$picture,
|
||||
'remark'=>Util::getParam($request,'remark',''),
|
||||
'audio'=>Util::getParam($request,'audio',''),
|
||||
'audio_text'=>Util::getParam($request,'audio_text',''),
|
||||
'lat'=>Util::getParam($request,'lat',0),
|
||||
'lng'=>Util::getParam($request,'lng',0),
|
||||
'address'=>Util::getParam($request,'address'),
|
||||
'follow_time'=>strtotime(Util::getParam($request,'firstFollowtime',0)),
|
||||
'user_id' => $request->user->uid,
|
||||
'corp_abbr' => $request->basic_data['corp_abbr'],
|
||||
'customer_id' => $customer_id,
|
||||
'type' => $type,
|
||||
'picture' => $picture,
|
||||
'remark' => Util::getParam($request, 'remark', ''),
|
||||
'audio' => Util::getParam($request, 'audio', ''),
|
||||
'audio_text' => Util::getParam($request, 'audio_text', ''),
|
||||
'lat' => Util::getParam($request, 'lat', 0),
|
||||
'lng' => Util::getParam($request, 'lng', 0),
|
||||
'address' => Util::getParam($request, 'address'),
|
||||
'follow_time' => strtotime(Util::getParam($request, 'firstFollowtime', 0)),
|
||||
];
|
||||
|
||||
$res = Follow::create($data);
|
||||
@@ -119,7 +121,7 @@ class FollowController extends BaseController
|
||||
|
||||
$follow_next = Util::getParam($request, 'follow_next', 0);
|
||||
$follow_remark = Util::getParam($request, 'follow_remark', 0);
|
||||
if($res && (!empty($follow_next))){
|
||||
if ($res && (!empty($follow_next))) {
|
||||
$data = [
|
||||
'follow_next' => $follow_next,
|
||||
'follow_remark' => $follow_remark,
|
||||
@@ -130,7 +132,7 @@ class FollowController extends BaseController
|
||||
}
|
||||
|
||||
if ($res) {
|
||||
return $this->success($res,trans('save_success'));
|
||||
return $this->success($res, trans('save_success'));
|
||||
} else {
|
||||
return $this->error(trans('save_fail'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user