55 lines
1.8 KiB
PHP
55 lines
1.8 KiB
PHP
<?php
|
||
// +------------------------------------------------+
|
||
// |http://www.cjango.com |
|
||
// +------------------------------------------------+
|
||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||
// +------------------------------------------------+
|
||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||
// +------------------------------------------------+
|
||
namespace app\system\controller;
|
||
|
||
use app\common\model\VipOrder as VipOrderModel;
|
||
use app\common\service\Account as AccountService;
|
||
|
||
class Tools extends _Init
|
||
{
|
||
public function index2()
|
||
{
|
||
// $list = MemberService::getSub(1015);
|
||
// dump($list);
|
||
|
||
$res = AccountService::commission('VIP17121105404073221');
|
||
dump($res);
|
||
}
|
||
|
||
public function management($orderid)
|
||
{
|
||
$order = VipOrderModel::where('orderid', $orderid)->find();
|
||
$user = $order->user ?? '';
|
||
if ($order && $user) {
|
||
if (!in_array($order->type, ['vip', 'agent'])) {
|
||
return "订单类型错误";
|
||
}
|
||
// if ($order->commission == 1) {
|
||
// return "已经执行过了";
|
||
// }
|
||
$share_commission = '0.5';
|
||
|
||
$puser = $user->puser;
|
||
if ($puser) {
|
||
if ($puser->info->is_agent != 1) {
|
||
return "上级不是代理商";
|
||
} else {
|
||
$cash = round($order->money * $share_commission, 2); //计算实际获得金额
|
||
$res = self::rule($p, 'open_' . $order->type, $cash, '', $order->uid, '', $orderid);
|
||
}
|
||
} else {
|
||
return "没有上级";
|
||
}
|
||
|
||
} else {
|
||
return '订单或会员不存在';
|
||
}
|
||
}
|
||
}
|