0
0
Files
Babyclass/app/Bonus/Identity.php
2020-08-04 10:09:42 +08:00

111 lines
2.6 KiB
PHP

<?php
namespace App\Bonus;
use App\User;
use RuLong\Bonus\Contracts\Settlement;
use RuLong\Bonus\Traits\Settlementable;
class Identity implements Settlement
{
use Settlementable;
public $user;
public $identity_id;
public function __construct($user, $identity_id)
{
$this->user = User::find($user->id);
$this->identity_id = $identity_id;
}
/**
* 判断上级推荐获取分红权
* @Author:<Leady>
* @Date:2018-11-05T13:21:47+0800
* @return [type] [description]
*/
public function fire()
{
switch ($this->user->identity->identity_id) {
case 3:
self::manager();
break;
case 4:
self::president();
break;
case 5:
self::daoshi();
break;
case 6:
self::ceo();
break;
default:
return false;
break;
}
}
/**
* 执行人为总裁
* @Author:<Leady>
* @Date:2018-12-18T13:16:36+0800
* @return [type] [description]
*/
public function manager()
{
$point = 1;
$identity = 3; //默认调整经理分红权
$this->user->addPoint($identity, $point);
$tui = $this->user->account->act_b + $this->user->account->act_c + $this->user->account->act_d;
if ($tui == 2) {
$this->user->identityUpdate(4);
$this->user->addPoint(4);
}
}
/**
* 执行人为执行总裁
* @Author:<Leady>
* @Date:2018-12-18T13:16:46+0800
* @return [type] [description]
*/
public function president()
{
$point = 1;
$identity = 4; //默认调整经理分红权
$this->user->addPoint($identity, $point);
$tui = $this->user->account->act_b + $this->user->account->act_c + $this->user->account->act_d;
if ($tui == 5) {
$this->user->identityUpdate(5);
$this->user->addPoint(5);
}
}
/**
* 执行人为导师
* @Author:<Leady>
* @Date:2018-12-18T13:16:55+0800
* @return [type] [description]
*/
public function daoshi()
{
$point = 1;
$identity = 5; //默认调整经理分红权
$this->user->addPoint($identity, $point);
}
/**
* 执行人为创始
* @Author:<Leady>
* @Date:2018-12-18T13:16:55+0800
* @return [type] [description]
*/
public function ceo()
{
$point = 1;
$identity = 6; //默认调整经理分红权
$this->user->addPoint($identity, $point);
}
}