Procházet zdrojové kódy

feat(front): 后台操作排序

Go před 5 roky
rodič
revize
1991321b06

+ 6 - 3
front/project/admin/components/QuestionNoList/index.js

@@ -33,9 +33,12 @@ export default class QuestionNoList extends Component {
 
   orderQuestion(oldIndex, newIndex) {
     const { questionNos, loading } = this.state;
-    const tmp = questionNos[oldIndex];
-    questionNos[oldIndex] = questionNos[newIndex];
-    questionNos[newIndex] = tmp;
+    const tmp = questionNos.splice(oldIndex, 1);
+    if (newIndex === questionNos.length) {
+      questionNos.push(tmp[0]);
+    } else {
+      questionNos.splice(newIndex, 0, tmp[0]);
+    }
     this.setState({ questionNos, loading: loading + 1 });
     this.props.onChange(questionNos);
   }

+ 6 - 3
front/project/admin/routes/interaction/askQuestionDetail/page.js

@@ -46,9 +46,12 @@ export default class extends Page {
   orderQuestion(oldIndex, newIndex) {
     const { data } = this.state;
     const { others = [] } = data;
-    const tmp = others[oldIndex];
-    others[oldIndex] = others[newIndex];
-    others[newIndex] = tmp;
+    const tmp = others.splice(oldIndex, 1);
+    if (newIndex === others.length) {
+      others.push(tmp[0]);
+    } else {
+      others.splice(newIndex, 0, tmp[0]);
+    }
     this.setState({ others });
   }
 

+ 3 - 3
front/project/admin/routes/interaction/comment/page.js

@@ -134,11 +134,10 @@ export default class extends Page {
       };
     }, this.state.search.userId ? Number(this.state.search.userId) : null, null);
     this.changeSearch(this.filterForm, this, this.state.search.channel, this.state.search.position);
-    this.state.search.channel = this.state.search.channel ? this.state.search.channel.split('-') : '';
   }
 
   changeSearch(list, component, key, value) {
-    if (key === 'course-video' || key === 'course-vs' || key === 'course_data') {
+    if (key === 'course-video' || key === 'course-vs' || key === 'course-package' || key === 'course_data') {
       bindSearch(list, 'position', component, (search) => {
         if (key === 'course-video') {
           return Course.list(Object.assign({ courseModule: 'video' }, search));
@@ -184,12 +183,13 @@ export default class extends Page {
   }
 
   renderView() {
+    const { search } = this.state;
     return <Block flex>
       <FilterLayout
         show
         ref={(ref) => { this.filterF = ref; }}
         itemList={this.filterForm}
-        data={this.state.search}
+        data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
           this.search(data);

+ 3 - 3
front/project/admin/routes/interaction/faq/page.js

@@ -178,11 +178,10 @@ export default class extends Page {
       };
     }, this.state.search.userId ? Number(this.state.search.userId) : null, null);
     this.changeSearch(this.filterForm, this, this.state.search.channel, this.state.search.position);
-    this.state.search.channel = this.state.search.channel ? this.state.search.channel.split('-') : '';
   }
 
   changeSearch(list, component, key, value) {
-    if (key === 'course-video' || key === 'course_data') {
+    if (key === 'course-video' || key === 'course-vs' || key === 'course-package' || key === 'course_data') {
       bindSearch(list, 'position', component, (search) => {
         if (key === 'course-video') {
           return Course.list(Object.assign({ courseModule: 'video' }, search));
@@ -242,12 +241,13 @@ export default class extends Page {
   }
 
   renderView() {
+    const { search } = this.state;
     return <Block flex>
       <FilterLayout
         show
         ref={(ref) => { this.filterF = ref; }}
         itemList={this.filterForm}
-        data={this.state.search}
+        data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
           this.search(data);

+ 14 - 8
front/project/admin/routes/show/ad/page.js

@@ -24,6 +24,8 @@ const AdChannelMap = getMap(AdChannelFlatten, 'value', 'label');
 
 const AdPlaceTree = formatTreeData([].concat(AdChannelFlatten.map(row => Object.assign({}, row)), AdPlace), 'value', 'label', 'parent');
 const AdPlaceChannelMap = getMap(AdPlaceTree, 'value', 'children');
+const AdPlaceMap = getMap(AdPlaceTree, 'value', 'label', 'children');
+console.log(AdPlaceTree, AdPlaceMap);
 export default class extends Page {
   init() {
     this.formF = null;
@@ -89,6 +91,9 @@ export default class extends Page {
     }, {
       title: '位置',
       dataIndex: 'place',
+      render: (text, record) => {
+        return (AdPlaceMap[record.channel] || {})[text];
+      },
     }, {
       title: '广告名称',
       dataIndex: 'title',
@@ -125,24 +130,24 @@ export default class extends Page {
     } else {
       list[index].disabled = true;
     }
-    if (!value) component.setFieldsValue({ [list[index].key]: null });
+    component.setFieldsValue({ [list[index].key]: value });
     component.setState({ load: false });
   }
 
   initData() {
-    System.listAd(this.state.search).then(result => {
+    System.listAd(Object.assign({}, this.state.search)).then(result => {
       this.setTableData(result.list, result.total);
     });
   }
 
   addAction() {
     asyncForm('创建广告', this.itemList, {}, data => {
-      if (data.time.length > 0) {
+      if (data.time && data.time.length > 0) {
         data.startTime = data.time[0].format('YYYY-MM-DD HH:mm:ss');
         data.endTime = data.time[1].format('YYYY-MM-DD HH:mm:ss');
       }
       data.channel = data.channel.join('-');
-      return System.addComment(data).then(() => {
+      return System.addAd(data).then(() => {
         asyncSMessage('添加成功!');
         this.refresh();
       });
@@ -153,14 +158,15 @@ export default class extends Page {
   }
 
   editAction(row) {
-    row.channel = row.split('-');
-    asyncForm('编辑广告', this.itemList, row, data => {
-      if (data.time.length > 0) {
+    const info = Object.assign({}, row);
+    info.channel = info.channel.split('-');
+    asyncForm('编辑广告', this.itemList, info, data => {
+      if (data.time && data.time.length > 0) {
         data.startTime = data.time[0].format('YYYY-MM-DD HH:mm:ss');
         data.endTime = data.time[1].format('YYYY-MM-DD HH:mm:ss');
       }
       data.channel = data.channel.join('-');
-      return System.editComment(data).then(() => {
+      return System.editAd(data).then(() => {
         asyncSMessage('编辑成功!');
         this.refresh();
       });

+ 84 - 9
front/project/admin/routes/show/comment/page.js

@@ -1,13 +1,14 @@
 import React from 'react';
+import { Row, Button, Switch, Col, List, Icon } from 'antd';
 import './index.less';
 import Page from '@src/containers/Page';
 import Block from '@src/components/Block';
 import FilterLayout from '@src/layouts/FilterLayout';
 import ActionLayout from '@src/layouts/ActionLayout';
 import TableLayout from '@src/layouts/TableLayout';
+import DragList from '@src/components/DragList';
 import { getMap, formatDate, bindSearch, formatTreeData, flattenTree } from '@src/services/Tools';
 import { asyncSMessage, asyncForm } from '@src/services/AsyncTools';
-import { Switch } from 'antd';
 import { CommentChannel, SystemSelect } from '../../../../Constant';
 import { System } from '../../../stores/system';
 import { Course } from '../../../stores/course';
@@ -31,7 +32,16 @@ export default class extends Page {
       key: 'switch',
       name: '切换模式',
       render: () => {
-        return <Switch on />;
+        const { channel, position } = this.state.search;
+        let d = false;
+        if (channel === 'course-video' || channel === 'course-vs' || channel === 'course-package' || channel === 'course_data') {
+          d = !position;
+        } else {
+          d = !channel;
+        }
+        return <Switch disabled={d} checked={this.state.mode === 'order'} checkedChildren='排序模式' unCheckedChildren='列表模式' onChange={(value) => {
+          this.changeModel(value);
+        }} />;
       },
     }];
     this.formF = null;
@@ -141,11 +151,10 @@ export default class extends Page {
       },
     }];
     this.changeSearch(this.filterForm, this, this.state.search.channel, this.state.search.position);
-    this.state.search.channel = this.state.search.channel ? this.state.search.channel.split('-') : '';
   }
 
   changeSearch(list, component, key, value, index = 1) {
-    if (key === 'course-video' || key === 'course-vs' || key === 'course_data') {
+    if (key === 'course-video' || key === 'course-vs' || key === 'course-package' || key === 'course_data') {
       bindSearch(list, 'position', component, (search) => {
         if (key === 'course-video') {
           return Course.list(Object.assign({ courseModule: 'video' }, search));
@@ -169,11 +178,31 @@ export default class extends Page {
   }
 
   initData() {
+    if (!this.state.search.order) {
+      this.state.search.order = '`order`';
+      this.state.search.direction = 'desc';
+    }
     System.listComment(Object.assign({ isSpecial: true }, this.state.search)).then(result => {
       this.setTableData(result.list, result.total);
     });
   }
 
+  changeModel(value) {
+    const { search, page } = this.state;
+    if (value) {
+      search.size = page.total;
+      search.order = '`order`';
+      search.direction = 'desc';
+      this.setState({ mode: 'order', search });
+    } else {
+      search.size = 20;
+      search.order = null;
+      search.direction = null;
+      this.setState({ mode: null, search });
+    }
+    this.initData();
+  }
+
   addAction() {
     asyncForm('创建评价', this.itemList, {}, data => {
       data.isShow = 1;
@@ -195,8 +224,9 @@ export default class extends Page {
     if (row.userId) {
       item = this.userItemList;
     }
-    row.channel = row.split('-');
-    asyncForm('编辑', item, row, data => {
+    const info = Object.assign({}, row);
+    info.channel = info.channel.split('-');
+    asyncForm('编辑', item, info, data => {
       data.channel = data.channel.join('-');
       return System.editComment(data).then(() => {
         asyncSMessage('编辑成功!');
@@ -215,13 +245,33 @@ export default class extends Page {
     });
   }
 
+  order(oldIndex, newIndex) {
+    const { list } = this.state;
+    const tmp = list.splice(oldIndex, 1);
+    if (newIndex === list.length) {
+      list.push(tmp[0]);
+    } else {
+      list.splice(newIndex, 0, tmp[0]);
+    }
+    this.setState({ list });
+  }
+
+  submit() {
+    const { list } = this.state;
+    System.orderComment({ ids: list.map(row => row.id) }).then(() => {
+      asyncSMessage('操作成功!');
+      this.refresh();
+    });
+  }
+
   renderView() {
+    const { search } = this.state;
     return <Block flex>
       <FilterLayout
         show
         ref={(ref) => { this.filterF = ref; }}
         itemList={this.filterForm}
-        data={this.state.search}
+        data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
           this.search(data);
@@ -231,7 +281,7 @@ export default class extends Page {
         selectedKeys={this.state.selectedKeys}
         onAction={key => this.onAction(key)}
       />
-      <TableLayout
+      {!this.state.mode && <TableLayout
         columns={this.tableSort(this.columns)}
         list={this.state.list}
         pagination={this.state.page}
@@ -239,7 +289,32 @@ export default class extends Page {
         onChange={(pagination, filters, sorter) => this.tableChange(pagination, filters, sorter)}
         onSelect={(keys, rows) => this.tableSelect(keys, rows)}
         selectedKeys={this.state.selectedKeys}
-      />
+      />}
+      {this.state.mode === 'order' && <DragList
+        loading={this.props.core.loading}
+        dataSource={this.state.list || []}
+        handle={'.icon'}
+        rowKey={'id'}
+        onMove={(oldIndex, newIndex) => {
+          this.order(oldIndex, newIndex);
+        }}
+        renderItem={(item) => (
+          <List.Item actions={[<Icon type='bars' className='icon' />]}>
+            <Row style={{ width: '100%' }}>
+              <Col span={8}>昵称:{item.user ? item.user.nickname : item.nickname}</Col>
+              <Col span={15} offset={1}>评论:{item.content}</Col>
+            </Row>
+          </List.Item>
+        )}
+      />}
+      {this.state.mode === 'order' && <Row type="flex" justify="center">
+        <Col>
+          <Button type="primary" onClick={() => {
+            this.submit();
+          }}>保存</Button>
+        </Col>
+      </Row>}
+
     </Block>;
   }
 }

+ 88 - 7
front/project/admin/routes/show/faq/page.js

@@ -1,10 +1,12 @@
 import React from 'react';
+import { Row, Button, Switch, Col, List, Icon } from 'antd';
 import './index.less';
 import Page from '@src/containers/Page';
 import Block from '@src/components/Block';
 import FilterLayout from '@src/layouts/FilterLayout';
 import ActionLayout from '@src/layouts/ActionLayout';
 import TableLayout from '@src/layouts/TableLayout';
+import DragList from '@src/components/DragList';
 import { getMap, formatDate, bindSearch, formatTreeData, flattenTree } from '@src/services/Tools';
 import { asyncSMessage, asyncForm } from '@src/services/AsyncTools';
 import { FaqChannel, SystemSelect } from '../../../../Constant';
@@ -27,6 +29,21 @@ export default class extends Page {
       key: 'add',
       type: 'primary',
       name: '创建',
+    }, {
+      key: 'switch',
+      name: '切换模式',
+      render: () => {
+        const { channel, position } = this.state.search;
+        let d = false;
+        if (channel === 'course-video' || channel === 'course-vs' || channel === 'course-package' || channel === 'course_data') {
+          d = !position;
+        } else {
+          d = !channel;
+        }
+        return <Switch disabled={d} checked={this.state.mode === 'order'} checkedChildren='排序模式' unCheckedChildren='列表模式' onChange={(value) => {
+          this.changeModel(value);
+        }} />;
+      },
     }];
     this.formF = null;
     this.itemList = [{
@@ -120,11 +137,10 @@ export default class extends Page {
     }];
 
     this.changeSearch(this.filterForm, this, this.state.search.channel, this.state.search.position);
-    this.state.search.channel = this.state.search.channel ? this.state.search.channel.split('-') : '';
   }
 
   changeSearch(list, component, key, value, index = 1) {
-    if (key === 'course-video' || key === 'course_data') {
+    if (key === 'course-video' || key === 'course-vs' || key === 'course-package' || key === 'course_data') {
       bindSearch(list, 'position', component, (search) => {
         if (key === 'course-video') {
           return Course.list(Object.assign({ courseModule: 'video' }, search));
@@ -148,11 +164,31 @@ export default class extends Page {
   }
 
   initData() {
+    if (!this.state.search.order) {
+      this.state.search.order = '`order`';
+      this.state.search.direction = 'desc';
+    }
     System.listFAQ(Object.assign({ isSpecial: true }, this.state.search)).then(result => {
       this.setTableData(result.list, result.total);
     });
   }
 
+  changeModel(value) {
+    const { search, page } = this.state;
+    if (value) {
+      search.order = '`order`';
+      search.direction = 'desc';
+      search.size = page.total;
+      this.setState({ mode: 'order', search });
+    } else {
+      search.size = 20;
+      search.order = null;
+      search.direction = null;
+      this.setState({ mode: null, search });
+    }
+    this.initData();
+  }
+
   addAction() {
     asyncForm('创建', this.itemList, {}, data => {
       data.isShow = 1;
@@ -170,8 +206,9 @@ export default class extends Page {
   }
 
   editAction(row) {
-    row.channel = row.split('-');
-    asyncForm('编辑', this.itemList, row, data => {
+    const info = Object.assign({}, row);
+    info.channel = info.channel.split('-');
+    asyncForm('编辑', this.itemList, info, data => {
       data.channel = data.channel.join('-');
       return System.editFAQ(data).then(() => {
         asyncSMessage('编辑成功!');
@@ -190,13 +227,33 @@ export default class extends Page {
     });
   }
 
+  order(oldIndex, newIndex) {
+    const { list } = this.state;
+    const tmp = list.splice(oldIndex, 1);
+    if (newIndex === list.length) {
+      list.push(tmp[0]);
+    } else {
+      list.splice(newIndex, 0, tmp[0]);
+    }
+    this.setState({ list });
+  }
+
+  submit() {
+    const { list } = this.state;
+    System.orderComment({ ids: list.map(row => row.id) }).then(() => {
+      asyncSMessage('操作成功!');
+      this.refresh();
+    });
+  }
+
   renderView() {
+    const { search } = this.state;
     return <Block flex>
       <FilterLayout
         show
         ref={(ref) => { this.filterF = ref; }}
         itemList={this.filterForm}
-        data={this.state.search}
+        data={Object.assign({}, search, { channel: search.channel ? search.channel.split('-') : '' })}
         onChange={data => {
           data.channel = data.channel.join('-');
           this.search(data);
@@ -206,7 +263,7 @@ export default class extends Page {
         selectedKeys={this.state.selectedKeys}
         onAction={key => this.onAction(key)}
       />
-      <TableLayout
+      {!this.state.mode && <TableLayout
         columns={this.tableSort(this.columns)}
         list={this.state.list}
         pagination={this.state.page}
@@ -214,7 +271,31 @@ export default class extends Page {
         onChange={(pagination, filters, sorter) => this.tableChange(pagination, filters, sorter)}
         onSelect={(keys, rows) => this.tableSelect(keys, rows)}
         selectedKeys={this.state.selectedKeys}
-      />
+      />}
+      {this.state.mode === 'order' && <DragList
+        loading={this.props.core.loading}
+        dataSource={this.state.list || []}
+        handle={'.icon'}
+        rowKey={'id'}
+        onMove={(oldIndex, newIndex) => {
+          this.order(oldIndex, newIndex);
+        }}
+        renderItem={(item) => (
+          <List.Item actions={[<Icon type='bars' className='icon' />]}>
+            <Row style={{ width: '100%' }}>
+              <Col span={8}>{item.user ? item.user.nickname : item.nickname}</Col>
+              <Col span={15} offset={1}>{item.content}</Col>
+            </Row>
+          </List.Item>
+        )}
+      />}
+      {this.state.mode === 'order' && <Row type="flex" justify="center">
+        <Col>
+          <Button type="primary" onClick={() => {
+            this.submit();
+          }}>保存</Button>
+        </Col>
+      </Row>}
     </Block>;
   }
 }

+ 6 - 3
front/project/admin/routes/student/askCourseDetail/page.js

@@ -50,9 +50,12 @@ export default class extends Page {
   orderQuestion(oldIndex, newIndex) {
     const { data } = this.state;
     const { others = [] } = data;
-    const tmp = others[oldIndex];
-    others[oldIndex] = others[newIndex];
-    others[newIndex] = tmp;
+    const tmp = others.splice(oldIndex, 1);
+    if (newIndex === others.length) {
+      others.push(tmp[0]);
+    } else {
+      others.splice(newIndex, 0, tmp[0]);
+    }
     this.setState({ others });
   }
 

+ 9 - 0
front/project/admin/routes/user/abnormal/page.js

@@ -140,6 +140,15 @@ export default class extends Page {
     });
   }
 
+  noFrozenAction(row) {
+    asyncDelConfirm('取消封禁确认', '是否取消封禁选中用户?', () => {
+      return User.noFrozen({ id: row.userId }).then(() => {
+        asyncSMessage('操作成功!');
+        this.refresh();
+      });
+    });
+  }
+
   renderView() {
     return <Block flex>
       <FilterLayout

+ 1 - 1
front/src/components/DragList/index.js

@@ -55,7 +55,7 @@ export default class DragSortingTable extends React.Component {
             if (ref) this.sortableDecorator(ref);
           }}>
           {this.props.dataSource.map((item, index) => {
-            return <div className={`drag ${this.props.type}`}>{this.props.renderItem(item, index)}</div>;
+            return <div key={this.props.rowKey ? item[this.props.rowKey] : index} className={`drag ${this.props.type}`}>{this.props.renderItem(item, index)}</div>;
           })}
         </div></Spin>
     );

+ 2 - 2
front/src/components/FileUpload/index.js

@@ -88,8 +88,8 @@ class FileUpload extends Component {
           onChange={e => this.onChange(e)}
         />
         {this.state.type === 'image' ? (
-          this.props.src && !this.state.uploading ? (
-            <img src={this.props.src} style={{ width: '100%', height: '100%' }} />
+          this.props.value && !this.state.uploading ? (
+            <img src={this.props.value} style={{ width: '100%', height: '100%' }} />
           ) : (
             <Icon type={this.state.uploading ? 'loading' : 'upload'} />
           )

+ 3 - 0
front/src/layouts/FormLayout/index.js

@@ -124,6 +124,9 @@ class FormLayout extends Component {
           <FileUpload
             {...item}
             title={item.name}
+            onEnd={url => {
+              this.props.form.setFieldsValue({ [item.key]: url });
+            }}
             onError={err => {
               this.props.form.setFields({ [item.key]: { value: '', errors: [err] } });
             }}

+ 3 - 3
front/src/services/Tools.js

@@ -175,9 +175,9 @@ export function getMap(list, key = 'value', value = null, children = null) {
   const map = {};
   for (let i = 0; i < list.length; i += 1) {
     const item = list[i];
-    const v = value ? item[value] : item;
-    if (children && v && v[children] && v[children].length > 0) {
-      v[children] = getMap(v[children], key, value, children);
+    let v = value ? item[value] : item;
+    if (children && item[children] && item[children].length > 0) {
+      v = getMap(item[children], key, value, children);
     }
     map[item[key]] = v;
   }

+ 3 - 3
server/gateway-api/src/main/java/com/qxgmat/controller/admin/SettingController.java

@@ -663,7 +663,7 @@ public class SettingController {
 
     @RequestMapping(value = "/ad/list", method = RequestMethod.GET)
     @ApiOperation(value = "广告列表", httpMethod = "GET")
-    public Response<PageMessage<AdInfoDto>> list(
+    public Response<PageMessage<Ad>> list(
             @RequestParam(required = false, defaultValue = "1") int page,
             @RequestParam(required = false, defaultValue = "100") int size,
             @RequestParam(required = false) String channel,
@@ -672,8 +672,8 @@ public class SettingController {
             @RequestParam(required = false, defaultValue = "desc") String direction,
             HttpSession session) {
         Page<Ad> p = adService.listAdmin(page, size, channel, position, order, DirectionStatus.ValueOf(direction));
-        List<AdInfoDto> pr = Transform.convert(p, AdInfoDto.class);
-        return ResponseHelp.success(pr, page, size, p.getTotal());
+
+        return ResponseHelp.success(p, page, size, p.getTotal());
     }
 
     @RequestMapping(value = "/contract/edit", method = RequestMethod.PUT)

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/CommentService.java

@@ -95,6 +95,7 @@ public class CommentService extends AbstractService {
         List<Comment> commentList = select(commentMapper, ids);
         Map commentMap = Transform.getMap(commentList, Comment.class, "id");
         for (Integer id : ids){
+            order -= 1;
             Comment comment = (Comment)commentMap.get(id);
             if (comment == null) continue;
             if (comment.getOrder() == order) continue;
@@ -103,7 +104,6 @@ public class CommentService extends AbstractService {
                     .order(order)
                     .build()
             );
-            order -= 1;
         }
     }
 

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/FaqService.java

@@ -95,6 +95,7 @@ public class FaqService extends AbstractService {
         List<Faq> faqList = select(faqMapper, ids);
         Map faqMap = Transform.getMap(faqList, Faq.class, "id");
         for (Integer id : ids){
+            order -= 1;
             Faq faq = (Faq)faqMap.get(id);
             if (faq == null) continue;
             if (faq.getOrder() == order) continue;
@@ -103,7 +104,6 @@ public class FaqService extends AbstractService {
                     .order(order)
                     .build()
             );
-            order -= 1;
         }
     }
 

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/UserAskCourseService.java

@@ -84,6 +84,7 @@ public class UserAskCourseService extends AbstractService {
         List<UserAskCourse> userAskCourseList = select(userAskCourseMapper, ids);
         Map userAskCourseMap = Transform.getMap(userAskCourseList, UserAskCourse.class, "id");
         for (Integer id : ids){
+            order -= 1;
             UserAskCourse userAskCourse = (UserAskCourse)userAskCourseMap.get(id);
             if (userAskCourse == null) continue;
             if (userAskCourse.getOrder() == order) continue;
@@ -93,7 +94,6 @@ public class UserAskCourseService extends AbstractService {
                     .showStatus(1)
                     .build()
             );
-            order -= 1;
         }
     }
 

+ 1 - 1
server/gateway-api/src/main/java/com/qxgmat/service/inline/UserAskQuestionService.java

@@ -102,6 +102,7 @@ public class UserAskQuestionService extends AbstractService {
         List<UserAskQuestion> userAskQuestionList = select(userAskQuestionMapper, ids);
         Map userAskQuestionMap = Transform.getMap(userAskQuestionList, UserAskQuestion.class, "id");
         for (Integer id : ids){
+            order -= 1;
             UserAskQuestion userAskQuestion = (UserAskQuestion)userAskQuestionMap.get(id);
             if (userAskQuestion == null) continue;
             if (userAskQuestion.getOrder() == order) continue;
@@ -111,7 +112,6 @@ public class UserAskQuestionService extends AbstractService {
                     .showStatus(1)
                     .build()
             );
-            order -= 1;
         }
     }