Ejemplo n.º 1
0
 /**
  * 获取记录集
  * @param \Sooh\DB\Interfaces\All $db
  * @param string $tb
  */
 public function kvoGetRecordsStd($db, $tb)
 {
     $rs = $db->getRecords($tb, $this->fields, $this->where, $this->sortGroup, $this->pager->page_size, $this->pager->rsFrom());
     foreach ($rs as $r) {
         $this->records[] = $r;
     }
 }
Ejemplo n.º 2
0
 /**
  * 遍历回调(by self::findNeedsNotify)
  * @param \Sooh\DB\Interfaces\All $db
  * @param string $tb
  */
 public static function loop_chk($db, $tb)
 {
     $retry = new \Sooh\Base\Retrylater(array(1, 5, 60, 120, 300, 300, 300, 300), 60);
     try {
         \Sooh\DB\Broker::errorMarkSkip(\Sooh\DB\Error::tableNotExists);
         $rs = $db->getRecords($tb, '*', array('callbackRetry<' => $retry->cmpVal, 'callbackRetry>' => 0), null, 100);
         if (empty($rs)) {
             return;
         }
     } catch (\ErrorException $e) {
         if (\Sooh\DB\Broker::errorIs($e, \Sooh\DB\Error::tableNotExists)) {
             return;
         } else {
             throw $e;
         }
     }
     if (is_array(self::$func_notifyInstall)) {
         foreach ($rs as $r) {
             try {
                 $r['copartnerRet'] = call_user_func(self::$func_notifyInstall, $r);
             } catch (\ErrorException $e) {
                 $r['copartnerRet'] = new \Sooh\Base\RetSimple(\Sooh\Base\RetSimple::errDefault, $e->getMessage());
                 error_log($e->getMessage() . "\n" . $e->getTraceAsString());
             }
             self::updNotifiRet($db, $tb, $r, $retry);
         }
     } else {
         $f = self::$func_notifyInstall;
         foreach ($rs as $r) {
             try {
                 $r['copartnerRet'] = $f($r);
             } catch (\ErrorException $e) {
                 $r['copartnerRet'] = new \Sooh\Base\RetSimple(\Sooh\Base\RetSimple::errDefault, $e->getMessage());
                 error_log($e->getMessage() . "\n" . $e->getTraceAsString());
             }
             self::updNotifiRet($db, $tb, $r, $retry);
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * 加载数据(某月)
  * @param \Sooh\DB\Interfaces\All  $db
  * @param int $ymd
  * @param string $mainType
  * @param string $subType
  * @return array [ymd=>[rptdata,flg1,flg2,flg3],ymd=>[rptdata,flg1,flg2,flg3]....]
  */
 public function loadMonth($db, $ymd, $mainType, $subType)
 {
     $ret = array();
     if ($ymd > 10020101) {
         $ymd = $ymd - $ymd % 100;
     } else {
         $ymd = $ymd * 100;
     }
     //201501
     $rs = $db->getRecords($this->tbName, 'ymd,rptdata,flg1,flg2,flg3', array('mainType' => $mainType, 'subType' => $subType, 'ymd>' => $ymd, 'ymd<' => $ymd + 100));
     foreach ($rs as $r) {
         $r['rptdata'] = json_decode($r['rptdata'], true);
         $ymd = $r['ymd'];
         unset($r['ymd']);
         $ret[$ymd] = $r;
     }
     ksort($ret);
     return $ret;
 }
Ejemplo n.º 4
0
 /**
  * loopGetRecords调用,获取符合条件的记录
  * @param \Sooh\DB\Interfaces\All $db
  * @param string $tb
  */
 protected static function loopGetRecordsPage_getRecords($db, $tb)
 {
     foreach (static::$tmpVar['where'] as $realWhere) {
         static::$tmpVar['rs'][] = $db->getRecords($tb, '*', $realWhere, static::$tmpVar['sort'], static::$tmpVar['pagesize']);
     }
 }