Example #1
0
 public static function plusStock($uid = null, $order_id = null)
 {
     if (!$order_id || !$uid) {
         return false;
     }
     $order_id = (int) $order_id;
     //获取商品信息
     if ($uid) {
         $goods_list_info = OrderGoodsInfo::getUserOrderGoodsInfoByOrderId($uid, $order_id);
     } else {
         $goods_list_info = OrderGoodsInfo::getOrderGoodsInfoByOrderId($uid, $order_id);
     }
     foreach ($goods_list_info as $key => $value) {
         $goods_id = $value['goods_id'];
         $goods_num = $value['goods_num'];
         //获取库存
         $goods_info = AdminGoodsM::getGoodsInfoByGoodsId($goods_id);
         if ($goods_info['goods_num'] !== false) {
             $data['goods_num'] = $goods_info['goods_num'] + $goods_num;
             $where['goods_id'] = $goods_id;
             AdminGoodsM::update($data, $where);
         }
     }
     return true;
 }
Example #2
0
 protected function _newUserOrderList($list)
 {
     if (!$list) {
         return false;
     }
     if (is_array($list)) {
         foreach ($list as $key => $value) {
             $list[$key]['order_money2'] = $value['order_money'] + $value['shipping_fee'] - $value['bonus'];
             //应付款金额
             //收货地址
             $address_detail = '';
             $address_detail = RegionM::getAddressDetail($value['province'], $value['city'], $value['district']);
             $list[$key]['address2'] = $address_detail . $value['address'];
             $list[$key]['order_detail_url'] = url('usercenter', 'usercenter::detail', $value['order_id']);
             //订单详情
             $list[$key]['cancel_order_url'] = url('usercenter', 'usercenter::cancelorder', $value['order_id']);
             //取消订单
             //配货中状态
             if ($value['order_status'] == 'no') {
                 $list[$key]['status'] = '已取消';
             } elseif ($value['order_status'] == 'yes' && $value['confirm_status'] == 'yes' && $value['ready_status'] == 'yes' && $value['shipping_status'] != 'yes') {
                 $list[$key]['status'] = '配货中';
             } elseif ($value['order_status'] == 'yes' && $value['confirm_status'] == 'yes' && $value['ready_status'] == 'yes' && $value['shipping_status'] == 'yes' && $value['receive_status'] != 'yes') {
                 $list[$key]['status'] = '发货中';
             } elseif ($value['order_status'] == 'yes' && $value['confirm_status'] == 'yes' && $value['ready_status'] == 'yes' && $value['shipping_status'] == 'yes' && $value['receive_status'] == 'yes') {
                 $list[$key]['status'] = '已收货';
             } else {
                 $list[$key]['status'] = '未确认';
             }
             //支付方式
             $pay = GoodsM::getPayList($value['sn']);
             if ($pay) {
                 $list[$key]['alipay_url'] = $pay['alipay'];
                 $list[$key]['wxpay_url'] = $pay['wxpay'];
                 $list[$key]['wxsaomapay_url'] = $pay['wxsaomapay'];
             } else {
                 $list[$key]['alipay_url'] = '';
                 $list[$key]['wxpay_url'] = '';
                 $list[$key]['wxsaomapay_url'] = '';
             }
             //去支付,调到详情页
             $list[$key]['gotopay_url'] = $list[$key]['order_detail_url'];
             //联系方式
             if ($value['mobile'] != '') {
                 $list[$key]['call'] = $value['mobile'];
             } elseif ($value['tel'] != '' && $value['mobile'] == '') {
                 $list[$key]['call'] = $value['tel'];
             } else {
                 $list[$key]['call'] = '';
             }
             //获取商品信息
             $goods_list = OrderGoodsInfo::getUserOrderGoodsInfoByOrderId($value['uid'], $value['order_id']);
             if ($goods_list) {
                 foreach ($goods_list as $k => $v) {
                     $goods_list[$k]['goods_detail_url'] = url('home', 'home::detail', $v['goods_id']);
                     //跳到商品详情页面
                 }
             }
             $list[$key]['goods_list'] = $goods_list;
         }
     }
     return $list;
 }