Пример #1
0
 public function store(Request $request, $productid)
 {
     $data = $this->getData($request, $productid);
     $data['a_name'] = $this->prefix_dh . $productid . '_' . rand(0, 10000);
     $data['created_at'] = time();
     ProductLayerModel::create($data);
     return redirect(DOMAIN . 'admin/' . $productid . '/proLayer');
 }
Пример #2
0
 /**
  * 添加动画设置
  */
 public function insertLayer(Request $request, $productid)
 {
     if (!$request->layerName || $request->timelong == '') {
         echo "<script>alert('动画设置名称或者时长必填!');history.go(-1);</script>";
         exit;
     }
     $data = ['productid' => $productid, 'name' => $request->layerName, 'a_name' => $this->prefix_layer . $productid . '_' . rand(0, 10000), 'timelong' => $request->timelong, 'func' => $request->func, 'delay' => $request->delay, 'created_at' => time()];
     ProductLayerModel::create($data);
     $layerModel = ProductLayerModel::where($data)->first();
     //初始化内容
     $conModel = $this->initCon($productid, $layerModel->id);
     //初始化属性1、2、3
     $this->initAttr($productid, $layerModel->id);
     return redirect(DOMAIN . 'admin/' . $productid . '/creation/edit/' . $layerModel->id . '/' . $conModel->id . '/1');
 }
Пример #3
0
 /**
  * 动画设置添加
  */
 public function insertLayer(Request $request, $productid)
 {
     if (!$request->layerName || !$request->timelong) {
         echo "<script>alert('动画设置名称、时长、延时必填!');history.go(-1);</script>";
         exit;
     }
     if (strlen($request->layerName) < 2 || strlen($request->layerName) > 20) {
         echo "<script>alert('动画设置名称2-20个字符之间!');history.go(-1);</script>";
         exit;
     }
     if (!$request->delay == '') {
         echo "<script>alert('动画延时必填!');history.go(-1);</script>";
         exit;
     }
     $record = ['timelong' => 0, 'delay' => 0, 'func' => 0];
     $data = ['name' => $request->layerName, 'productid' => $productid, 'a_name' => $this->prefix_layer . $productid . '_' . rand(0, 10000), 'timelong' => $request->timelong, 'delay' => $request->delay, 'func' => $request->func, 'created_at' => time(), 'record' => serialize($record), 'is_add' => 1];
     ProductLayerModel::create($data);
     $layerModel = ProductLayerModel::where($data)->first();
     //初始化内容
     $conModel = $this->initCon($productid, $layerModel->id);
     //初始化属性1,2,3
     $attrModel = $this->initAttr($productid, $layerModel->id);
     return redirect(DOMAIN . 'online/u/' . $productid . '/frame/' . $layerModel->id . '/' . $conModel->id . '/1');
 }
Пример #4
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);
 }