107 行
2.9 KiB
PHP
可执行文件
107 行
2.9 KiB
PHP
可执行文件
<?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);
|
||
}
|
||
|
||
}
|