init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,327 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: yang
|
||||
* Date: 2021/3/23
|
||||
* Time: 17:58
|
||||
*/
|
||||
|
||||
namespace Blessing\Controller;
|
||||
|
||||
use SmallProgramApi\Controller\BaseController;
|
||||
use Blessing\Business\Index;
|
||||
use Blessing\Model\BlessingModel;
|
||||
use Common\Model\StoreConfigModel;
|
||||
|
||||
use Common\Model\ImageGalleryModel;
|
||||
|
||||
use Common\Validate\CustomValidate;
|
||||
use Common\Model\RetailBillOrderModel;//商品出售订单表
|
||||
|
||||
//小程序
|
||||
class AppletsController extends BaseController{
|
||||
|
||||
/**
|
||||
* 上传音视频: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
|
||||
*/
|
||||
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 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'] == '' || $post['address'] == ''){
|
||||
$res = callBack(statusCode()['error'],'参数不能为空');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
$storeId = self::$store_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'=>self::$merchant_id,
|
||||
'store_id'=>$storeId,
|
||||
'order_id'=>$post['orderId'],
|
||||
'user_id'=>self::$uid,
|
||||
'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);
|
||||
}
|
||||
|
||||
$retailBillOrderModel = new RetailBillOrderModel;
|
||||
$orderWhere = [
|
||||
'id'=>$post['orderId']
|
||||
];
|
||||
$orderFields = [
|
||||
'store_id'
|
||||
];
|
||||
//获取这条订单id
|
||||
$storeId = $retailBillOrderModel->getFindField($orderWhere,$orderFields);
|
||||
|
||||
//添加祝福语,判断门店是否有权限
|
||||
$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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 祝福语隐私声明
|
||||
*/
|
||||
public function privacyStatement(){
|
||||
$storeId = self::$store_id;
|
||||
|
||||
$storeConfigModel = new StoreConfigModel();
|
||||
$where = [
|
||||
'store_id'=>$storeId
|
||||
];
|
||||
|
||||
$field = [
|
||||
'entrance_img_id',
|
||||
'privacy_statement',
|
||||
];
|
||||
$data = $storeConfigModel->getFind($where,$field);//门店设置表信息
|
||||
|
||||
$identification = 'blessing';//插件名
|
||||
|
||||
$index = new Index();
|
||||
//添加祝福语,判断门店是否有权限,并开启权限
|
||||
$storePlug['store_id'] = $storeId;
|
||||
$storePlug['identification'] = $identification;
|
||||
//门店id
|
||||
$merchantIdBlessingPlug = $index->storePlugStatus($storePlug);
|
||||
if($merchantIdBlessingPlug['status'] != 1){
|
||||
//无权限
|
||||
$data['status'] = '2';
|
||||
}else{
|
||||
$data['status'] = '1';
|
||||
}
|
||||
|
||||
if($data === false){
|
||||
$res = callBack(statusCode()['error'],'失败');
|
||||
}else{
|
||||
if($data['entrance_img_id']){
|
||||
$ImageGalleryModel = new ImageGalleryModel();
|
||||
$data['entrance_style'] = $ImageGalleryModel->getImagePath($data['entrance_img_id']);//图片拼接路径
|
||||
if($data['entrance_style'] == ''){
|
||||
$entrance_style = getServerUrl();
|
||||
$data['entrance_style'] = $entrance_style.'/Public/plug/blessing/images/blessing_default.png';
|
||||
}
|
||||
}else{
|
||||
$entrance_style = getServerUrl();
|
||||
$data['entrance_style'] = $entrance_style.'/Public/plug/blessing/images/blessing_default.png';
|
||||
}
|
||||
|
||||
$res = callBack(statusCode()['success'],'成功',$data);
|
||||
}
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 祝福语
|
||||
* 小程序订单查询祝福语
|
||||
*/
|
||||
public function blessingInfo(){
|
||||
$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阿里云
|
||||
'address',//路径地址
|
||||
'validity_time',//1永久有效,有效期:时间戳
|
||||
'extraction_code',//祝福码
|
||||
'url',//路径
|
||||
];
|
||||
$plugBlessingModel = new BlessingModel();
|
||||
$data = $plugBlessingModel->getFind($where,$field);
|
||||
if(!$data){
|
||||
$res = callBack(statusCode()['error'],'订单没有祝福语');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
//判断祝福语是否过期
|
||||
$time = time();
|
||||
if($data['validity_time'] && $data['validity_time'] != 1 && $data['validity_time'] < $time){
|
||||
$res = callBack(statusCode()['error'],'祝福语已过期');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
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 blessingDelete(){
|
||||
$post = I("post.");
|
||||
$param = [
|
||||
'orderId',//订单id
|
||||
'extractionCode',//祝福码
|
||||
];
|
||||
$index = new Index();
|
||||
$customValidate = new CustomValidate();
|
||||
$dataOne = $customValidate->validationParameters($param,$post);
|
||||
if($dataOne !== true){
|
||||
$this->ajaxReturn($dataOne);
|
||||
}
|
||||
if($post['orderId'] == '' || $post['extractionCode'] == ''){
|
||||
$res = callBack(statusCode()['error'],'参数不能为空');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
$where = [
|
||||
'order_id'=>$post['orderId'],//订单id
|
||||
'extraction_code'=>$post['extractionCode'],//祝福码
|
||||
];
|
||||
$plugBlessingModel = new BlessingModel();
|
||||
$data = $plugBlessingModel->deleteOrder($where);
|
||||
if($data === false){
|
||||
$res = callBack(statusCode()['error'],'失败');
|
||||
}else{
|
||||
$res = callBack(statusCode()['success'],'成功');
|
||||
}
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Blessing\Controller;
|
||||
use Retail\Controller\BaseController;
|
||||
|
||||
class BlessingController extends BaseController {
|
||||
public function index()
|
||||
{
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: yang
|
||||
* Date: 2021/3/23
|
||||
* Time: 14:37
|
||||
*/
|
||||
|
||||
namespace Blessing\Controller;
|
||||
|
||||
use Retail\Controller\BaseController;
|
||||
use Blessing\Business\Index;
|
||||
use Blessing\Model\BlessingModel;
|
||||
use Common\Business\Plug;
|
||||
|
||||
use Common\Model\RetailStoreModel;
|
||||
use Common\Model\RetailPlugModel;
|
||||
use Common\Model\RetailPlugStoreModel;
|
||||
use Common\Model\RetailManagerModel;
|
||||
|
||||
use Common\Validate\CustomValidate;
|
||||
//商户后台
|
||||
class MerchantController extends BaseController{
|
||||
|
||||
//页面
|
||||
public function index(){
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商户下,门店插件列表(祝福语)
|
||||
*/
|
||||
//商户下门店插件状态(验证商户是否有插件权限)
|
||||
public function blessingPlugList(){
|
||||
$post = I("post.");
|
||||
$param = [
|
||||
'page',//当前页
|
||||
'limit',//页数量
|
||||
];
|
||||
$index = new Index();
|
||||
$customValidate = new CustomValidate();
|
||||
$dataOne = $customValidate->validationParameters($param,$post);
|
||||
if($dataOne !== true){
|
||||
$this->ajaxReturn($dataOne);
|
||||
}
|
||||
|
||||
$post['merchant_id'] = $this->merchant_id;//商户id
|
||||
$post['identification'] = 'blessing';//祝福语插件标识
|
||||
//商户id
|
||||
$merchant['merchant_id'] = $post['merchant_id'];
|
||||
$merchant['identification'] = $post['identification'];
|
||||
$merchantIdBlessingPlug = $index->merchantIdBlessingPlug($merchant);
|
||||
if($merchantIdBlessingPlug['status'] != 1){
|
||||
//无权限
|
||||
$this->ajaxReturn($merchantIdBlessingPlug);
|
||||
}
|
||||
//有权限,继续操作
|
||||
|
||||
$plug = new Plug();
|
||||
$data = $plug->plugStoreList($post);
|
||||
|
||||
$this->ajaxReturn($data);
|
||||
|
||||
}
|
||||
|
||||
//改变门店插件状态(验证商户是否有插件权限)
|
||||
public function plugStoreSave(){
|
||||
$post = I("post.");
|
||||
$param = [
|
||||
'store_id',//门店id
|
||||
'status',//插件权限状态 0未开启 1开启
|
||||
];
|
||||
$index = new Index();
|
||||
$customValidate = new CustomValidate();
|
||||
$dataOne = $customValidate->validationParameters($param,$post);
|
||||
if($dataOne !== true){
|
||||
$this->ajaxReturn($dataOne);
|
||||
}
|
||||
if($post['store_id'] == '' || $post['status'] == ''){
|
||||
$res = callBack(statusCode()['error'],'参数不能为空');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
$post['identification'] = 'blessing';//祝福语插件标识
|
||||
$post['merchant_id'] = $this->merchant_id;//商户id
|
||||
|
||||
$merchant['merchant_id'] = $post['merchant_id'];
|
||||
$merchant['identification'] = $post['identification'];
|
||||
//商户id
|
||||
$merchantIdBlessingPlug = $index->merchantIdBlessingPlug($merchant);
|
||||
if($merchantIdBlessingPlug['status'] != 1){
|
||||
//无权限
|
||||
$this->ajaxReturn($merchantIdBlessingPlug);
|
||||
}
|
||||
|
||||
//查询插件id,并判断插件是否存在
|
||||
$wherePlug = [
|
||||
'identification'=>$post['identification'],
|
||||
];
|
||||
$fieldPlug = [
|
||||
'id'
|
||||
];
|
||||
$plug = new RetailPlugModel();//插件表
|
||||
$plugId = $plug->getFind($wherePlug,$fieldPlug);//插件id
|
||||
if(!$plugId){
|
||||
$res = callBack(statusCode()['error'],'插件不存在');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
//查询插件在插件是否在插件门店表,并改变状态
|
||||
$wherePlugStore = [
|
||||
'storeid'=>$post['store_id'],//门店id
|
||||
'plug_id'=>$plugId['id'],//插件id
|
||||
];
|
||||
$fieldPlugStore = [
|
||||
'id'
|
||||
];
|
||||
$plugStore = new RetailPlugStoreModel();//插件表
|
||||
$isPlugStore = $plugStore->getFind($wherePlugStore,$fieldPlugStore);//查询插件是否在插件门店表
|
||||
if($isPlugStore){
|
||||
//存在
|
||||
$where = [
|
||||
'storeid'=>$post['store_id'],//门店id
|
||||
'plug_id'=>$plugId['id'],//插件id
|
||||
];
|
||||
$save = [
|
||||
's_status'=>$post['status'],//插件权限状态 0未开启 1开启
|
||||
'opentime'=>time(),//修改时间
|
||||
];
|
||||
$data = $plugStore->updateOrder($where,$save);
|
||||
|
||||
}else{
|
||||
//不存在
|
||||
$add = [
|
||||
'storeid'=>$post['store_id'],//门店id
|
||||
'plug_id'=>$plugId['id'],//插件id
|
||||
's_status'=>$post['status'],//插件权限状态 0未开启 1开启
|
||||
'addtime'=>time(),//添加时间
|
||||
];
|
||||
$data = $plugStore->addOrder($add);
|
||||
}
|
||||
if($data === false){
|
||||
$res = callBack(statusCode()['error'],'失败');
|
||||
}else{
|
||||
$res = callBack(statusCode()['success'],'成功');
|
||||
}
|
||||
$this->ajaxReturn($res);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,386 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: yang
|
||||
* Date: 2021/3/31
|
||||
* Time: 17:43
|
||||
*/
|
||||
|
||||
namespace Blessing\Controller;
|
||||
|
||||
use Retail\Controller\BaseController;
|
||||
|
||||
use Common\Model\StoreConfigModel;
|
||||
use Common\Model\RetailPlugStoreModel;
|
||||
use Common\Model\RetailPlugModel;
|
||||
use Blessing\Business\Index;
|
||||
use Blessing\Model\BlessingModel;
|
||||
use Common\Model\ImageGalleryModel;
|
||||
use Common\Validate\CustomValidate;
|
||||
|
||||
//门店后台
|
||||
class StoreController extends BaseController{
|
||||
//营销祝福语设置
|
||||
public function setting(){
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: yang
|
||||
* Date: 2021/3/30
|
||||
* Time: 15:10
|
||||
*/
|
||||
|
||||
namespace Blessing\Controller;
|
||||
|
||||
use Retail\Controller\BaseController;
|
||||
use Blessing\Business\Index;
|
||||
use Blessing\Model\BlessingModel;
|
||||
use Common\Business\Plug;
|
||||
|
||||
use Common\Model\RetailStoreModel;
|
||||
use Common\Model\RetailPlugModel;
|
||||
use Common\Model\RetailPlugStoreModel;
|
||||
use Common\Model\RetailManagerModel;
|
||||
use Think\Controller;
|
||||
use Common\Validate\CustomValidate;
|
||||
|
||||
//游客
|
||||
class TouristController extends Controller{
|
||||
|
||||
//页面
|
||||
public function index(){
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* 祝福语
|
||||
*/
|
||||
//查询祝福语(post)
|
||||
public function blessingList(){
|
||||
$post = I("post.");
|
||||
$param = [
|
||||
'storeId',//门店id
|
||||
'extractionCode',//提取码
|
||||
];
|
||||
$index = new Index();
|
||||
$customValidate = new CustomValidate();
|
||||
$dataOne = $customValidate->validationParameters($param,$post);
|
||||
if($dataOne !== true){
|
||||
$this->ajaxReturn($dataOne);
|
||||
}
|
||||
if($post['extractionCode'] == '' || $post['storeId'] == ''){
|
||||
$res = callBack(statusCode()['error'],'请输入祝福码');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
$where = [
|
||||
'store_id'=>$post['storeId'],//门店id
|
||||
'extraction_code'=>$post['extractionCode'],//提取码
|
||||
];
|
||||
$field = [
|
||||
'type',//类型:1视频,2音频
|
||||
'storage_type',//存储类型:1本地,2七牛云,3腾讯云,4阿里云
|
||||
'address',//路径地址
|
||||
'validity_time',//1永久有效,有效期:时间戳
|
||||
'url',//路径
|
||||
];
|
||||
$plugBlessingModel = new BlessingModel();
|
||||
$data = $plugBlessingModel->getFind($where,$field);
|
||||
if(!$data){
|
||||
$res = callBack(statusCode()['error'],'祝福码错误');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
//判断祝福语是否过期
|
||||
$time = time();
|
||||
if($data['validity_time'] && $data['validity_time'] != 1 && $data['validity_time'] < $time){
|
||||
$res = callBack(statusCode()['error'],'祝福语已过期');
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
if($data === false){
|
||||
$res = callBack(statusCode()['error'],'失败');
|
||||
}else{
|
||||
if($data && $data['storage_type'] == 1){
|
||||
$entrance_style = getServerUrl();
|
||||
$data['address'] = $entrance_style.'/'.$data['url'];
|
||||
}
|
||||
//合伙人设置
|
||||
$identification = 'blessing';//插件标识
|
||||
$limitSize = $index->plugSetInfo($identification);
|
||||
$data['duration_type'] = $limitSize['duration_type'];//1永久时长 2固定时长
|
||||
$data['duration_time'] = $limitSize['duration_time'];//固定的时长
|
||||
$data['duration_start_type'] = $limitSize['duration_start_type'];//开始计时的时候 1确认收货后 2首次扫码后
|
||||
if(!$data['validity_time']){
|
||||
//没有有效期,第一次,修改有效期
|
||||
$validity_time = $index->validityTimeSave($post['storeId'],1,$post['extractionCode']);//修改有效期:$type == 1:首次扫码(id = 门店id),2:确认订单(id = 订单id)
|
||||
if($validity_time !== false){
|
||||
$data['validity_time'] = $validity_time;
|
||||
}
|
||||
}
|
||||
$res = callBack(statusCode()['success'],'成功',$data);
|
||||
}
|
||||
$this->ajaxReturn($res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户