request; if($request->isGet){ $result=axios_request(); $info=(new \yii\db\Query()) ->select('id,body') ->from('{{%ybwm_drag}}') ->where(['deleteAt'=>0,'id'=>$result['id'],'uniacid'=>$this->wqData['uniacid']]) ->one(); $info['body']=json_decode($info['body'],true); echo json_encode(['code'=>1,'msg'=>'成功','data'=>$info]);die; //return $this->result(1, '成功',$info); } } //添加装修页面 public function actionDragSave(){ $request = Yii::$app->request; if($request->isPost){ $result=axios_request(); //dd($result);die; if(!$result['id']){ if(!$result['name']){ return $this->result(2, '页面名称不能为空'); } if(!$result['page']){ return $this->result(2, '页面类型不能为空'); } //Yii::$app->db->createCommand()->update('{{%ybwm_drag}}', ['display'=>2], ['page' =>$result['page'],'deleteAt'=>0,'uniacid'=>$this->wqData['uniacid']])->execute(); } $data=array( 'uniacid'=>$this->wqData['uniacid'], ); if($result['body']){ $data['body']=json_encode($result['body']); } if($result['name']){ $data['name']=$result['name']; } if($result['page']){ $data['page']=$result['page']; } if($result['sort']){ $data['sort']=$result['sort']; } //$data=filter_array($data); if ($result['id']) { $data['changeAt']=time(); $res = Yii::$app->db->createCommand()->update('{{%ybwm_drag}}', $data, ['id' =>$result['id'],'uniacid'=>$this->wqData['uniacid']])->execute(); } else{ $data['body']=$result['body']?json_encode($result['body']):Drag::defaultIndex($result['page']); $data['createdAt'] = time(); $data['display'] = 2; $res=Yii::$app->db->createCommand()->insert('{{%ybwm_drag}}', $data)->execute(); } if ($res) { return $this->result(1, '操作成功'); } else { return $this->result(2, '失败'); } } } public function actionGetDragList(){ $request = Yii::$app->request; $page=Yii::$app->request->get('page')?Yii::$app->request->get('page'):1; $num=($page-1)*10; $limit=10; if($request->isGet){ $count=(new \yii\db\Query()) ->from('{{%ybwm_drag}}') ->select('id,sort,from_unixtime(createdAt) createdAt,from_unixtime(changeAt) changeAt,name,display,page') ->where(['deleteAt'=>0,'uniacid'=>$this->wqData['uniacid']])->count(); $addressInfo=(new \yii\db\Query()) ->from('{{%ybwm_drag}}') ->select('id,sort,from_unixtime(createdAt) createdAt,from_unixtime(changeAt) changeAt,name,display,page') ->where(['deleteAt'=>0,'uniacid'=>$this->wqData['uniacid']]) ->offset($num) ->limit($limit) ->all(); foreach ($addressInfo as $k=>$v){ if($v['changeAt']=='1970-01-01 08:00:00'){ $addressInfo[$k]['changeAt']=$v['createdAt']; } } return $this->result(1, '成功',$addressInfo,$count); } } public function actionChangeDrag(){ $request = Yii::$app->request; if($request->isPost){ $result=axios_request(); $id=$result['id']; $row=(new \yii\db\Query()) ->from('{{%ybwm_drag}}') ->where(['deleteAt'=>0,'id'=>$id]) ->one(); if($row['page']<>3){ if($result['display']==2){ return $this->result(1,'必须开启一个选项'); } } if($result['display']==1){ $newDis=2; }else{ $newDis=1; } if($row['page']<>3){ YII::$app->db->createCommand()->update('{{%ybwm_drag}}', ['display'=>$newDis], ['page'=>$row['page'],'uniacid'=>$this->wqData['uniacid']])->execute(); } if(is_array($id)){ YII::$app->db->createCommand()->update('{{%ybwm_drag}}', ['display'=>$result['display']], ['in','id',$id])->execute(); }else{ YII::$app->db->createCommand()->update('{{%ybwm_drag}}', ['display'=>$result['display']], ['id'=>$id])->execute(); } return $this->result(1,'操作成功'); } } public function actionDragDel(){ $request = Yii::$app->request; if($request->isPost){ $id=axios_request()['id']; if(is_array($id)){ YII::$app->db->createCommand()->update('{{%ybwm_drag}}', ['deleteAt'=>time()], ['in','id',$id])->execute(); }else{ YII::$app->db->createCommand()->update('{{%ybwm_drag}}', ['deleteAt'=>time()], ['id'=>$id])->execute(); } return $this->result(1,'操作成功'); } } //获取拖拽式链接 public function actionGetDragLink(){ $data=array( 'title'=>'行业功能', 'children'=>[ [ 'id' => 'index', 'name' => '门店首页', ], [ 'id' => 'goods', 'name' => '点单页', ], [ 'id' => 'cashier', 'name' => '当面付', ], [ 'id' => 'scanOrder', 'name' => '扫码点餐', ], [ 'id' => 'fastOrder', 'name' => '快餐', ], ]); $queuing=Power::getPayPower($this->wqData['uniacid'],'queuing'); if($queuing){ $data['children'][]=[ 'id' => 'queuing', 'name' => '排队取号' ]; } $reserve=Power::getPayPower($this->wqData['uniacid'],'reserve'); if($reserve){ $data['children'][]=[ 'id' => 'reserve', 'name' => '餐桌预定' ]; } $data['children'][]=[ 'id' => 'storage', 'name' => '酒水寄存', ]; $data['children'][]=[ 'id' => 'userStorage', 'name' => '我的寄存', ]; $data['children'][]=[ 'id' => 'takeOutFood', 'name' => '外卖地址', ]; $data['children'][]=[ 'id' => 'TakeFood', 'name' => '自取类型', ]; $data['children'][]=[ 'id' => 'myCoupon', 'name' => '我的优惠券', ]; $data['children'][]=[ 'id' => 'navigation', 'name' => '门店导航', ]; $data['children'][]=[ 'id' => 'myOrder', 'name' => '我的订单', ]; $data['children'][]=[ 'id' => 'member', 'name' => '个人中心', ]; $data['children'][]=[ 'id' => 'aboutUs', 'name' => '关于我们', ]; $data['children'][]=[ 'id' => 'helpCenter', 'name' => '帮助中心', ]; $data['children'][]=[ 'id' => 'contactCustomer', 'name' => '联系客服', ]; $data['children'][]=[ 'id' => 'myAddress', 'name' => '我的地址', ]; $data['children'][]=[ 'id' => 'couponCenter', 'name' => '领券中心', ]; $data['children'][]=[ 'id' => 'exchange', 'name' => '兑券入口', ]; $data['children'][]=[ 'id' => 'live', 'name' => '直播列表', ]; $data['children'][]=[ 'id' => 'balanceRecharge', 'name' => '充值中心', ]; $data['children'][]=[ 'id' => 'signIndex', 'name' => '积分签到', ]; $data['children'][]=[ 'id' => 'integralShop', 'name' => '积分商城', ]; $data['children'][]=[ 'id' => 'collectionCourtesy', 'name' => '收藏有礼', ]; $data['children'][]=[ 'id' => 'information', 'name' => '资讯列表', ]; $data['children'][]=[ 'id' => 'cardIndex', 'name' => '普通会员卡', ]; $data['children'][]=[ 'id' => 'collect', 'name' => '集点活动', ]; $data['children'][]=[ 'id' => 'myShangQuan', 'name' => '我的商圈', ]; $payVip=Power::getPayPower($this->wqData['uniacid'],'payVip'); if($payVip){ $data['children'][]=[ 'id' => 'payVip', 'name' => '付费会员卡' ]; } $oldWithNew=Power::getPayPower($this->wqData['uniacid'],'oldWithNew'); if($oldWithNew){ $data['children'][]=[ 'id' => 'oldWithNew', 'name' => '老带新' ]; } $distribution=Power::getPayPower($this->wqData['uniacid'],'distribution'); if($distribution){ $data['children'][]=[ 'id' => 'distribution', 'name' => '分销商' ]; } //$configData=Config::getSystemSet('sysTopImage',$this->wqData['uniacid']); // dd($configData);die; return json_encode(['code'=>1,'msg'=>'成功','data'=>$data]); } //获取装修页面自定义页面 public function actionGetCustomList(){ $page=Yii::$app->request->get('page')?Yii::$app->request->get('page'):1; $num=($page-1)*10; $limit=10; $query=(new \yii\db\Query()) ->from('{{%ybwm_drag}}') ->where(['deleteAt'=>0,'page'=>3,'display'=>1,'uniacid'=>$this->wqData['uniacid']]); $count=$query->count(); $data=(clone $query)->offset($num)->limit($limit)->orderBy('sort asc,id desc')->all(); return $this->result(1,'成功',$data,$count); } //装修页面视频上传 public function actionUploadVoice(){ $result=axios_request(); $name='视频素材'; $info=(new \yii\db\Query()) ->from('{{%ybwm_core_category}}') ->where('uniacid=:uniacid AND item=4 AND deleteAt=0 AND name=:name',[':name'=>$name,':uniacid'=>$this->wqData['uniacid']])->one(); $categoryId=$info['id']; if(!$info){ $data['name']=$name; $data['item']=4; $data['uniacid']=$this->wqData['uniacid']; $data['changeAt']=time(); Yii::$app->db->createCommand()->insert('{{%ybwm_core_category}}', $data)->execute(); $categoryId=Yii::$app->db->getLastInsertId(); } $config=Config::getSystemSet('storage',0); if($config['type']==1){ $fname=File::qiniuUpload('file',$this->wqData['module'],$this->wqData['uniacid'],$config); }elseif($config['type']==2){ $fname=File::aliUpload('file',$this->wqData['module'],$this->wqData['uniacid'],$config); }elseif($config['type']==3){ $fname=File::txyUpload('file',$this->wqData['module'],$this->wqData['uniacid'],$config); }else{ $fname=File::channelUploadImage('file','',$this->wqData['module'],$this->wqData['uniacid']); } $array['categoryId'] =$categoryId; $array['url'] = $fname; $array['name'] = $_FILES['file']['name']; $array['storeId'] = $result['storeId'] ?: 0; $array['createdAt'] = time(); $array['deleteAt'] = 0; $array['uniacid'] = $this->wqData['uniacid']; $array['fileType'] = 2; $res=Yii::$app->db->createCommand()->insert('{{%ybwm_core_file}}', $array)->execute(); if ($res) { return $this->result(1, '成功!',$res); } else { return $this->result(2, '失败!'); } return $this->result(1,'成功',$fname); } }