|
@@ -171,7 +171,12 @@ class Order
|
|
|
throw new Exception(__('Insufficient inventory,%s pieces left', $productInfo['stock']));
|
|
|
}
|
|
|
$orderPrice = bcadd($orderPrice, bcmul($productInfo['sales_price'], $numbers[$key], 2), 2);
|
|
|
- $ordershouyi= bcadd($ordershouyi, bcmul($productInfo['pifa_shouyi'], $numbers[$key], 2), 2);
|
|
|
+// $ordershouyi= bcadd($ordershouyi, bcmul($productInfo['pifa_shouyi'], $numbers[$key], 2), 2);
|
|
|
+
|
|
|
+ $shouyi = $productInfo['sales_price']-($productInfo['pifa_price']*$productInfo['pifa_number'])+$productInfo['pifa_shouyi'];
|
|
|
+ $ordershouyi= bcadd($ordershouyi, bcmul($shouyi, $numbers[$key], 2), 2);
|
|
|
+
|
|
|
+
|
|
|
$baseProductInfo[] = $productInfo;
|
|
|
}
|
|
|
|
|
@@ -218,7 +223,7 @@ class Order
|
|
|
*/
|
|
|
public function paidSuccess(&$params, $extra)
|
|
|
{
|
|
|
- $nowtime = time();
|
|
|
+ $nowtime = time()+$this->jiesuan_tendays_ago();
|
|
|
$order = &$params;
|
|
|
$order->have_paid = $nowtime;// 更新支付时间为当前时间
|
|
|
$order->pay_type = $extra['pay_type'];
|
|
@@ -242,6 +247,36 @@ class Order
|
|
|
Db::name('user')->where('id',$order->user_id)->update(['last_paytime'=>$nowtime]);
|
|
|
}
|
|
|
|
|
|
+ //结算要按10天算
|
|
|
+ private function jiesuan_tendays_ago(){
|
|
|
+
|
|
|
+ $nowtime = time();
|
|
|
+
|
|
|
+ /*if(input('date','')){
|
|
|
+ $nowtime = strtotime(input('date',''));
|
|
|
+ }*/
|
|
|
+
|
|
|
+ $today = strtotime(date('Y-m-d',$nowtime));
|
|
|
+
|
|
|
+ $toweek = date('w',$nowtime);
|
|
|
+
|
|
|
+
|
|
|
+ $enum = [
|
|
|
+ 1 => 11,
|
|
|
+ 2 => 11,
|
|
|
+ 3 => 11,
|
|
|
+ 4 => 10,
|
|
|
+ 5 => 10,
|
|
|
+ 6 => 10,
|
|
|
+ 0 => 10, //这一天没人结算
|
|
|
+ ];
|
|
|
+
|
|
|
+ $rs = $today - ($enum[$toweek] * 86400);
|
|
|
+// dump(date('Y-m-d',$rs));
|
|
|
+
|
|
|
+ return $rs;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 支付失败
|
|
|
* @param $params
|