display(); } /** * 上传音视频:MP3,MP4 */ public function uploadBlessing(){ $index = new Index(); $identification = 'blessing'; $limitSize = $index->plugSetInfo($identification); if($limitSize){ $post['limit_size'] = $limitSize['space'];//文件大小 } $post['catalog'] = 'plug/blessing';//文件子目录 $data = $index->videoUpload($post); $this->ajaxReturn($data); } /** * 修改删除 * 删除音视频:MP3,MP4,ma4 */ public function deleteBlessing(){ $post = I("post."); $param = [ 'storage_type',//存储类型:1本地,2七牛云,3腾讯云,4阿里云 'url',//地址 ]; $index = new Index(); $customValidate = new CustomValidate(); $dataOne = $customValidate->validationParameters($param,$post); if($dataOne !== true){ $this->ajaxReturn($dataOne); } if($post['storage_type'] == ''|| $post['url'] == ''){ $res = callBack(statusCode()['error'],'参数不能为空'); $this->ajaxReturn($res); } $index = new Index(); $data = $index->videoDelete($post['url'],$post['storage_type']); $this->ajaxReturn($data); } /** * 获取门店->营销->祝福语设置信息 */ public function blessingSet(){ $storeId = $this->store_id; //查询插件id,并判断插件是否存在 $plug = new RetailPlugModel();//插件表 $wherePlug = [ 'identification'=>'blessing', ]; $fieldPlug = [ 'id' ]; $plugId = $plug->getFind($wherePlug,$fieldPlug);//插件id if(!$plugId){ $res = callBack(statusCode()['error'],'没有这个插件'); $this->ajaxReturn($res); } //获取门店祝福语设置信息 $storeConfigModel = new StoreConfigModel(); $where = [ 'store_id'=>$storeId ]; $field = [ 'entrance_img_id', 'privacy_statement', ]; $data = $storeConfigModel->getFind($where,$field);//门店设置表信息 //获取门店是否有权限,有权限并返回状态 $retailPlugStoreModel = new RetailPlugStoreModel(); $fieldOne = [ 'status' ]; $whereOne = [ 'store_id'=>$storeId, 'plug_id'=>$plugId['id'] ]; $status = $retailPlugStoreModel->getFind($whereOne,$fieldOne); if($status !== null){ $data['status'] = $status['status']; }else{ $data['status'] = '2';//门店是否开启该插件 1开启 2关闭 } if($data === false || $status === false){ $res = callBack(statusCode()['error'],'失败'); }else{ $ImageGalleryModel = new ImageGalleryModel(); $data['entrance_style'] = $ImageGalleryModel->getImagePath($data['entrance_img_id']);//图片拼接路径 $res = callBack(statusCode()['success'],'成功',$data); } $this->ajaxReturn($res); } //门店祝福语设置修改 public function blessingSetSave(){ $post = I("post."); $param = [ 'privacyStatement',//隐私声明 'status',//功能开关:1开启,2关闭 ]; $index = new Index(); $customValidate = new CustomValidate(); $dataOne = $customValidate->validationParameters($param,$post); if($dataOne !== true){ $this->ajaxReturn($dataOne); } if($post['privacyStatement'] == '' || $post['status'] == ''){ $res = callBack(statusCode()['error'],'参数不能为空'); $this->ajaxReturn($res); } $storeId = $this->store_id; //判断是否有这个插件 $wherePlug = [ 'identification'=>'blessing', ]; $fieldPlug = [ 'id' ]; $plug = new RetailPlugModel();//插件表 $plugId = $plug->getFind($wherePlug,$fieldPlug);//插件id if(!$plugId){ $res = callBack(statusCode()['error'],'没有这个插件'); $this->ajaxReturn($res); } //判断门店是否有权限 $storePlug['store_id'] = $storeId; $storePlug['identification'] = 'blessing'; //门店id $merchantIdBlessingPlug = $index->storeBlessingPlug($storePlug); if($merchantIdBlessingPlug['status'] != 1){ //无权限 $this->ajaxReturn($merchantIdBlessingPlug); } //有权限,可以修改设置 $storeConfigModel = new StoreConfigModel(); $where = [ 'store_id'=>$storeId ]; $save = [ 'entrance_img_id'=>$post['entranceImgId'],//入口样式图片id 'privacy_statement'=>$post['privacyStatement'],//隐私声明 ]; $data = $storeConfigModel->updateOrder($where,$save);//门店设置表信息修改 //因为门店插件表有权限,所以门店插件表有符合条件的数据,可以直接修改 $retailPlugStoreModel = new RetailPlugStoreModel(); $whereOne = [ 'store_id'=>$storeId, 'plug_id'=>$plugId['id'] ]; $saveOne = [ 'status'=>$post['status'] ]; $status = $retailPlugStoreModel->updateOrder($whereOne,$saveOne);//修改门店插件表 if($data === false || $status === false){ $res = callBack(statusCode()['error'],'失败'); }else{ $res = callBack(statusCode()['success'],'成功'); } $this->ajaxReturn($res); } /** * 门店->经营->商城订单明细 */ //判断门店是否有插件权限,并开启插件使用 public function storePlugSet(){ $storeId = $this->store_id; $identification = 'blessing';//插件名 $index = new Index(); //添加祝福语,判断门店是否开启权限 $storePlug['store_id'] = $storeId; $storePlug['identification'] = $identification; $limitSize = $index->plugSetInfo($identification); if($limitSize){ $data['limit_size'] = $limitSize['space'];//文件大小 }else{ $data['limit_size'] = 10;//文件大小 } //门店id $merchantIdBlessingPlug = $index->storePlugStatus($storePlug); if($merchantIdBlessingPlug['status'] != 1){ //无权限 $data['status'] = 2; $res = callBack(statusCode()['success'],'成功',$data); }else{ $data['status'] = 1; $res = callBack(statusCode()['success'],'成功',$data); } $this->ajaxReturn($res); } //订单是否有祝福语,没有为null public function orderBlessing(){ $post = I("post."); $param = [ 'orderId',//订单id ]; $index = new Index(); $customValidate = new CustomValidate(); $dataOne = $customValidate->validationParameters($param,$post); if($dataOne !== true){ $this->ajaxReturn($dataOne); } if($post['orderId'] == ''){ $res = callBack(statusCode()['error'],'参数不能为空'); $this->ajaxReturn($res); } $where = [ 'order_id'=>$post['orderId'],//订单id ]; $field = [ 'type',//类型:1视频,2音频 'storage_type',//存储类型:1本地,2七牛云,3腾讯云,4阿里云 'url',//路径地址 'address',//路径地址 'extraction_code',//祝福码 ]; $plugBlessingModel = new BlessingModel(); $data = $plugBlessingModel->getFind($where,$field); if($data === false){ $res = callBack(statusCode()['error'],'失败'); }else{ if($data && $data['storage_type'] == 1){ $entrance_style = getServerUrl(); $data['address'] = $entrance_style.'/'.$data['url']; } $res = callBack(statusCode()['success'],'成功',$data); } $this->ajaxReturn($res); } /** * 祝福语 */ //添加祝福语 public function addBlessing(){ $post = I("post."); $param = [ 'orderId',//订单id 'type',//类型:1视频,2音频 'url',//路径地址:Uploads/plug/blessing/2021-03-30/606300c886fa12205.mp4 'storageType',//存储类型:1本地,2七牛云,3腾讯云,4阿里云 'address',//http://qny.zaiyuliya.com/plug/blessing/16171579126063df1852bf1.mp4 ]; $index = new Index(); $customValidate = new CustomValidate(); $dataOne = $customValidate->validationParameters($param,$post); if($dataOne !== true){ $this->ajaxReturn($dataOne); } if($post['orderId'] == '' || $post['type'] == '' || $post['url'] == '' || $post['storageType'] == ''){ $res = callBack(statusCode()['error'],'参数不能为空'); $this->ajaxReturn($res); } $storeId = $this->store_id;//门店id $merchantId = $this->merchant_id;//商户id //添加祝福语,判断门店是否有权限 $storePlug['store_id'] = $storeId; $storePlug['identification'] = 'blessing'; //门店id $merchantIdBlessingPlug = $index->storeBlessingPlug($storePlug); if($merchantIdBlessingPlug['status'] != 1){ //无权限 $this->ajaxReturn($merchantIdBlessingPlug); } //生成提取码 $extractionCode = $index->extractionCode($storeId); $add = [ 'merchant_id'=>$merchantId, 'store_id'=>$storeId, 'order_id'=>$post['orderId'], 'type'=>$post['type'], 'extraction_code'=>$extractionCode, 'url'=>$post['url'], 'storage_type'=>$post['storageType'], 'address'=>$post['address'], 'create_time'=>time(), ]; $plugBlessingModel = new BlessingModel(); $data = $plugBlessingModel->addOrder($add); if($data === false){ $res = callBack(statusCode()['error'],'失败'); }else{ $res = callBack(statusCode()['success'],'成功',$extractionCode); } $this->ajaxReturn($res); } //修改祝福语 public function blessingSave(){ $post = I("post."); $param = [ 'orderId',//订单id 'type',//类型:1视频,2音频 'url',//路径地址 'storageType',//存储类型:1本地,2七牛云,3腾讯云,4阿里云 'address',//http://qny.zaiyuliya.com/plug/blessing/16171579126063df1852bf1.mp4 ]; $index = new Index(); $customValidate = new CustomValidate(); $dataOne = $customValidate->validationParameters($param,$post); if($dataOne !== true){ $this->ajaxReturn($dataOne); } if($post['orderId'] == '' || $post['type'] == '' || $post['url'] == '' || $post['storageType'] == '' || $post['address'] == ''){ $res = callBack(statusCode()['error'],'参数不能为空'); $this->ajaxReturn($res); } $storeId = $this->store_id;//门店id //添加祝福语,判断门店是否有权限 $storePlug['store_id'] = $storeId; $storePlug['identification'] = 'blessing'; //门店id $merchantIdBlessingPlug = $index->storeBlessingPlug($storePlug); if($merchantIdBlessingPlug['status'] != 1){ //无权限 $this->ajaxReturn($merchantIdBlessingPlug); } $where = [ 'order_id'=>$post['orderId'] ]; $save = [ 'type'=>$post['type'],//类型:1视频,2音频 'url'=>$post['url'],//路径地址 'storage_type'=>$post['storageType'],//存储类型:1本地,2七牛云,3腾讯云,4阿里云 'address'=>$post['address'],//详细路径地址 'update_time'=>time(),//更新时间 ]; $plugBlessingModel = new BlessingModel(); $data = $plugBlessingModel->updateOrder($where,$save); if($data === false){ $res = callBack(statusCode()['error'],'失败'); }else{ $res = callBack(statusCode()['success'],'成功'); } $this->ajaxReturn($res); } }