Exemplo n.º 1
0
 /**
  * 查询方法
  */
 public function query($productid, $layerid)
 {
     $datas = ProductConModel::where('productid', $productid)->where('layerid', $layerid)->orderBy('id', 'desc')->paginate($this->limit);
     $datas->limit = $this->limit;
     return $datas;
 }
Exemplo n.º 2
0
 /**
  * 得到修改过的产品内容
  */
 public function getProCons()
 {
     $conModels = ProductConModel::where('productid', $this->id)->get();
     foreach ($conModels as $conModel) {
         if ($conModel->record) {
             $conRecord[$conModel->id] = $conModel;
         }
         if ($conModel->is_add) {
             $conAdd[$conModel->id] = $conModel;
         }
     }
     return array('records' => isset($conRecord) ? $conRecord : [], 'adds' => isset($conAdd) ? $conAdd : []);
 }
Exemplo n.º 3
0
 /**
  * 初始化一条内容
  */
 public function initCon($productid, $layerid)
 {
     $data = ['productid' => $productid, 'layerid' => $layerid, 'genre' => 1, 'pic_id' => 1, 'name' => '', 'created_at' => time()];
     ProductConModel::create($data);
     $conModel = ProductConModel::where($data)->first();
     return $conModel;
 }
Exemplo n.º 4
0
 /**
  * 收集内容数据
  */
 public function getConData($pid, $layerid, $newpid, $layerNewId)
 {
     $conModel = ProductConModel::where('productid', $pid)->where('layerid', $layerid)->first();
     $data = ['productid' => $newpid, 'layerid' => $layerNewId, 'genre' => $conModel->genre, 'pic_id' => $conModel->pic_id, 'name' => $conModel->name, 'created_at' => time(), 'record' => 0];
     ProductConModel::create($data);
 }