comments.js 1.3 KB

123456789101112131415161718192021222324252627282930
  1. import request from '../utils/request.js'
  2. class comments extends request {
  3. static async getCommentsByProduct(page = 1, pageSize = 10, storeId, productId) {
  4. const res = await this.postRequest(`${this.BASE_URL}Discuss/index?page=${page}&pageSize=${pageSize}&productId=${productId}&storeId=${storeId}`, this._defaultHeader)
  5. return res.data;
  6. }
  7. static async getCommentsByStore(page = 1, pageSize = 10, storeId) {
  8. const res = await this.postRequest(`${this.BASE_URL}Discuss/index?page=${page}&pageSize=${pageSize}&storeId=${storeId}`, this._defaultHeader)
  9. return res.data;
  10. }
  11. static async getPersonComments(page = 1, pageSize = 10, myDiscuss = 1) {
  12. const res = await this.postRequest(`${this.BASE_URL}Discuss/index?page=${page}&pageSize=${pageSize}&myDiscuss=${myDiscuss}`, this._defaultHeader)
  13. return res.data;
  14. }
  15. static async sendDiscuss(storeId, productId, orderId, productScore, storeScore, content, imgUrls) {
  16. const res = await this.postRequest(`${this.BASE_URL}Discuss/save?storeId=${storeId}&productId=${productId}&orderId=${orderId}&productScore=${productScore}&storeScore=${storeScore}&content=${content}&imgUrls=${imgUrls}`, this._defaultHeader)
  17. return res.code;
  18. }
  19. }
  20. export default comments;