eval_action 追加 余额 参数

main
鹿和sa0ChunLuyu 2 years ago
parent 7a52915f4b
commit f5dbd3bab5

@ -78,7 +78,7 @@ class ProfitsharingController extends Controller
return Yo::create_echo($p->id); return Yo::create_echo($p->id);
} }
public function eval_action($php, $in_value) public function eval_action($php, $in_value, $surplus)
{ {
$out_value = 0; $out_value = 0;
if ($php) { if ($php) {
@ -96,7 +96,7 @@ class ProfitsharingController extends Controller
$php = $request->post('php'); $php = $request->post('php');
$in_value = $request->post('in_value'); $in_value = $request->post('in_value');
return Yo::echo([ return Yo::echo([
'out_value' => self::eval_action($php, $in_value), 'out_value' => self::eval_action($php, $in_value, 0),
]); ]);
} }

@ -52,7 +52,7 @@ class UserOrderController extends Controller
$surplus = $price; $surplus = $price;
foreach ($sharing as $item) { foreach ($sharing as $item) {
$formula = $item->formula; $formula = $item->formula;
$amount = number_format($p->eval_action($formula, $price), 2); $amount = number_format($p->eval_action($formula, $price, $surplus), 2);
$receivers[] = [ $receivers[] = [
'type' => $item->type == 1 ? 'MERCHANT_ID' : 'PERSONAL_OPENID', 'type' => $item->type == 1 ? 'MERCHANT_ID' : 'PERSONAL_OPENID',
'account' => $item->account, 'account' => $item->account,

Loading…
Cancel
Save