96 行
2.7 KiB
PHP
可执行文件
96 行
2.7 KiB
PHP
可执行文件
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: yang
|
|
* Date: 2021/4/14
|
|
* Time: 18:17
|
|
*/
|
|
|
|
namespace SmallProgramApi\Controller;
|
|
|
|
use Common\Model\RetailVipModel;//商户会员表
|
|
use Common\Model\StoreConfigModel;//门店基本设置表
|
|
use Common\Validate\CustomValidate;
|
|
//[1.8.20]
|
|
|
|
/**
|
|
* Class MerInterfaceController
|
|
* @package SmallProgramApi\Controller
|
|
*/
|
|
class MerInterfaceController extends BaseController{
|
|
/**
|
|
* 门店后台改变小程序商城配送方式优先级
|
|
*/
|
|
//获取配送设置
|
|
public function storeConfigInfo(){
|
|
$storeId = self::$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 passwordSave(){
|
|
$post = I('post.');
|
|
$param = [
|
|
'id',
|
|
'password',
|
|
];
|
|
//参数验证
|
|
$plugVip = new CustomValidate();
|
|
$dataOne = $plugVip->validationParameters($param,$post);
|
|
if($dataOne !== true){
|
|
$this->ajaxReturn($dataOne);
|
|
}
|
|
$id = $post['id'];
|
|
$pas = $post['password'];
|
|
if($pas == '' || $id == ''){
|
|
$res = callBack(statusCode()['error'],'请输入密码');
|
|
$this->ajaxReturn($res);
|
|
}
|
|
if (!preg_match('/^[0-9]{6}$/', $pas)) {
|
|
$res = callBack(statusCode()['error'],'密码只支持6位数字');
|
|
$this->ajaxReturn($res);
|
|
}
|
|
//获取密码生成信息
|
|
$vipModel = new RetailVipModel();
|
|
$map = [
|
|
'id'=>$id
|
|
];
|
|
$vipInfo = $vipModel->getFind($map);
|
|
//验证参数结果
|
|
if (empty($vipInfo) || empty($vipInfo['mobile_phone'])) {
|
|
$res = callBack(statusCode()['error'],'您的请求有误');
|
|
$this->ajaxReturn($res);
|
|
}
|
|
//生成加密密码
|
|
$password = createPassword($pas, $vipInfo['addtime']);
|
|
$where = [
|
|
'id'=>$id
|
|
];
|
|
$save = [
|
|
'password'=>$password
|
|
];
|
|
$data = $vipModel->updateOrder($where,$save);
|
|
if($data === false){
|
|
$res = callBack(statusCode()['error'],'失败');
|
|
}else{
|
|
$res = callBack(statusCode()['success'],'成功');
|
|
}
|
|
$this->ajaxReturn($res);
|
|
}
|
|
|
|
} |