作者 李忠强

更新

@@ -202,13 +202,14 @@ class Cart extends Api @@ -202,13 +202,14 @@ class Cart extends Api
202 */ 202 */
203 public function priceCalculation() 203 public function priceCalculation()
204 { 204 {
205 - $json = $this->request->post('data_json'); 205 + $json = $_POST['data_json'];
206 if (!$json) $this->error('data_json参数不能为空'); 206 if (!$json) $this->error('data_json参数不能为空');
207 // $json = '[{"goods_id":22,"goods_sku_id":106,"number":2},{"goods_id":23,"goods_sku_id":66,"number":2}]'; 207 // $json = '[{"goods_id":22,"goods_sku_id":106,"number":2},{"goods_id":23,"goods_sku_id":66,"number":2}]';
208 $data = json_decode($json,true); 208 $data = json_decode($json,true);
209 $goodsmodel = new \app\api\model\Goods(); 209 $goodsmodel = new \app\api\model\Goods();
210 $skumodel = new GoodsSpec(); 210 $skumodel = new GoodsSpec();
211 $sum_price = 0; //总价格 211 $sum_price = 0; //总价格
  212 + var_dump($data);exit();
212 foreach ($data as $key => $value){ 213 foreach ($data as $key => $value){
213 if (!is_numeric($value['goods_id']) || !is_numeric($value['goods_sku_id']) || !is_numeric($value['number'])){ 214 if (!is_numeric($value['goods_id']) || !is_numeric($value['goods_sku_id']) || !is_numeric($value['number'])){
214 $this->error('参数不合法'); 215 $this->error('参数不合法');