You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?php
|
|
class BaseKbw {
|
|
|
|
protected $cookie;
|
|
protected $curl;
|
|
protected $isLogin;
|
|
|
|
public function __construct() {
|
|
Zc::import('zc.vendors.YwCurl');
|
|
$setopt['timeOut'] = 5;
|
|
$setopt['ssl'] = true;
|
|
$this->curl = new YwCurl($setopt);
|
|
}
|
|
|
|
protected function getHeader() {
|
|
return [];
|
|
}
|
|
|
|
protected function curlGet($url, $params) {
|
|
$header = $this->getHeader();
|
|
$this->curl->setCurlOpt(CURLOPT_HTTPHEADER, $header);
|
|
return $this->curl->get($url, $params);
|
|
}
|
|
|
|
protected function curlPost($url, $params) {
|
|
$header = $this->getHeader();
|
|
$this->curl->setCurlOpt(CURLOPT_HTTPHEADER, $header);
|
|
return $this->curl->post($url, $params);
|
|
}
|
|
|
|
public function getLogisticsData(){
|
|
return CommonTool::failResult('暂不支持');
|
|
}
|
|
|
|
public function buyLogisticsNo($logisticId, $addressId, $buyerInfo, $orderInfo){
|
|
return CommonTool::failResult('暂不支持');
|
|
}
|
|
|
|
protected function checkRequiredFields($data, $requiredFieldMap) {
|
|
$emptyFieldNames = [];
|
|
foreach ($requiredFieldMap as $field => $name) {
|
|
if (empty($data[$field])) {
|
|
$emptyFieldNames[] = $name;
|
|
}
|
|
}
|
|
|
|
if (!empty($emptyFieldNames)) {
|
|
return CommonTool::failResult(implode('、', $emptyFieldNames) . '不能为空');
|
|
}
|
|
|
|
return CommonTool::successResult();
|
|
}
|
|
} |