客户标签
This commit is contained in:
@@ -17,7 +17,7 @@ class TagGroupController extends BaseController
|
|||||||
{
|
{
|
||||||
$list = TagGroup::with('tags')->get();
|
$list = TagGroup::with('tags')->get();
|
||||||
$languageArr = Constants::LANGUAGE;
|
$languageArr = Constants::LANGUAGE;
|
||||||
$language = $request->user['language'];
|
$language = 'zh_CN';
|
||||||
foreach ($list as &$item) {
|
foreach ($list as &$item) {
|
||||||
$item['names'] = unserialize($item['names']);
|
$item['names'] = unserialize($item['names']);
|
||||||
if (in_array($language, $languageArr)) {
|
if (in_array($language, $languageArr)) {
|
||||||
@@ -52,11 +52,16 @@ class TagGroupController extends BaseController
|
|||||||
return $this->error( trans('tag_group_id') . trans('not_null'));
|
return $this->error( trans('tag_group_id') . trans('not_null'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
if(empty($tagId)){
|
if(empty($tagId)){
|
||||||
$res = CustomerTag::where(['customer_id' => $customerId, 'group_id' => $groupId])->delete();
|
$res = CustomerTag::where(['customer_id' => $customerId, 'group_id' => $groupId])->delete();
|
||||||
}else{
|
}else{
|
||||||
$res = CustomerTag::updateOrCreate(['customer_id' => $customerId, 'group_id' => $groupId], ['tag_id' => $tagId]);
|
$res = CustomerTag::updateOrCreate(['customer_id' => $customerId, 'group_id' => $groupId], ['tag_id' => $tagId]);
|
||||||
}
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return $this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
if($res){
|
if($res){
|
||||||
return $this->success($res, trans('success'));
|
return $this->success($res, trans('success'));
|
||||||
|
|||||||
@@ -104,5 +104,8 @@ Route::group('/crm', function () {
|
|||||||
Route::any('/customer/statistics', [app\crm\controller\CustomerController::class, 'statistics']);
|
Route::any('/customer/statistics', [app\crm\controller\CustomerController::class, 'statistics']);
|
||||||
Route::any('/customer/getChannel', [app\crm\controller\CustomerController::class, 'getChannel']);
|
Route::any('/customer/getChannel', [app\crm\controller\CustomerController::class, 'getChannel']);
|
||||||
Route::any('/customer/getCountry', [app\crm\controller\CustomerController::class, 'getCountry']);
|
Route::any('/customer/getCountry', [app\crm\controller\CustomerController::class, 'getCountry']);
|
||||||
|
|
||||||
|
Route::any('/tagGroup/list', [app\crm\controller\TagGroupController::class, 'list']);
|
||||||
|
Route::any('/tagGroup/updatePivot', [app\crm\controller\TagGroupController::class, 'updatePivot']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user