文件
mashangyoujiu/Application/Retail/Controller/MerInterfaceController.class.php

107 行
2.9 KiB
PHP
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?php
/**
* Created by PhpStorm.
* User: yang
* Date: 2021/4/14
* Time: 16:38
*/
namespace Retail\Controller;
use Common\Business\StoreConfig;//公共类
use Common\Model\AppInfoModel;//商户小程序配置(授权)表
use Common\Model\StoreConfigModel;//门店基本设置表
use Common\Model\WxconfigModel;//商户公众号信息配置表
use Common\Validate\CustomValidate;
//[1.8.68]
/**
* 商户清空公众号/小程序授权
* Class MerInterfaceController
* @package Retail\Controller
*/
class MerInterfaceController extends BaseController
{
/**
* 商户后台删除公众号授权记录(清空appid)
*/
public function WxConfigSave()
{
$merchantId = $this->merchant_id;//商户id
if (!$merchantId) {
$res = callBack(statusCode()['error'], '失败');
$this->ajaxReturn($res);
}
$wxconfigModel = new WxconfigModel();
$where = [
'merchantid' => $merchantId,
];
$save = [
'appid' => null,
'authorizer_appid' => null,
'type' => 0,
];
$data = $wxconfigModel->updateOrder($where, $save);
if ($data === false) {
$res = callBack(statusCode()['error'], '失败');
} else {
$res = callBack(statusCode()['success'], '成功');
}
$this->ajaxReturn($res);
}
/**
* 门店后台改变小程序商城配送方式优先级
*/
//获取配送设置
public function storeConfigInfo()
{
$storeId = $this->store_id;//门店id
$storeConfigModel = new StoreConfigModel();
$where = [
'store_id' => $storeId
];
$field = [
'distribution_json'
];
$data = $storeConfigModel->getOrderFind($where, $field);
if ($data === false) {
$res = callBack(statusCode()['error'], '失败');
} else {
$res = callBack(statusCode()['success'], '成功', $data);
}
$this->ajaxReturn($res);
}
//修改配送优先级
public function storeConfigSave()
{
$storeId = $this->store_id;//门店id
$post = I('post.');
$param = [
'distributionJson'
];
//参数验证
$plugVip = new CustomValidate();
$dataOne = $plugVip->validationParameters($param, $post);
if ($dataOne !== true) {
$this->ajaxReturn($dataOne);
}
//修改配送排序
$storeConfig = new StoreConfig();
$save = [
'distribution_json' => $post['distributionJson'],
];
$data = $storeConfig->storeConfigSave($storeId, $save);
if ($data === false) {
$res = callBack(statusCode()['error'], '失败');
} else {
$res = callBack(statusCode()['success'], '成功');
}
$this->ajaxReturn($res);
}
}