Skip to content

Commit

Permalink
Update V10.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
idcsmart committed Dec 1, 2023
1 parent ea8933a commit e9ec994
Show file tree
Hide file tree
Showing 9,640 changed files with 127 additions and 44 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -1006,8 +1006,9 @@ public function upgrade($param)

$this->startTrans();
try{
$reflect = new \ReflectionClass($class);
$methods = $reflect->getMethods(\ReflectionMethod::IS_PUBLIC);
/*$reflect = new \ReflectionClass($class);
$methods = $reflect->getMethods(\ReflectionMethod::IS_PUBLIC);*/
$methods = get_class_methods($class)?:[];
if(in_array('upgrade', $methods)){
$success = $Plugin->upgrade();
if (!$success) {
Expand Down Expand Up @@ -1180,8 +1181,9 @@ public function download($param)
$Plugin = new $class;
$this->startTrans();
try{
$reflect = new \ReflectionClass($class);
$methods = $reflect->getMethods(\ReflectionMethod::IS_PUBLIC);
/*$reflect = new \ReflectionClass($class);
$methods = $reflect->getMethods(\ReflectionMethod::IS_PUBLIC);*/
$methods = get_class_methods($class)?:[];
if(in_array('upgrade', $methods)){
$success = $Plugin->upgrade();
if (!$success) {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ public function index()

$ModuleLogic = new ModuleLogic();
$res = $ModuleLogic->getPriceCycle($id);
$hookDiscountResultsOrgins = hook("client_discount_by_amount",['client_id'=>get_client_id(),'product_id'=>$product['id'],'amount'=>$res['price']]);
foreach ($hookDiscountResultsOrgins as $hookDiscountResultsOrgin){
if ($hookDiscountResultsOrgin['status']==200){
$res['price'] = bcadd($res['price'], $hookDiscountResultsOrgin['data']['discount']??0, 2);
}
}
$product['price'] = $res['price'];
$product['cycle'] = $res['cycle']??$product['cycle'];

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -858,13 +858,13 @@ public function cartCalculatePrice($ProductModel, $params = [], $qty=1, $scene="
# 固定利润
if ($this->upstreamProduct['profit_type']==1){
$res['data']['profit'] = bcadd( 0, $this->upstreamProduct['profit_percent'], 2);
$res['data']['price'] = bcadd($res['products']['total'] ?? 0, $res['data']['profit'], 2);
$res['data']['renew_price'] = bcadd($res['products']['signal_price']??0,$this->upstreamProduct['profit_percent'],2);
$res['data']['price'] = bcadd($res['products']['sale_total'] ?? 0, $res['data']['profit'], 2);
$res['data']['renew_price'] = bcadd($res['products']['sale_signal_price']??0,$this->upstreamProduct['profit_percent'],2);
$res['data']['base_price'] = bcadd($res['products']['product_setup_fee']+$res['products']['product_price'],$this->upstreamProduct['profit_percent'],2);
}else{
$res['data']['profit'] = bcmul($res['products']['total'] ?? 0, ($this->upstreamProduct['profit_percent']/100), 2);
$res['data']['price'] = bcadd($res['products']['total'] ?? 0, $res['data']['profit'], 2);
$res['data']['renew_price'] = bcmul($res['products']['signal_price']??0,(1+$this->upstreamProduct['profit_percent']/100),2);
$res['data']['profit'] = bcmul($res['products']['sale_total'] ?? 0, ($this->upstreamProduct['profit_percent']/100), 2);
$res['data']['price'] = bcadd($res['products']['sale_total'] ?? 0, $res['data']['profit'], 2);
$res['data']['renew_price'] = bcmul($res['products']['sale_signal_price']??0,(1+$this->upstreamProduct['profit_percent']/100),2);
$res['data']['base_price'] = bcmul($res['products']['product_setup_fee']+$res['products']['product_price'],(1+$this->upstreamProduct['profit_percent']/100),2);
}

Expand Down Expand Up @@ -893,11 +893,13 @@ public function cartCalculatePrice($ProductModel, $params = [], $qty=1, $scene="

$res = idcsmart_api_curl($apiId,"/console/v1/product/{$upstreamProductId}/config_option", ['config_options'=>$params],30,'POST');
if ($res['status']==200){
if(isset($res['data']['discount']) && !empty($res['data']['discount'])){
if(isset($res['data']['discount'])){
// 加上等级折扣
$res['data']['price'] = bcadd($res['data']['price'], $res['data']['discount'], 2);
$res['data']['renew_price'] = bcadd($res['data']['renew_price'], $res['data']['discount'], 2);
// $res['data']['price'] = bcadd($res['data']['price'], $res['data']['discount'], 2);
// $res['data']['renew_price'] = bcadd($res['data']['renew_price'], $res['data']['discount'], 2);
unset($res['data']['discount']);
}else{

}
if(isset($res['data']['order_item'])){
unset($res['data']['order_item']);
Expand Down Expand Up @@ -1401,6 +1403,10 @@ public function durationPrice(HostModel $HostModel)
]
];
foreach ($res['data']['host'] as $item){
if(isset($item['client_level_discount'])){
unset($item['client_level_discount']);
}

if ($this->upstreamProduct['profit_type']==1){
$item['profit'] = bcadd(0, $this->upstreamProduct['profit_percent'], 2);
$item['price'] = bcadd($item['price'], $item['profit'], 2);
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,21 @@ public function upstreamProductDetail($param)
{
$param['id'] = $param['id'] ?? 0;

$supplierId = $param['supplier_id']??0;

if($param['type']=='whmcs'){
//$res = idcsmart_api_curl($supplierId,'modules/addons/idcsmart_reseller/logic/index.php?action=product_detail',['productid' => $param['id']],30,'POST');
$res = $this->upstreamRequest(rtrim($param['url'],'/').'/modules/addons/idcsmart_reseller/logic/index.php?action=product_detail', ['productid' => $param['id']], 30, 'POST');
}elseif ($param['type']=='finance'){
//$res = idcsmart_api_curl($supplierId,'api/product/'.$param['id'],[],30,'GET');
$res = $this->upstreamRequest(rtrim($param['url'],'/').'/api/product/'.$param['id'], [], 30, 'GET');
if ($res['status']==200){
//$res['data']['product']['price'] = $res['data']['product']['sale_price']??($res['data']['product']['price']??0);
$res['data']['product']['pay_type'] = ($res['data']['product']['pay_type']=='recurring')?'recurring_prepayment':$res['data']['product']['pay_type'];
}
}
else{
//$res = idcsmart_api_curl($supplierId,'api/v1/product/'.$param['id'],[],30,'GET');
$res = $this->upstreamRequest(rtrim($param['url'],'/').'/api/v1/product/'.$param['id'], [], 30, 'GET');
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function createProduct($param)

// 从上游商品详情拉取
$UpstreamLogic = new UpstreamLogic();
$res = $UpstreamLogic->upstreamProductDetail(['type' => $supplier['type'], 'url' => $supplier['url'], 'id' => $param['upstream_product_id']]);
$res = $UpstreamLogic->upstreamProductDetail(['type' => $supplier['type'], 'url' => $supplier['url'], 'id' => $param['upstream_product_id'],'supplier_id'=>$param['supplier_id']]);
if(empty($res['data'])){
return ['status'=>400,'msg'=>lang('upstream_product_is_not_exist')];
}
Expand Down Expand Up @@ -208,7 +208,7 @@ public function updateProduct($param)

// 从上游商品详情拉取
$UpstreamLogic = new UpstreamLogic();
$res = $UpstreamLogic->upstreamProductDetail(['type' => $supplier['type'], 'url' => $supplier['url'], 'id' => $param['upstream_product_id']]);
$res = $UpstreamLogic->upstreamProductDetail(['type' => $supplier['type'], 'url' => $supplier['url'], 'id' => $param['upstream_product_id'],'supplier_id'=>$param['supplier_id']]);
if(empty($res['data'])){
return ['status'=>400,'msg'=>lang('upstream_product_is_not_exist')];
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e9ec994

Please sign in to comment.