error = $msg; return false; } /** * @return string */ public function getError() { return $this->error; } /** * @param array $params * @param string $field * @return integer */ public function getPage(array $params, string $field = 'page') :int { return !empty($params[$field]) ? $params[$field] : 1; } /** * @param array $params * @param string $field * @return integer */ public function getLimit(array $params, string $field = 'limit') :int { return !empty($params[$field]) ? $params[$field] : 20; } /** * @return TaxConfigService */ public function getConfigService() { if (empty($this->config_service)) { return $this->config_service = new TaxConfigService(['mall_id' => $this->mall_id]); } return $this->config_service; } /** * @return LuYongService */ public function getLyService() { if (empty($this->ly_service)) { return $this->ly_service = new LuYongService(['mall_id' => $this->mall_id]); } return $this->ly_service; } /** * @return AlipayService */ public function getAlipayService() { if (empty($this->alipay_service)) { return $this->alipay_service = new AlipayService($this->mall_id); } return $this->alipay_service; } /** * @return XinlongService */ public function getXlService() { if (empty($this->xl_service)) { return $this->xl_service = new XinlongService(['mall_id' => $this->mall_id]); } return $this->xl_service; } /** * 数组切割 * * @param array $array * @param integer $limit * @return array */ public static function arraySplice(array $array, int $limit = 10) { $offset = 0; $result = []; while ($value = array_slice($array, $offset, $limit)) { $result[] = $value; $offset += $limit; } return $result; } }