Browse Source

fix, 用户分群,remark 为空

liuzejian 1 năm trước cách đây
mục cha
commit
fa70f1c821

+ 6 - 3
modules/Audience/Http/Controllers/UserGroupController.php

@@ -146,11 +146,14 @@ class UserGroupController extends CatchController
             'remark' => 'nullable|string|max:140'
             'remark' => 'nullable|string|max:140'
         ]);
         ]);
 
 
-        $model = UserGroupModel::create([
+        $data = [
             'name' => $request->input('name'), 'uid' => $this->getLoginUserId(),
             'name' => $request->input('name'), 'uid' => $this->getLoginUserId(),
             'tags' => \json_encode($request->input('tags', []), JSON_UNESCAPED_UNICODE),
             'tags' => \json_encode($request->input('tags', []), JSON_UNESCAPED_UNICODE),
-            'remark' => $request->input('remark', '')
-        ]);
+        ];
+        if($request->input('remark')) {
+            $data['remark'] = $request->integer('remark');
+        }
+        $model = UserGroupModel::create($data);
         foreach ($request->input('gzh_ids') as $gzh_id) {
         foreach ($request->input('gzh_ids') as $gzh_id) {
             GzhUgMapModel::create([
             GzhUgMapModel::create([
                 'ug_id' => $model->id, 'gzh_id' => $gzh_id
                 'ug_id' => $model->id, 'gzh_id' => $gzh_id