${username?if_exists}

HTML页面读取Action中username属性的方法
本文详细介绍了在HTML页面中如何通过${username?if_exists}
HTML页面里面
${username?if_exists}就可以读到Action里面的username属性了
foreach ($store_arr as $store_value){ $res_arr = []; $money = 0; if ($store_value['store_info']['send_mode'] == 2){ $res_data[$store_value['store_id']] = [ 'money' => $store_value['delivery_money'], 'list' => [[ 'title' => '基础配送费', 'name' => 'money', 'money' => $store_value['delivery_money'] ]], 'special_time_id' => 0 ]; continue; } if ($store_value['partner_info']['type'] == 1){ $money = bcadd($money, $store_value['partner_info']['fixed_cost'], 2); //固定配送费 $res_arr[] = [ 'title' => '基础配送费', 'name' => 'money', 'money' => $money ]; }else{ $money = $store_value['partner_info']['base_price']; $res_arr[] = [ 'title' => '基础配送费', 'name' => 'money', 'money' => $money ]; //计算公里数 if ($store_value['partner_info']['range'] > 0) { if ($store_value['distance']) { $d = $store_value['distance']; } else { $d = get_cycling($store_value['store_info']['lng'] . ',' . $store_value['store_info']['lat'], $address['lng'] . ',' . $address['lat']); } $each_km = $store_value['partner_info']['each_km']; if ($d > $store_value['partner_info']['range']) { $dff = bcsub($d, $store_value['partner_info']['range'], 2); $dff = ceil($dff); $range_money = bcmul($dff, $each_km, 2); $res_arr[] = [ 'title' => '距离:' . $d . 'km收费', 'name' => 'range_money', 'money' => $range_money ]; $money = bcadd($money, $range_money, 2); } else { $res_arr[] = [ 'title' => '距离:' . $d . 'km收费', 'name' => 'range_money', 'money' => 0 ]; } } } if (floatval($store_value['partner_info']['special_sky_price']) > 0) { $money = bcadd($money, $store_value['partner_info']['special_sky_price'], 2); //特殊天气加价 $res_arr[] = [ 'title' => '特殊天气加价', 'name' => 'special_sky_price', 'money' => $store_value['partner_info']['special_sky_price'] ]; } //特殊时间段 $special_time_price = 0; $special_time_id = 0; if (array_key_exists('special_time_info',$store_value) && $store_value['special_time_info']){ if ($is_once == 1) { //立即开始 $order_start_time = time(); } else { $order_start_time = strtotime($pickup_time); } foreach ($store_value['special_time_info'] as $s) { $start = strtotime(date("Y-m-d ") . $s['start_time']); $end = strtotime(date("Y-m-d ") . $s['end_time']); if ($start < $order_start_time && $order_start_time < $end) { $special_time_price = bcadd($special_time_price, $s['cost'], 2); $special_time_id = $s['id']; } } } if (floatval($special_time_price) > 0) { $res_arr[] = [ 'title' => '特殊时间段加价', 'name' => 'special_time_price', 'money' => $special_time_price ]; } $money = bcadd($money, $special_time_price, 2); if (array_key_exists('plan_info',$store_value) && $store_value['plan_info']){ $special_map_price = 0; foreach ($store_value['plan_info'] as $p) { $position = json_decode($p['position'], true); $pts = []; foreach ($position as $a) { $pts[] = [ 'lng' => $a['lng'], 'lat' => $a['lat'] ]; } $res = is_point_in_polygon(['lng' => $address['lng'], 'lat' => $address['lat']], $pts); if ($res) { $special_map_price = $p['money']; break; } } if (floatval($special_map_price) > 0) { $res_arr[] = [ 'title' => '地图围栏加价', 'name' => 'special_map_price', 'money' => $special_map_price ]; } $money = bcadd($money, $special_map_price, 2); } $reduction_money = 0; if (array_key_exists('reduction_info',$store_value) && $store_value['reduction_info']) { foreach ($store_value['reduction_info'] as $p) { $position = json_decode($p['position'], true); $pts = []; foreach ($position as $a) { $pts[] = [ 'lng' => $a['lng'], 'lat' => $a['lat'] ]; } $res = is_point_in_polygon(['lng' => $address['lng'], 'lat' => $address['lat']], $pts); if ($res) { $reduction_money = $p['money']; break; } } } if ($reduction_money > 0) { $res_arr[] = [ 'title' => '商家承担配送费', 'name' => 'reduction_money', 'money' => $reduction_money ]; $money = bcsub($money, $reduction_money, 2); } if ($money < 0) { $money = 0; } $res_data[$store_value['store_id']] = [ 'money' => floatval($money), 'list' => $res_arr, 'special_time_id' => $special_time_id ?? 0 ]; } 解释代码
最新发布
08-19
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值