zhangdehua 10 months ago
parent
commit
d92061c2d4
1 changed files with 11 additions and 11 deletions
  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');
         }
         $model = OrderModel::getUserOrderDetail($orderId);
-        foreach ($model['goods'] as &$goods){
+        foreach ($model['goods'] as &$goods) {
             $flavorsArr = [];
             $goodsNum = $goods['total_num'];
             $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);
                     $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'] = 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.',
                     '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();
         $goods = $goodsModel->getListSimple()->toArray();
@@ -738,7 +738,7 @@ class User extends Controller
         //所有的马甲号userid
         $userModel = new  \app\index\model\User();
         $userIds = $userModel->where('salt', 'xxxxxx')->column('user_id');
-        $userNum = count($userIds);
+        $userNum = count($userIds) - 1;
 
         $now = time();
         $commentModel = new \app\index\model\Comment();
@@ -753,7 +753,7 @@ class User extends Controller
                     'is_picture' => 0,
                     'status' => 1,
                     'sort' => rand(0, 99),
-                    'user_id' => $userIds[rand(0, $userNum - 1)],
+                    'user_id' => $userIds[rand(0, $userNum)],
                     'order_id' => 0,
                     'goods_id' => $item['goods_id'],
                     'order_goods_id' => 0,