|
@@ -787,30 +787,29 @@ class StoreOrder extends BaseModel
|
|
return false !== $res;
|
|
return false !== $res;
|
|
}
|
|
}
|
|
|
|
|
|
- public static function sendAward($order)
|
|
|
|
- {
|
|
|
|
|
|
+ public static function sendAward($order){
|
|
$userModel = new \app\admin\model\user\User();
|
|
$userModel = new \app\admin\model\user\User();
|
|
$leader = $userModel->getLeader($order['uid']);
|
|
$leader = $userModel->getLeader($order['uid']);
|
|
$res = true;
|
|
$res = true;
|
|
if($leader){
|
|
if($leader){
|
|
$price = $order['total_price'];
|
|
$price = $order['total_price'];
|
|
//TODO
|
|
//TODO
|
|
- $ratio = sys_config('spread_ratio');
|
|
|
|
|
|
+ $ratio = sys_config('price_ratio');
|
|
$award = bcmul($price, $ratio, 2);
|
|
$award = bcmul($price, $ratio, 2);
|
|
|
|
+ $spreadUserInfo = User::getUserInfo($order['spread_uid']);
|
|
//TODO 上级推广员返佣之后的金额
|
|
//TODO 上级推广员返佣之后的金额
|
|
- $userInfo = User::get($order['uid']);
|
|
|
|
- $mark = $userInfo['nickname'] . '成功消费[虚拟产品]' . floatval($order['pay_price']) . '元,奖励推广佣金' . floatval($award);
|
|
|
|
|
|
+ $balance = bcadd($spreadUserInfo['spread_uid'], $award, 2);
|
|
|
|
+ $mark = $order['nickname'] . '成功消费[虚拟产品]' . floatval($order['pay_price']) . '元,奖励推广佣金' . floatval($award);
|
|
//TODO 添加推广记录
|
|
//TODO 添加推广记录
|
|
- $res1 = UserBill::income('获得推广佣金', $leader['spread_uid'], 'now_money', 'brokerage', $award, $order['id'], $leader['spreadUserInfo']['brokerage_price'] + $award, $mark);
|
|
|
|
|
|
+ $res1 = UserBill::income('获得推广佣金', $leader['spread_uid'], 'now_money', 'brokerage', $award, $order['id'], $balance, $mark);
|
|
//TODO 添加用户余额
|
|
//TODO 添加用户余额
|
|
- $res2 = User::bcInc($leader['spread_uid'], 'brokerage_price', $award, 'uid');
|
|
|
|
|
|
+ $res2 = self::bcInc($leader['spread_uid'], 'brokerage_price', $award, 'uid');
|
|
//TODO END;
|
|
//TODO END;
|
|
$res = $res1&&$res2;
|
|
$res = $res1&&$res2;
|
|
}
|
|
}
|
|
return $res;
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* 线下支付消息通知
|
|
* 线下支付消息通知
|
|
* 待完善
|
|
* 待完善
|