bianjunhui 2 سال پیش
والد
کامیت
e16a3b5d7b
3فایلهای تغییر یافته به همراه20 افزوده شده و 36 حذف شده
  1. 2 10
      application/admin/view/user/user/index.html
  2. 15 0
      application/api/controller/Message.php
  3. 3 26
      public/assets/js/backend/user/user.js

+ 2 - 10
application/admin/view/user/user/index.html

@@ -6,18 +6,10 @@
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">
                     <div id="toolbar" class="toolbar">
-                        {:build_toolbar('refresh,edit,del')}
-                        <div class="dropdown btn-group {:$auth->check('user/user/multi')?'':'hide'}">
-                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
-                            <ul class="dropdown-menu text-left" role="menu">
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
-                            </ul>
-                        </div>
+                        {:build_toolbar('refresh')}
+
                     </div>
                     <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('user/user/edit')}"
-                           data-operate-del="{:$auth->check('user/user/del')}"
                            width="100%">
                     </table>
                 </div>

+ 15 - 0
application/api/controller/Message.php

@@ -20,6 +20,7 @@ use onesignal\client\model\ExportPlayersRequestBody;
 use onesignal\client\model\Segment;
 use onesignal\client\model\FilterExpressions;
 use GuzzleHttp;
+use app\common\model\User;
 class Message extends Api
 {
     protected $noNeedLogin = ['*'];
@@ -42,6 +43,20 @@ class Message extends Api
         print_r($getPlayersResult->getPlayers());
     }
 
+    public function addPlayers()
+    {
+        $data=$this->request->post();
+        $user = User::getByUserId($data['user_id']);
+        if ($user) {
+            $user->group_id = $data['group_id'];
+            $user->save();
+        }else{
+             User::create($data, true);
+        }
+        $this->success();
+    }
+
+
     function createNotification($enContent){
         $content = new StringMap();
         $content->setEn($enContent);

+ 3 - 26
public/assets/js/backend/user/user.js

@@ -6,10 +6,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             Table.api.init({
                 extend: {
                     index_url: 'user/user/index',
-                    add_url: 'user/user/add',
-                    edit_url: 'user/user/edit',
-                    del_url: 'user/user/del',
-                    multi_url: 'user/user/multi',
                     table: 'user',
                 }
             });
@@ -25,23 +21,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id'), sortable: true},
-                        {field: 'group.name', title: __('Group')},
-                        {field: 'username', title: __('Username'), operate: 'LIKE'},
-                        {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
+                        {field: 'group.name', title: __('分组'), operate: 'LIKE'},
+                        {field: 'user_id', title: __('用户ID')},
                         {field: 'email', title: __('Email'), operate: 'LIKE'},
-                        {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
-                        {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
-                        {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
-                        {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
-                        {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
-                        {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
-                        {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
-                        {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
-                        {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
-                        {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
-                        {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
-                        {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'createtime', title: __('创建时间'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
                     ]
                 ]
             });
@@ -49,12 +32,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             // 为表格绑定事件
             Table.api.bindevent(table);
         },
-        add: function () {
-            Controller.api.bindevent();
-        },
-        edit: function () {
-            Controller.api.bindevent();
-        },
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"));