const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class SecondlevelneedconfigService extends ServiceBase {
  constructor() {
    super("aggregation", ServiceBase.getDaoName(SecondlevelneedconfigService));
  }

  async update(pobj) {
    if (!pobj.code) {
      return system.getResultFail(-101, "编码不能为空");
    }
    if (!pobj.top_pic_url) {
      return system.getResultFail(-102, "顶部图标不能为空");
    }
    if (!pobj.recommend_product_quantity) {
      return system.getResultFail(-103, "推荐产品数量不能为空");
    }
    try {
      var functionName = "popularRecommendationList";
      await this.redisdel.redisInfo(functionName);
      var functionName1 = "productTypeFirst";
      await this.redisdel.redisInfo(functionName1);
      var functionName2 = "productTypeSecend";
      await this.redisdel.redisInfo(functionName2);
      var functionName3 = "productList";
      await this.redisdel.redisInfo(functionName3);
      var functionName4 = "productDetail";
      await this.redisdel.redisInfo(functionName4);
    } catch (error) {
      console.log(error)
    }
    return system.getResultSuccess(this.dao.update(pobj));
  }
}
module.exports = SecondlevelneedconfigService;