Esempio n. 1
0
 public function edit($productid, $layerid, $id)
 {
     $curr['name'] = $this->crumb['edit']['name'];
     $curr['url'] = $this->crumb['edit']['url'];
     $result = ['data' => ProductConModel::find($id), 'pics' => $this->model->picAll(), 'model' => $this->model, 'crumb' => $this->crumb, 'curr' => $curr, 'productid' => $productid, 'layerid' => $layerid];
     return view('admin.proCon.edit', $result);
 }
Esempio n. 2
0
 /**
  * 内容修改
  */
 public function updateCon(Request $request, $productid, $con_id)
 {
     if ($request->conGenre == 1 && !$request->conPic) {
         echo "<script>alert('图片必选!');history.go(-1);</script>";
         exit;
     } elseif ($request->conGenre == 2 && !$request->conText) {
         echo "<script>alert('文字必填!');history.go(-1);</script>";
         exit;
     }
     $data = ['genre' => $request->conGenre, 'pic_id' => $request->conPic, 'name' => $request->conText, 'updated_at' => time()];
     ProductConModel::where('id', $con_id)->update($data);
     //判断有无更新,判断是否用户自己添加的再更新
     $conModel = ProductConModel::find($con_id);
     if ($con_id->genre == $request->conGenre || $con_id->pic_id == $request->conPic || $con_id->name == $request->conText) {
         $isadd = $conModel->is_add == 1 ? 2 : $conModel->is_add;
         ProductConModel::where('id', $con_id)->update(['record' => 1, 'is_add' => $isadd]);
     }
     return redirect(DOMAIN . 'online/u/' . $productid . '/frame/' . $request->layerid . '/' . $con_id . '/' . $request->attrGenre);
 }
Esempio n. 3
0
 /**
  * 获取一条图文记录
  */
 public function getOneCon($productid, $layerid, $con_id)
 {
     if ($con_id == 0) {
         $data = ProductConModel::where('productid', $productid)->where('layerid', $layerid)->orderBy('id', 'asc')->first();
     } else {
         $data = ProductConModel::find($con_id);
     }
     return $data;
 }