From c4bf5ac4f2316110c416fbf4cdec1dddc91f5860 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 12 Oct 2023 10:44:20 +0800
Subject: [PATCH] redbagprod

---
 src/main/resources/templates/febs/views/modules/chat/userList.html |   63 +++++++++++++++++++++++++++++--
 1 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/templates/febs/views/modules/chat/userList.html b/src/main/resources/templates/febs/views/modules/chat/userList.html
index 2816edb..e9b1750 100644
--- a/src/main/resources/templates/febs/views/modules/chat/userList.html
+++ b/src/main/resources/templates/febs/views/modules/chat/userList.html
@@ -69,6 +69,13 @@
     <input type="checkbox" value={{d.userId}} lay-text="是|否" lay-skin="switch" lay-filter="switchIsRobot">
     {{# } }}
 </script>
+<script type="text/html" id="switchModelType">
+    {{# if(d.modelType === 1) { }}
+    <input type="checkbox" value={{d.userId}} lay-text="简单模式|困难模式" checked lay-skin="switch" lay-filter="switchModelType">
+    {{# } else { }}
+    <input type="checkbox" value={{d.userId}} lay-text="简单模式|困难模式" lay-skin="switch" lay-filter="switchModelType">
+    {{# } }}
+</script>
 <style>
     .layui-form-onswitch {
         background-color: #5FB878 !important;
@@ -76,7 +83,7 @@
 </style>
 <script type="text/html" id="toolbar">
     <div class="layui-btn-container">
-        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="registerMember">添加机器人</button>
+        <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="registerMember">添加会员</button>
         <button class="layui-btn layui-btn-normal layui-btn-sm" type="button" lay-event="balance">拨付余额</button>
     </div>
 </script>
@@ -140,6 +147,7 @@
                     {field: 'avaAmount', title: '账户余额', minWidth: 80,align:'left',totalRow: '{{= parseInt(d.avaAmount) }}',align:'center'},
                     {field: 'status', title: '账号状态', templet: '#switchStatus', minWidth: 80,align:'center'},
                     {field: 'isRobot', title: '机器人', templet: '#switchIsRobot', minWidth: 80,align:'center'},
+                    {field: 'modelType', title: '模式', templet: '#switchModelType', minWidth: 80,align:'center'},
                     {field: 'createTime', title: '注册时间', minWidth: 180,align:'center'},
                 ]]
             });
@@ -149,11 +157,24 @@
             var data = obj.data,
                 layEvent = obj.event;
 
+            // if (layEvent === 'registerMember') {
+            //     febs.get(ctx + 'admin/chat/registerMember/', null, function () {
+            //         febs.alert.success('操作成功');
+            //         $query.click();
+            //     });
+            // }
+
             if (layEvent === 'registerMember') {
-                febs.get(ctx + 'admin/chat/registerMember/', null, function () {
-                    febs.alert.success('操作成功');
-                    $query.click();
-                });
+                var checkData = table.checkStatus('userChatTable').data;
+                if (checkData.length <= 0) {
+                    febs.alert.warn('请选择需要的用户');
+                    return;
+                }
+                if (checkData.length > 1) {
+                    febs.alert.warn('请选择一个用户');
+                    return;
+                }
+                registerMember("添加会员", checkData[0].inviteId, 1);
             }
 
             if (layEvent === 'balance') {
@@ -170,6 +191,18 @@
             }
         });
 
+        function registerMember(text, inviteId, type) {
+            febs.modal.open(text, 'modules/chat/mallRegisterMember/'+ inviteId, {
+                btn: ['提交', '取消'],
+                yes: function (index, layero) {
+                    $('#chat-register-member').find('#submit').trigger('click');
+                },
+                btn2: function () {
+                    layer.closeAll();
+                }
+            });
+        }
+
         function systemPay(text, userId, type) {
             febs.modal.open(text, 'modules/chat/mallSystemPay/'+ userId, {
                 btn: ['提交', '取消'],
@@ -182,6 +215,26 @@
             });
         }
 
+        form.on('switch(switchModelType)', function (data) {
+            if (data.elem.checked) {
+                openModelType(data.value);
+            } else {
+                closeModelType(data.value);
+            }
+        })
+        function openModelType(userId) {
+            febs.get(ctx + 'admin/chat/openModelType/' + userId, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+        function closeModelType(userId) {
+            febs.get(ctx + 'admin/chat/closeModelType/' + userId, null, function () {
+                febs.alert.success('操作成功');
+                $query.click();
+            });
+        }
+
         form.on('switch(switchStatus)', function (data) {
             if (data.elem.checked) {
                 openAccount(data.value);

--
Gitblit v1.9.1