用于DO对象转化为Model对象
777361
private ColumnGroup doToModel(DataColumnPairGroupDO dataColumnPairGroupDo) {
        ColumnGroup columnGroup = new ColumnGroup();
        columnGroup.setId(dataColumnPairGroupDo.getId());
        List<ColumnPair> columnPairs = new ArrayList<ColumnPair>();
        if (StringUtils.isNotBlank(dataColumnPairGroupDo.getColumnPairContent())) {
            columnPairs = JsonUtils.unmarshalFromString(dataColumnPairGroupDo.getColumnPairContent(),
                                                        new TypeReference<ArrayList<ColumnPair>>() {
                                                        });
        }

        columnGroup.setColumnPairs(columnPairs);
        columnGroup.setDataMediaPairId(dataColumnPairGroupDo.getDataMediaPairId());
        columnGroup.setGmtCreate(dataColumnPairGroupDo.getGmtCreate());
        columnGroup.setGmtModified(dataColumnPairGroupDo.getGmtModified());

        return columnGroup;
    }
759691
private static function get_models_data(){
        $attr = self::$attr;
        if(!$attr['table']) return [];
        //表不存在返回空数组
        $sql = 'show tables like \''.config('database.prefix').$attr['table'].'\' ';
        $flag = Db::query($sql);
        if(!count($flag))return [];

        $Db = Db::name($attr['table']);

        if(strlen($attr['where'])) $Db->where($attr['where']);
        if(strlen($attr['field'])) $Db->field($attr['field']);
        if(strlen($attr['limit'])) $Db->limit($attr['limit']);
        if(strlen($attr['group'])) $Db->group($attr['group']);

        $data = $Db->select();

        $return = [];
        $arr = explode(',',$attr['field']);
        //变成一维数组
        foreach($data as $k => $v){
            $return[$v[$arr[0]]] = $v[$arr[1]];
        }
        return $return;
    }
202574
private LogRecord doToModel(LogRecordDO logRecordDo) {
        LogRecord logRecord = new LogRecord();
        try {

            logRecord.setId(logRecordDo.getId());
            if (logRecordDo.getPipelineId() > 0 && logRecordDo.getChannelId() > 0) {
                try {
                    Channel channel = channelService.findByPipelineId(logRecordDo.getPipelineId());
                    logRecord.setChannel(channel);
                    for (Pipeline pipeline : channel.getPipelines()) {
                        if (pipeline.getId().equals(logRecordDo.getPipelineId())) {
                            logRecord.setPipeline(pipeline);
                        }
                    }
                } catch (Exception e) {
                    // 可能历史的log记录对应的channel/pipeline已经被删除了，直接忽略吧
                    Channel channel = new Channel();
                    channel.setId(0l);
                    logRecord.setChannel(channel);
                    Pipeline pipeline = new Pipeline();
                    pipeline.setId(0l);
                    logRecord.setPipeline(pipeline);
                }
            } else {
                Channel channel = new Channel();
                channel.setId(-1l);
                logRecord.setChannel(channel);
                Pipeline pipeline = new Pipeline();
                pipeline.setId(-1l);
                logRecord.setPipeline(pipeline);
            }

            logRecord.setTitle(logRecordDo.getTitle());
            logRecord.setNid(logRecordDo.getNid());
            logRecord.setMessage(logRecordDo.getMessage());
            logRecord.setGmtCreate(logRecordDo.getGmtCreate());
            logRecord.setGmtModified(logRecordDo.getGmtModified());

        } catch (Exception e) {
            logger.error("ERROR ## ");
            throw new ManagerException(e);
        }

        return logRecord;
    }
778431
public function actionRecord()
    {
        $wechat = $this->getWechat();
        $fans = $this->getFans();
        if (!$fans) { // 存储粉丝信息
            $fans = Yii::createObject(Fans::className());
            $fans->setAttributes([
                'wid' => $wechat->id,
                'open_id' => $this->message['FromUserName'],
                'status' => Fans::STATUS_SUBSCRIBED
            ]);
            if ($fans->save() && $wechat->status > Wechat::TYPE_SUBSCRIBE) { // 更新用户详细数据, 普通订阅号无权限获取
                $fans->updateUser();
            }
        } elseif ($fans->status != Fans::STATUS_SUBSCRIBED) { // 更新关注状态
            $fans->subscribe();
        }

//        $history = new MessageHistory();
//        $attributes = [
//            'wid' => $wechat->id,
//            'module' => $this->getModuleName($this->api->lastProcessController),
//        ];
    }
256464
function(watcher){
    var dirty = false;
    if(!watcher) return;

    var now, last, tlast, tnow,  
      eq, diff, keyOf, trackDiff
     

    if(!watcher.test){

      now = watcher.get(this);
      last = watcher.last;
      keyOf = watcher.keyOf

      if(now !== last || watcher.force){
        tlast = _.typeOf(last);
        tnow = _.typeOf(now);
        eq = true; 

        // !Object
        if( !(tnow === 'object' && tlast==='object' && watcher.deep) ){
          // Array
          if( tnow === 'array' && ( tlast=='undefined' || tlast === 'array') ){
            if(typeof keyOf === 'function'){
              trackDiff = diffTrack(now, watcher.last || [], keyOf )
              diff = trackDiff.steps;
              if(trackDiff.dirty) dirty = true;
            }else{
              diff = diffArray(now, watcher.last || [], watcher.diff)
            }
            
            if(!dirty && (tlast !== 'array' || diff === true || diff.length) ) dirty = true;
          }else{
            eq = _.equals( now, last );
            if( !eq || watcher.force ){
              watcher.force = null;
              dirty = true; 
            }
          }
        }else{
          diff =  diffObject( now, last, watcher.diff, keyOf  );
          if(diff.isTrack){
            trackDiff = diff;
            diff = trackDiff.steps;
          }
          if( diff === true || diff.length ) dirty = true;
        }
      }

    } else{
      // @TODO 是否把多重改掉
      var result = watcher.test(this);
      if(result){
        dirty = true;
        watcher.fn.apply(this, result)
      }
    }
    if(dirty && !watcher.test){
      if(tnow === 'object' && watcher.deep || tnow === 'array'){
        watcher.last = _.clone(now);
      }else{
        watcher.last = now;
      }
      watcher.fn.call(this, now, last, diff, trackDiff && trackDiff.oldKeyMap, trackDiff && trackDiff.dirty)
      if(watcher.once) this.$unwatch(watcher)
    }

    return dirty;
  }
992608
function (model) {
			var c = this.c,
				s = this;
			this.m[model]=function () {
				var modelClass = c[model];
				return new modelClass({ autoInit: true }, s.c, s, s.db);
			};
		}
16411
public static function hit($model, $model_id, $increasing = 1)
    {
        if (($model = static::findOne(['model' => $model, 'model_id' => $model_id])) == null) {
            $model = new static();
        }
        $model->views = $model->views + $increasing;
        //昨日显示次数
        $model->yesterday_views = (date('Ymd', $model->updated_at) == date('Ymd', strtotime('-1 day'))) ? $model->day_views : $model->yesterday_views;
        $model->day_views = (date('Ymd', $model->updated_at) == date('Ymd', time())) ? ($model->day_views + $increasing) : 1;
        $model->week_views = (date('YW', $model->updated_at) == date('YW', time())) ? ($model->week_views + $increasing) : 1;
        $model->month_views = (date('Ym', $model->updated_at) == date('Ym', time())) ? ($model->month_views + $increasing) : 1;
        $model->save();
        return $model;
    }
1106651
protected function ensureModel()
    {
        Yii::trace('Model ensuring', __METHOD__);

        if ($this->multiple) {
            if (empty($this->model) || !is_array($this->model)) {
                $this->model = [$this->model];
            }
            foreach ($this->model as $model) {
                $this->ensureModelInternal($model);
            }

            return;
        }

        $this->ensureModelInternal($this->model);
    }
1351696
private static LinearModel trainNaivePerceptron(Instance[] instanceList, FeatureMap featureMap, int maxIteration)
    {
        LinearModel model = new LinearModel(featureMap, new float[featureMap.size()]);
        for (int it = 0; it < maxIteration; ++it)
        {
            Utility.shuffleArray(instanceList);
            for (Instance instance : instanceList)
            {
                int y = model.decode(instance.x);
                if (y != instance.y) // 误差反馈
                    model.update(instance.x, instance.y);
            }
        }
        return model;
    }
1069622
protected function _checkTableInfo() {
        // 如果不是Model类 自动记录数据表信息
        // 只在第一次执行记录
        if(empty($this->fields)) {
            // 如果数据表字段没有定义则自动获取
            if(C('DB_FIELDS_CACHE')) {
                $db   =  $this->dbName?:C('DB_NAME');
                $fields = F('_fields/'.strtolower($db.'.'.$this->tablePrefix.$this->name));
                if($fields) {
                    $this->fields   =   $fields;
                    if(!empty($fields['_pk'])){
                        $this->pk       =   $fields['_pk'];
                    }
                    return ;
                }
            }
            // 每次都会读取数据表信息
            $this->flush();
        }
    }
98866
function init (model) {
    if (model.__ttl) return;

    var distinct_ = model.distinct;
    model.distinct = function distinct (field, cond, cb) {
      applyTTL(cond);
      return distinct_.call(model, field, cond, cb);
    }

    'findOne find count'.split(' ').forEach(function (method) {
      var fn = model[method];

      model[method] = function (cond, fields, opts, cb) {
        if (!cond) {
          cond = {};
        } else if ('function' == typeof cond) {
          cb = cond;
          cond = {};
        }

        applyTTL(cond);
        return fn.call(model, cond, fields, opts, cb);
      }
    });

    'where $where'.split(' ').forEach(function (method) {
      var fn = model[method];
      model[method] = function () {
        var query = fn.apply(this, arguments)
          , cond = {};
        applyTTL(cond);
        return query.find(cond);
      }
    });

    if (reap) {
      model.startTTLReaper();
    }
  }
119071
function () {
            var _this = this;

            /* 滚动拉取图片 */
            domUtils.on($G('imageList'), 'scroll', function(e){
                var panel = this;
                if (panel.scrollHeight - (panel.offsetHeight + panel.scrollTop) < 10) {
                    _this.getImageData();
                }
            });
            /* 选中图片 */
            domUtils.on(this.container, 'click', function (e) {
                var target = e.target || e.srcElement,
                    li = target.parentNode;

                if (li.tagName.toLowerCase() == 'li') {
                    if (domUtils.hasClass(li, 'selected')) {
                        domUtils.removeClasses(li, 'selected');
                    } else {
                        domUtils.addClass(li, 'selected');
                    }
                }
            });
        }
1217629
def ng_model(model, opt = {})
    opt[:root_selector] ||= ng_root_selector
    row = ng.row(opt)
    ng_models(model, opt)[row]
  end
896530
def minimal_models(self, alphabet: _Alphabet) -> Set[PLInterpretation]:
        """"""
        models = self.all_models(alphabet)

        minimal_models = set()
        for m in models:
            min_m = m
            for m1 in models:
                if min_m.true_propositions.issuperset(m1.true_propositions):
                    min_m = m1
            minimal_models.add(min_m)

        return minimal_models
600867
def setModel(self, model):
        

        if not model:
            return

        LOGGER.debug("> Setting '{0}' model.".format(model))

        umbra.ui.views.Abstract_QTreeView.setModel(self, model)

        # Signals / Slots.
        self.model().modelAboutToBeReset.connect(self.__model__modelAboutToBeReset)
        self.model().modelReset.connect(self.__model__modelReset)
362958
function () {
        var me = this
        var options = me._options
        me.loading = false
        if (me.direction == 'up') {

          fnTransition(options.domUp.dom, 300)
          options.domUp.dom.style.height = '0px'
          options.domUp.loadEndCall()
          // 下拉刷新后，加载更多的数据状态需要更新

        } else {
        }
        if (me.isData) {
          // 加载区修改样式
          options.domDown.initialCall()
        } else {
          // 如果没数据
          options.domDown.domNoData()
        }
      }
1081294
function getModelFromServer(pagePath, callback, req) {
  let modelServerOptions = ROOT.MODEL_SERVER;
  let reqUrl = modelServerOptions.path;
  if (typeof reqUrl === 'function') {
    reqUrl = reqUrl({
      host: modelServerOptions.host,
      queries: modelServerOptions.queries,
      headers: modelServerOptions.headers,
      path: pagePath
    });
  }
  // 如果没有设置path，则默认为页面的path
  if (!reqUrl) {
    reqUrl = pagePath;
  }
  if (!reqUrl.startsWith('http')) {
    if (!modelServerOptions.host.endsWith('/')) {
      modelServerOptions.host += '/';
    }
    if (reqUrl.startsWith('/')) {
      reqUrl = reqUrl.slice(1);
    }
    // 是相对地址，加上主机地址
    reqUrl = `${modelServerOptions.host}${reqUrl}`;
  }
  // 处理查询参数
  if (modelServerOptions.queries && Object.keys(modelServerOptions.queries).length) {
    let qs = querystring.stringify(modelServerOptions.queries);
    reqUrl += (reqUrl.includes('?') ? `&` : `?`) + qs;
  }
  let reqHeaders = {};
  // 需要判断有没有 cookie，没有的话，值是 undefined，最后发请求的时候会报错
  // 重现方法：本地删除cookie再发请求
  if (req.headers.cookie) {
    reqHeaders.cookie = req.headers.cookie;
  }
  // 处理请求头
  if (modelServerOptions.headers) {
    Object.keys(modelServerOptions.headers).forEach(function (headerKey) {
      reqHeaders[headerKey] = modelServerOptions.headers[headerKey];
    });
  }
  let urlParseResult = url.parse(reqUrl);
  let options = {
    hostname: urlParseResult.hostname,
    port: urlParseResult.port,
    path: urlParseResult.path,
    headers: reqHeaders,
    protocol: urlParseResult.protocol
  };
  console.log(`页面 ${pagePath} 的模型请求信息：${JSON.stringify(options)}`);
  require(urlParseResult.protocol.slice(0,-1)).get(options, function (res) {
    let ret = [];
    res.on('data', function (chunk) {
      ret.push(chunk.toString());
    });
    res.on('end', function () {
      let json = {};
      try {
        json = JSON.parse(ret.join(''));
        console.log(`页面 ${pagePath} 的模型请求返回的 json 数据为：${JSON.stringify(json)}`);
      } catch (ex) {
        console.log(`页面 ${pagePath} 的模型请求没有返回 json 数据：${JSON.stringify(ret)}`);
      }
      callback(json);
    });
  }).on('error', function (error) {
    callback(error.message);
  });
}