public function edit($goods_id) { //检查登录 $this->_login(); if (!$goods_id) { $url = url('admin', 'admingoods::detail'); header('Location:' . $url); throw new Exception('exit'); } $where = array(); $data = array(); $goods_id = $goods_id + 0; $where['goods_id'] = $goods_id; $data = $this->_getPost(); AdminGoodsM::update($data, $where); $url = url('admin', 'admingoods::detail', $goods_id); header('Location:' . $url); throw new Exception('exit'); }
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; }