init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户