<commit_before>/**
 * controller
 * @return
 */
module.exports = Controller("Admin/BaseController", function() {
  "use strict";


  var Service = require("../../Service/Service");
  var oss = require("../../Service/Oss");


  return {
    indexAction: function(){
      var self = this;
      if(self.userInfo && self.userInfo.isAdmin == 1){
        if(self.isGet()){
          self.assign({
            title : "管理后台-机构管理"
          })
          self.display()
        }else if(self.isPost()){
          var data = self.post();
          var banner = self.file('banner');
          var logo = self.file('logo');

          Promise.all([oss.put(banner ,{bucket:'n-partner', key : 'banner/'}),oss.put(logo , {bucket:'n-partner', key : 'logo_120/'})]).then(function(datas){
            Service.addPartner({
              'banner' : banner.originalFilename,
              'logo' : logo.originalFilename,
              'name ' : data.name,
              'introduction' : data.introduction
            }).then(function(content){
              self.success(content)
            })
          }).catch(function(err){
            self.error(err)
          })

        }
      }
    }
  };
});<commit_msg>fix bug by wangpengfei<commit_after>/**
 * controller
 * @return
 */
module.exports = Controller("Admin/BaseController", function() {
  "use strict";


  var Service = require("../../Service/Service");
  var oss = require("../../Service/Oss");


  return {
    indexAction: function(){
      var self = this;
      if(self.userInfo && self.userInfo.isAdmin == 1){
        if(self.isGet()){
          self.assign({
            title : "管理后台-机构管理"
          })
          self.display()
        }else if(self.isPost()){
          var data = self.post();
          var banner = self.file('banner');
          var logo = self.file('logo');

          Promise.all([oss.put(banner ,{bucket:'n-partner', key : 'banner/'}),oss.put(logo , {bucket:'n-partner', key : 'logo_120/'})]).then(function(datas){
            Service.addPartner({
              'banner' : banner.originalFilename,
              'logo' : logo.originalFilename,
              'name' : data.name,
              'introduction' : data.introduction
            }).then(function(content){
              self.success(content)
            })
          }).catch(function(err){
            self.error(err)
          })

        }
      }
    }
  };
});
{'fraction_non_alphanumeric': 0.17166666666666666, 'fraction_numerical': 0.0033333333333333335, 'mean_word_length': 1.8213866039952997, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3391173', 'n_tokens_mistral': 731, 'n_tokens_neox': 708, 'n_words': 121}