82 lines
4.1 KiB
PHP
82 lines
4.1 KiB
PHP
<?php
|
|
|
|
class OrganizationCmmssnEntity
|
|
{
|
|
public $id;
|
|
public $teamId;
|
|
public $cluesLevel1;
|
|
public $cluesLevel2;
|
|
public $cluesLevel3;
|
|
public $cluesLevel4;
|
|
public $cluesLevel5;
|
|
public $orderLevel1;
|
|
public $orderLevel2;
|
|
public $orderLevel3;
|
|
public $orderLevel4;
|
|
|
|
private $ci;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->ci = &get_instance();
|
|
}
|
|
|
|
/**
|
|
* 获取不同用户类型佣金
|
|
* @param $teamLevel
|
|
* @param $cluesCommission
|
|
* @param $orderCommission
|
|
* @param $groupType
|
|
* @return array
|
|
*/
|
|
public function getCommission($teamLevel, $cluesCommission, $orderCommission, $groupType)
|
|
{
|
|
try {
|
|
if ($teamLevel <= 3) {//4级及以上
|
|
if ($groupType == Pingan_users_model::GROUP_TYPE_ORG_CONTACT
|
|
|| $groupType == Pingan_users_model::GROUP_TYPE_TEAM_CONTACT) {
|
|
$resCluesCommission_min = $this->cluesLevel1 * $cluesCommission / 100;
|
|
$resCluesCommission_max = $this->cluesLevel3 * $cluesCommission / 100;
|
|
$resCluesCommission = $resCluesCommission_min . ' ~ ' . $resCluesCommission_max;
|
|
$resOrderCommission_min = $this->orderLevel1 * $orderCommission / 100;
|
|
$resOrderCommission_max = $this->orderLevel3 * $orderCommission / 100;
|
|
$resOrderCommission = $resOrderCommission_min . ' ~ ' . $resOrderCommission_max;
|
|
} elseif ($groupType == Pingan_users_model::GROUP_TYPE_AREA) {
|
|
$resCluesCommission = $this->cluesLevel1 * $cluesCommission / 100;
|
|
$resOrderCommission = $this->orderLevel1 * $orderCommission / 100;
|
|
} elseif ($groupType == Pingan_users_model::GROUP_TYPE_DEP) {
|
|
$resCluesCommission = $this->cluesLevel2 * $cluesCommission / 100;
|
|
$resOrderCommission = $this->orderLevel2 * $orderCommission / 100;
|
|
} else {
|
|
$resCluesCommission = $this->cluesLevel3 * $cluesCommission / 100;
|
|
$resOrderCommission = $this->orderLevel3 * $orderCommission / 100;
|
|
}
|
|
} else {
|
|
if ($groupType == Pingan_users_model::GROUP_TYPE_ORG_CONTACT
|
|
|| $groupType == Pingan_users_model::GROUP_TYPE_TEAM_CONTACT) {
|
|
$resCluesCommission_min = $this->cluesLevel1 * $cluesCommission / 100;
|
|
$resCluesCommission_max = $this->cluesLevel4 * $cluesCommission / 100;
|
|
$resCluesCommission = $resCluesCommission_min . '~' . $resCluesCommission_max;
|
|
$resOrderCommission_min = $this->orderLevel1 * $orderCommission / 100;
|
|
$resOrderCommission_max = $this->orderLevel4 * $orderCommission / 100;
|
|
$resOrderCommission = $resOrderCommission_min . '~' . $resOrderCommission_max;
|
|
} elseif ($groupType == Pingan_users_model::GROUP_TYPE_AREA) {
|
|
$resCluesCommission = $this->cluesLevel1 * $cluesCommission / 100;
|
|
$resOrderCommission = $this->orderLevel1 * $orderCommission / 100;
|
|
} elseif ($groupType == Pingan_users_model::GROUP_TYPE_DEP) {
|
|
$resCluesCommission = $this->cluesLevel2 * $cluesCommission / 100;
|
|
$resOrderCommission = $this->orderLevel2 * $orderCommission / 100;
|
|
} elseif ($groupType == Pingan_users_model::GROUP_TYPE_TEAM) {
|
|
$resCluesCommission = $this->cluesLevel3 * $cluesCommission / 100;
|
|
$resOrderCommission = $this->orderLevel3 * $orderCommission / 100;
|
|
} else {
|
|
$resCluesCommission = $this->cluesLevel4 * $cluesCommission / 100;
|
|
$resOrderCommission = $this->orderLevel4 * $orderCommission / 100;
|
|
}
|
|
}
|
|
} catch (Exception $e) {
|
|
$resOrderCommission = $resCluesCommission = 0;
|
|
}
|
|
return ['cluesCommission' => $resCluesCommission, 'orderCommission' => $resOrderCommission];
|
|
}
|
|
} |