|
|
|
@ -36,7 +36,7 @@ class Presale extends Controller |
|
|
|
|
$model = new PreSaleModel; |
|
|
|
|
$goodsModel = new \app\common\model\Goods(); |
|
|
|
|
$detail = $model->get($id); |
|
|
|
|
$detail['goods_list'] = $goodsModel->whereIn('goods_id', explode(',', $detail['goods_list']))->select()->toArray(); |
|
|
|
|
$detail['goods_list'] = $goodsModel->with(['images.file'])->whereIn('goods_id', explode(',', $detail['goods_list']))->select()->toArray(); |
|
|
|
|
return $this->renderSuccess(compact('detail')); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -45,7 +45,7 @@ class Presale extends Controller |
|
|
|
|
*/ |
|
|
|
|
public function log(int $pre_id): Json { |
|
|
|
|
$model = new PreSaleLogModel(); |
|
|
|
|
$list = $model->with(['goods']) |
|
|
|
|
$list = $model->with(['goods.images.file']) |
|
|
|
|
->where('store_id', $this->storeId) |
|
|
|
|
->where('pre_id', $pre_id) |
|
|
|
|
->paginate(15); |
|
|
|
@ -77,9 +77,8 @@ class Presale extends Controller |
|
|
|
|
$model = new PreSaleModel; |
|
|
|
|
$data = $this->postForm(); |
|
|
|
|
$data['store_id'] = $this->storeId; |
|
|
|
|
$data['ctime'] = time(); |
|
|
|
|
$data['p_time'] = time(); |
|
|
|
|
$data['goods_list'] = implode(',', $data['goods_list']); |
|
|
|
|
$data['ctime'] = format_time(time()); |
|
|
|
|
$data['p_time'] = format_time(time()); |
|
|
|
|
if ($model->save($data)) { |
|
|
|
|
return $this->renderSuccess('添加成功'); |
|
|
|
|
} |
|
|
|
@ -96,7 +95,7 @@ class Presale extends Controller |
|
|
|
|
// 评论详情 |
|
|
|
|
$model = PreSaleModel::get($id); |
|
|
|
|
$data = $this->postForm(); |
|
|
|
|
$data['p_time'] = time(); |
|
|
|
|
$data['p_time'] = format_time(time()); |
|
|
|
|
// 更新记录 |
|
|
|
|
if ($model->save($data)) { |
|
|
|
|
return $this->renderSuccess('更新成功'); |
|
|
|
|