zhangdehua 10 月之前
父節點
當前提交
d92061c2d4
共有 1 個文件被更改,包括 11 次插入11 次删除
  1. 11 11
      app/index/controller/User.php

+ 11 - 11
app/index/controller/User.php

@@ -69,21 +69,21 @@ class User extends Controller
             return redirect('/index/passport/login.html');
             return redirect('/index/passport/login.html');
         }
         }
         $model = OrderModel::getUserOrderDetail($orderId);
         $model = OrderModel::getUserOrderDetail($orderId);
-        foreach ($model['goods'] as &$goods){
+        foreach ($model['goods'] as &$goods) {
             $flavorsArr = [];
             $flavorsArr = [];
             $goodsNum = $goods['total_num'];
             $goodsNum = $goods['total_num'];
             $flavorsAll = json_decode($goods['remark_for_one'], true);
             $flavorsAll = json_decode($goods['remark_for_one'], true);
 
 
-            foreach ($flavorsAll as $k => $v){
-                if (!empty($v)){
+            foreach ($flavorsAll as $k => $v) {
+                if (!empty($v)) {
                     $temp1 = bcmul(strval($v), strval($goodsNum), 0);
                     $temp1 = bcmul(strval($v), strval($goodsNum), 0);
                     $flavorsArr[$k] = $temp1;
                     $flavorsArr[$k] = $temp1;
                 }
                 }
             }
             }
 
 
-/*            array_walk($flavorsAll, function (&$item, $key) use ($goodsNum) {
-                $item = bcmul(strval($item), strval($goodsNum), 0);
-            });*/
+            /*            array_walk($flavorsAll, function (&$item, $key) use ($goodsNum) {
+                            $item = bcmul(strval($item), strval($goodsNum), 0);
+                        });*/
 
 
             $goods['remark_for_one'] = $flavorsArr;
             $goods['remark_for_one'] = $flavorsArr;
             //$goods['remark_for_one'] = json_encode($flavorsAll);
             //$goods['remark_for_one'] = json_encode($flavorsAll);
@@ -728,9 +728,9 @@ class User extends Controller
                     'Electronic cigarettes are very environmentally friendly, do not produce smoke, and have no negative impact on the environment, which makes me feel very proud.',
                     'Electronic cigarettes are very environmentally friendly, do not produce smoke, and have no negative impact on the environment, which makes me feel very proud.',
                     'very portable', ' I can use them anytime, anywhere. They are very convenient, and I no longer have to worry about not finding an ashtray.'
                     'very portable', ' I can use them anytime, anywhere. They are very convenient, and I no longer have to worry about not finding an ashtray.'
                 ];*/
                 ];*/
-        $favorCount = count($favor);
-        $priceCount = count($price);
-        $amountCount = count($amount);
+        $favorCount = count($favor) - 1;
+        $priceCount = count($price) - 1;
+        $amountCount = count($amount) - 1;
 
 
         $goodsModel = new Goods();
         $goodsModel = new Goods();
         $goods = $goodsModel->getListSimple()->toArray();
         $goods = $goodsModel->getListSimple()->toArray();
@@ -738,7 +738,7 @@ class User extends Controller
         //所有的马甲号userid
         //所有的马甲号userid
         $userModel = new  \app\index\model\User();
         $userModel = new  \app\index\model\User();
         $userIds = $userModel->where('salt', 'xxxxxx')->column('user_id');
         $userIds = $userModel->where('salt', 'xxxxxx')->column('user_id');
-        $userNum = count($userIds);
+        $userNum = count($userIds) - 1;
 
 
         $now = time();
         $now = time();
         $commentModel = new \app\index\model\Comment();
         $commentModel = new \app\index\model\Comment();
@@ -753,7 +753,7 @@ class User extends Controller
                     'is_picture' => 0,
                     'is_picture' => 0,
                     'status' => 1,
                     'status' => 1,
                     'sort' => rand(0, 99),
                     'sort' => rand(0, 99),
-                    'user_id' => $userIds[rand(0, $userNum - 1)],
+                    'user_id' => $userIds[rand(0, $userNum)],
                     'order_id' => 0,
                     'order_id' => 0,
                     'goods_id' => $item['goods_id'],
                     'goods_id' => $item['goods_id'],
                     'order_goods_id' => 0,
                     'order_goods_id' => 0,