Ejemplo n.º 1
0
 /**
  * 得到修改过的产品的动画设置
  */
 public function getProLayers()
 {
     $layerModels = ProductLayerModel::where('productid', $this->id)->get();
     foreach ($layerModels as $layerModel) {
         if ($layerModel->record && ($records = unserialize($layerModel->record))) {
             if ($records['delay'] || $records['timelong'] || $records['func']) {
                 $layerRecord[$layerModel->id] = $layerModel;
             }
         }
         if ($layerModel->is_add) {
             $layerAdd[$layerModel->id] = $layerModel;
         }
     }
     return array('records' => isset($layerRecord) ? $layerRecord : [], 'adds' => isset($layerAdd) ? $layerAdd : []);
 }
Ejemplo n.º 2
0
 /**
  * 通过 layerid 得到 layerName
  */
 public function getLayerNameById($layerid)
 {
     $layerModel = ProductLayerModel::find($layerid);
     return $layerModel ? $layerModel->name : '';
 }
Ejemplo n.º 3
0
 /**
  * 动画设置修改
  */
 public function updateLayer(Request $request, $productid, $layerid)
 {
     if ($request->delay == '' || !$request->timelong) {
         echo "<script>alert('动画设置的延时、时长必填!');history.go(-1);</script>";
         exit;
     }
     //判断已经修改的字段
     $record = ['delay' => 0, 'timelong' => 0, 'func' => 0];
     $data = ['delay' => $request->delay, 'timelong' => $request->timelong, 'func' => $request->func, 'updated_at' => time(), 'record' => serialize($record)];
     ProductLayerModel::where('id', $layerid)->update($data);
     //判断是否用户自己添加的设置
     $layerModel = ProductLayerModel::find($layerid);
     $record2 = $record;
     if ($request->delay != $layerModel->delay) {
         $record2['delay'] = 1;
     }
     if ($request->timelong != $layerModel->timelong) {
         $record2['timelong'] = 1;
     }
     if ($request->func != $layerModel->func) {
         $record2['func'] = 1;
     }
     if (isset($record2)) {
         ProductLayerModel::where('id', $layerid)->where('record', serialize($record))->update(['record' => serialize($record2), 'is_add' => 2]);
     }
     return redirect(DOMAIN . 'online/u/' . $productid . '/frame/' . $layerid . '/' . $request->con_id . '/' . $request->attrGenre);
 }
Ejemplo n.º 4
0
 /**
  * 获取一条动画记录
  */
 public function getOneLayer($productid, $layerid)
 {
     if ($layerid) {
         $layer = ProductLayerModel::find($layerid);
     } else {
         $layer = ProductLayerModel::where('productid', $productid)->orderBy('delay', 'asc')->orderBy('id', 'asc')->first();
     }
     return $layer;
 }
Ejemplo n.º 5
0
 /**
  * 动画设置信息
  */
 public function getlayer()
 {
     $layerid = $this->layerid ? $this->layerid : 0;
     $layerModel = ProductLayerModel::find($layerid);
     return $layerModel ? $layerModel : '';
 }
Ejemplo n.º 6
0
 /**
  * 动画设置信息
  */
 public function getLayer()
 {
     return ProductLayerModel::find($this->layerid);
 }
Ejemplo n.º 7
0
 /**
  * 查询动画设置
  */
 public function query($productid)
 {
     $datas = ProductLayerModel::where('productid', $productid)->orderBy('delay', 'asc')->orderBy('id', 'asc')->paginate($this->limit);
     $datas->limit = $this->limit;
     return $datas;
 }
Ejemplo n.º 8
0
 /**
  * 获取动画设置记录
  * 产品id、产品新id
  * 得到新动画设置id数组
  */
 public function getLayer($pid, $newpid)
 {
     $layerModels = ProductLayerModel::where('productid', $pid)->get();
     $layerOldArr = array();
     $layerNewArr = array();
     foreach ($layerModels as $layerModel) {
         $record = ['timelong' => 0, 'func' => 0, 'delay' => 0];
         $data = ['name' => $layerModel->name, 'productid' => $newpid, 'a_name' => $layerModel->a_name, 'timelong' => $layerModel->timelong, 'func' => $layerModel->func, 'delay' => $layerModel->delay, 'created_at' => time(), 'record' => serialize($record)];
         ProductLayerModel::create($data);
         $layerModelNew = ProductLayerModel::where($data)->first();
         $layerOldArr[] = $layerModel->id;
         $layerNewArr[] = $layerModelNew->id;
     }
     return array('layerOld' => $layerOldArr, 'layerNew' => $layerNewArr);
 }