|
|
|
@ -25,6 +25,7 @@ use app\common\model\GoodsCategoryRel; |
|
|
|
|
*/ |
|
|
|
|
class Goods extends Controller |
|
|
|
|
{ |
|
|
|
|
private static $show_content = "***"; |
|
|
|
|
/** |
|
|
|
|
* 商品列表 |
|
|
|
|
* @return Json |
|
|
|
@ -35,8 +36,25 @@ class Goods extends Controller |
|
|
|
|
// 获取列表记录 |
|
|
|
|
$model = new GoodsModel; |
|
|
|
|
$params = $this->request->param(); |
|
|
|
|
$params['channel'] = 'zy'; |
|
|
|
|
//$params['channel'] = 'zy'; |
|
|
|
|
$list = $model->getList($params, (int)$this->request->param('pageSize', 15)); |
|
|
|
|
if ($list->isEmpty()) { |
|
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
|
} |
|
|
|
|
$list = $list->toArray(); |
|
|
|
|
|
|
|
|
|
foreach ($list['data'] as &$value) { |
|
|
|
|
if (!in_array($value['channel'], ['zy'])) { |
|
|
|
|
$value['goods_price_min'] = self::$show_content; |
|
|
|
|
$value['goods_price_max'] = self::$show_content; |
|
|
|
|
$value['line_price_max'] = self::$show_content; |
|
|
|
|
$value['line_price_min'] = self::$show_content; |
|
|
|
|
$value['cost_price_min'] = self::$show_content; |
|
|
|
|
$value['goods_no'] = self::$show_content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $this->renderSuccess(compact('list')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -67,6 +85,19 @@ class Goods extends Controller |
|
|
|
|
// 获取商品详情 |
|
|
|
|
$model = new GoodsModel; |
|
|
|
|
$goodsInfo = $model->getDetail($goodsId); |
|
|
|
|
if (!in_array($goodsInfo['channel'], ['zy'])) { |
|
|
|
|
$goodsInfo['goods_price_min'] = self::$show_content; |
|
|
|
|
$goodsInfo['goods_price_max'] = self::$show_content; |
|
|
|
|
$goodsInfo['line_price_max'] = self::$show_content; |
|
|
|
|
$goodsInfo['line_price_min'] = self::$show_content; |
|
|
|
|
$goodsInfo['cost_price_min'] = self::$show_content; |
|
|
|
|
$goodsInfo['goods_no'] = self::$show_content; |
|
|
|
|
foreach ($goodsInfo['skuList'] as $key => &$value) { |
|
|
|
|
$value['goods_price'] = self::$show_content; |
|
|
|
|
$value['cost_price'] = self::$show_content; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return $this->renderSuccess(compact('goodsInfo')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -117,8 +148,22 @@ class Goods extends Controller |
|
|
|
|
{ |
|
|
|
|
// 商品详情 |
|
|
|
|
$model = GoodsModel::detail($goodsId); |
|
|
|
|
$params = $this->postForm(); |
|
|
|
|
if ($model->isEmpty()) { |
|
|
|
|
return $this->renderError("该商品已不存在!"); |
|
|
|
|
} |
|
|
|
|
if (!in_array($model->channel, ['zy'])) { |
|
|
|
|
$params['goods_price'] = $model->goods_price_min; |
|
|
|
|
$params['cost_price'] = $model->cost_price_min; |
|
|
|
|
$params['goods_no'] = $model->goods_no; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($params); |
|
|
|
|
// print_r($model->toArray()); |
|
|
|
|
// exit(); |
|
|
|
|
// 更新记录 |
|
|
|
|
if ($model->edit($this->postForm())) { |
|
|
|
|
if ($model->edit($params)) { |
|
|
|
|
return $this->renderSuccess('更新成功'); |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '更新失败'); |
|
|
|
|