Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate

Autor Topic: Problema VIP System - Webengine 1.0.9  (Visto 1145 veces)

0 Miembros and 1 Guest are viewing this topic.

Offline slipkorn13 Posteado: May 01, 2018, 12:42:06 PM

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 41
  • Gracias recibida: 20
  • cl
Hola a todos, quería ver si algun capo del PHP me podria dar una mano en un modulo de VIP, resulta que la WebEngine, el VIPSystem trabaja como la columna "TimeStamp", en la cual agrega los segundos del VIP. El problema es que mis files usan la columna "AccountExpireDate" en la cual va la fecha de expiracion del VIP, o sea trabaja de una manera totalmente distinta a la que viene por defecto en la web.

Quería ver la posibilidad de cambiar ese sistema y adaptarlo a la mía, por aca dejo el archivo que corresponde al sistema VIP:

Code: [Select]
class Vip {

function VipProcess($userid,$plan) {
global $common;
if(check_value($userid) && Validator::Number($userid)) {
$planData = $this->PlanInfo($plan);
$userData = $common->accountInformation($userid);
if(is_array($userData) && is_array($planData)) {

// data
$username = $userData[_CLMN_USERNM_];
$vipstamp = $userData[_CLMN_VIP_STAMP_];
$plandays = $planData['days'];
$plandiscount = $planData['discount_percent'];
$planprice = $this->CalculatePlanCost($plandays,$plandiscount);

if(!$common->accountOnline($username)) {
// deduct credits
$deduct = $common->substractCredits($userid,$planprice);
if($deduct) {
if($this->isVIP($userid)) {
// Extend Timestamp
$new_timestamp = $this->CalculateExtension($vipstamp,$plandays);
$update = $common->updateVipTimeStamp($userid,$new_timestamp);
if($update) {
// success
message('success', lang('success_13',true));
} else {
// unkown error
message('error', lang('error_23',true));
}
} else {

// New timestamp
$new_timestamp = $this->CalculateTimestamp($plandays);

$update = $common->updateVipTimeStamp($userid,$new_timestamp);
if($update) {
// success
message('success', lang('success_14',true));
} else {
// unkown error
message('error', lang('error_23',true));
}
}
} else {
// not enough credits
message('error', lang('error_40',true));
}
} else {
// account is online
message('error', lang('error_14',true));
}
} else {
// invalid user (unknown error)
message('error', lang('error_23',true));
}
} else {
// missing data (unknown error)
message('error', lang('error_23',true));
}
}

function PackageExists($id) {
$VipPlans = mconfig('vip_plans');
if(is_array($VipPlans)) {
if(array_key_exists(0, $VipPlans)) {
if(is_array($VipPlans[$id])) {
return true;
}
} else {
return true;
}
}
}

function PlanInfo($id) {
if($this->PackageExists($id)) {
$VipPlans = mconfig('vip_plans');
if(array_key_exists(0, $VipPlans)) {
return $VipPlans[$id];
} else {
return $VipPlans;
}
}
}

function CalculateTimestamp($days) {
if(check_value($days) && Validator::Number($days) && $days >= 1) {
$vip_days = 60*60*24*$days;
$free_time = 3600;
$result = time() + $free_time + $vip_days;
return $result;
}
}

function CalculateExtension($timestamp,$days) {
if(check_value($timestamp) && check_value($days) && Validator::Number($days) && $days >= 1) {
$vip_days = 60*60*24*$days;
$result = $timestamp + $vip_days;
return $result;
}
}

function isVIP($userid) {
global $common;
if(check_value($userid) && Validator::Number($userid)) {
$accountInfo = $common->accountInformation($userid);
if($accountInfo) {
$vipTimestamp = $accountInfo[_CLMN_VIP_STAMP_];
if($vipTimestamp > time()) {
return true;
}
}
}
}

function RemainingVIP($timestamp) {
if(check_value($timestamp) && Validator::Number($timestamp)) {
$calculate = ($timestamp - time()) / (60*60*24);
return round($calculate);
}
}

function CalculatePlanCost($days,$discount=0) {
if(check_value($days) && Validator::Number($days)) {
$vip_day_cost = mconfig('vip_day_cost');
$calculate_days_cost = round($days*$vip_day_cost);
if($discount >= 1) {
// Formula: original price - ( (discount % / 100) * original price )
$discounted_price = $calculate_days_cost - (($discount/100)*$calculate_days_cost);
return round($discounted_price);
} else {
return round($calculate_days_cost);
}
}
}

}

Se los agradezco de antemano, o tambien si alguien que pudiese rehacer el modulo completamente, todo se puede conversar $$. SALUDOS.

Gracias:


Offline slipkorn13 #1 Posteado: May 05, 2018, 06:08:00 PM

  • 0 puntos por ventas
  • *
  • Rank: Dedicado
  • Posts: 41
  • Gracias recibida: 20
  • cl
Solucionado, pueden cerrar el tema por favor.


Offline Nation Network #2 Posteado: September 10, 2018, 11:03:41 AM

  • 0 puntos por ventas
  • *
  • Rank: Puto amo
  • Posts: 215
  • Gracias recibida: 2180
  • us
Puedes poner la solucion para que otros usuarios puedan solucionar el problema?


Solo usuarios registrados pueden comentar y agradecer, Logueate o Registrate


 

Related Topics

  Subject / Started by Replies Last post
0 Replies
1493 Views
Last post November 07, 2018, 08:49:06 AM
by pujosx
14 Replies
4325 Views
Last post April 30, 2020, 02:41:12 PM
by Berserker
1 Replies
756 Views
Last post February 12, 2019, 11:02:33 AM
by lwlinares
0 Replies
767 Views
Last post July 01, 2019, 09:11:33 AM
by TzCr4ck
0 Replies
398 Views
Last post August 07, 2021, 12:25:05 AM
by spider