作者 王晓刚
1 个管道 的构建 通过 耗费 7 秒

合并分支 'wxg' 到 'master'

Wxg



查看合并请求 !89
... ... @@ -224,3 +224,31 @@ EOT;
return $icon;
}
}
if (!function_exists('generateCode')) {
/**
* 生成n位随机数
* @param int $length
* @return int
*/
function generateCode($length = 6)
{
$min = pow(10, ($length - 1));
$max = pow(10, $length) - 1;
return rand($min, $max);
}
}
if(!function_exists('send_sms2')) {
function send_sms2($data){
//todo 短信账号密码
require_once EXTEND_PATH . 'nsms/nsms2.php';
$url = "https://api.mix2.zthysms.com/v2/sendSms";
$username = 'gongpinda';
$password = 'Cxz307312';
$sendAPI = new \sendAPI($url, $username, $password);
$sendAPI->data = $data;/*初始化数据包*/
$return = $sendAPI->sendSMS('POST');
return $return;
}
}
... ...
... ... @@ -145,11 +145,11 @@ class Index extends Backend
$this->error($validate->getError(), $url, ['token' => $this->request->token()]);
}
//根据mobile获取商户信息
$admin = Db::name('admin')->where(['mobile'=>$mobile])->find();
$admin = Db::name('admin')->where(['phone'=>$mobile])->find();
if(empty($admin)){
$this->error('当前手机号尚未绑定');
}
if(empty($admin['user_id'])){
if(empty($admin['store_id'])){
$this->error('平台管理员忘记密码请联系总管理员');
}
if($admin['status'] != 'normal'){
... ... @@ -259,7 +259,7 @@ class Index extends Backend
$str = "Bronet";
$auth_code = config('auth_code');
$token = rawurlencode(sha1(md5($str.$auth_code).md5($mobile)));
$this->success('验证通过',url('reset_password',['token'=>$token,'email'=>$mobile],false,true));
$this->success('验证通过',url('reset_password',['token'=>$token,'mobile'=>$mobile],false,true));
}
}
... ... @@ -302,9 +302,10 @@ class Index extends Backend
if($token != $token2){
$this->error('令牌错误','','','');
}
$admin = Db::name('admin')->where(['email'=>$mobile])->find();
$admin = Db::name('admin')->where(['phone'=>$mobile])->find();
$pwd = $password;
$password = md5(md5($password) . $admin['salt']);
$result = Db::name('admin')->where(['id'=>$admin['id']])->update(['password'=>$password]);
$result = Db::name('admin')->where(['id'=>$admin['id']])->update(['password'=>$password,'pwd'=>$pwd]);
if(empty($result)){
$this->error('sql执行失败');
}
... ...
... ... @@ -296,7 +296,7 @@
店铺名称
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="shopName" placeholder="请填写店铺名称">
<input type="text" class="form-control" id="shopName" placeholder="请填写店铺名称" onblur="testUserName()">
<span id="shopNameTips" class="tipsInfo"></span>
</div>
</div>
... ... @@ -306,7 +306,7 @@
公司名称
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="companyName" placeholder="请填写公司名称">
<input type="text" class="form-control" id="companyName" placeholder="请填写公司名称" onblur="testComName()">
<span id="companyNameTips" class="tipsInfo"></span>
</div>
</div>
... ... @@ -340,7 +340,7 @@
经营详细地址
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="address" placeholder="请填写经营详细地址" autocomplete="off">
<input type="text" class="form-control" id="address" placeholder="请填写经营详细地址" autocomplete="off" onblur="testAddress()">
<span id="shopAddressTips" class="tipsInfo"></span>
</div>
<ul class="search_keyword">
... ... @@ -390,7 +390,7 @@
企业联系人
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="companyContacts" placeholder="请填写企业联系人">
<input type="text" class="form-control" id="companyContacts" placeholder="请填写企业联系人" onblur="testCompanyContacts()">
<span id="companyContactsTips" class="tipsInfo"></span>
</div>
</div>
... ... @@ -401,7 +401,7 @@
联系电话
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="phoneNum" placeholder="请填写联系电话">
<input type="text" class="form-control" id="phoneNum" placeholder="请填写联系电话" onblur="testPhoneNum()">
<span id="phoneNumTips" class="tipsInfo"></span>
</div>
</div>
... ... @@ -436,7 +436,7 @@
<div class="form-group agreementBox">
<div class="col-sm-12">
<img id="radio" src="__CDN__/assets/store/images/radioUnSelect.png" alt="radio" onclick="changeRadioState()">
<p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a></p>
<p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a><span id="checkboxTips" style="position: inherit;" class="tipsInfo"></span></p>
</div>
</div>
... ... @@ -710,6 +710,72 @@
var radioFlag = false;//同意入驻协议标识
var idCardImgFileArr = [];
//校验店铺名称
function testUserName() {
var contactsName = $('#shopName').val();
if(contactsName.trim() == ''){
$('#shopNameTips').html('请填写店铺名称');
return false;
}
$('#shopNameTips').html('');
return true;
}
//校验公司名称
function testComName() {
var contactsName = $('#companyName').val();
if(contactsName.trim() == ''){
$('#companyNameTips').html('请填写公司名称');
return false;
}
$('#companyNameTips').html('');
return true;
}
//校验三证合一照片
function testIDCardPhoto() {
if(idCardImgFileArr.length == 0){
$('#licensePhotoTips').html('请上传三证合一照片');
return false;
}
$('#licensePhotoTips').html('');
return true;
}
//校验经营详细地址
function testAddress() {
var address = $('#address').val();
if(address.trim() == ''){
$('#shopAddressTips').html('请填写经营详细地址');
return false;
}
$('#shopAddressTips').html('');
return true;
}
//校验企业联系人姓名
function testCompanyContacts() {
var contactsName = $('#companyContacts').val();
if(contactsName.trim() == ''){
$('#companyContactsTips').html('请填写企业联系人');
return false;
}
$('#companyContactsTips').html('');
return true;
}
//校验手机号
function testPhoneNum() {
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var phoneNum = $('#phoneNum').val();
if(!reg.test(phoneNum)){
$('#phoneNumTips').html('请填写正确的联系电话');
return false;
}
$('#phoneNumTips').html('');
return true;
}
//校验三证合一照片
function testIDCardPhoto() {
if(idCardImgFileArr.length == 0){
... ... @@ -720,6 +786,14 @@
return true;
}
function testRadioFlag(){
if(radioFlag == false){
$('#checkboxTips').html('请确认用户协议');
return false;
}
$('#checkboxTips').html('');
}
//供应商入驻协议
function supplierAgreement() {
$('#agreementModal').modal();
... ... @@ -727,6 +801,12 @@
//申请入驻
function applySettledIn() {
testUserName();
testComName();
testAddress();
testCompanyContacts();
testPhoneNum();
testRadioFlag();
var idCardBox_length = $('#idCardBox').parent().prev().find('.imagesItem').length;
console.log(idCardBox_length);
var name = $('#shopName').val();//店铺名称
... ...
... ... @@ -352,7 +352,7 @@
联系人姓名
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="contactsName" placeholder="请输入联系人姓名">
<input type="text" class="form-control" id="contactsName" placeholder="请输入联系人姓名" onblur="testUserName()">
<span id="contactsNameTips" class="tipsInfo"></span>
</div>
</div>
... ... @@ -362,7 +362,7 @@
身份证号
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="idCardNum" placeholder="请输入身份证号">
<input type="text" class="form-control" id="idCardNum" placeholder="请输入身份证号" onblur="testIDCardNum()">
<span id="idCardNumTips" class="tipsInfo"></span>
</div>
</div>
... ... @@ -392,7 +392,7 @@
联系人电话
</label>
<div class="col-sm-11">
<input type="text" class="form-control" id="phoneNum" placeholder="请输入联系人电话">
<input type="text" class="form-control" id="phoneNum" placeholder="请输入联系人电话" onblur="testPhoneNum()">
<span id="phoneNumTips" class="tipsInfo"></span>
</div>
</div>
... ... @@ -416,7 +416,7 @@
联系人地址
</label>
<div class="col-sm-11" style="position: relative">
<input type="text" class="form-control" id="address" placeholder="请输入联系人地址" autocomplete="off">
<input type="text" class="form-control" id="address" placeholder="请输入联系人地址" autocomplete="off" onblur="testAddress()">
<span id="addressTips" class="tipsInfo"></span>
</div>
<ul class="search_keyword">
... ... @@ -475,7 +475,8 @@
<div class="col-sm-12">
<img id="radio" src="__CDN__/assets/store/images/radioUnSelect.png" alt="radio"
onclick="changeRadioState()">
<p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a></p>
<p>我已阅读并同意<a href="javascript:void(0)" onclick="supplierAgreement()">《供应商入驻协议》</a><span id="checkboxTips" style="position: inherit;" class="tipsInfo"></span></p>
</div>
</div>
... ... @@ -514,6 +515,61 @@
var idCardImgFileArr = [];
var handIDCardImgFileArr = [];
//校验用户名
function testUserName() {
var contactsName = $('#contactsName').val();
if(contactsName.trim() == ''){
$('#contactsNameTips').html('请输入联系人姓名');
return false;
}
$('#contactsNameTips').html('');
return true;
}
//校验身份证号
function testIDCardNum() {
// 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X
var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
var IDCardNum = $('#idCardNum').val();
if(!reg.test(IDCardNum)){
$('#idCardNumTips').html('请输入正确的身份证号');
return false;
}
$('#idCardNumTips').html('');
return true;
}
//校验手机号
function testPhoneNum() {
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var phoneNum = $('#phoneNum').val();
if(!reg.test(phoneNum)){
$('#phoneNumTips').html('请输入正确的联系人电话');
return false;
}
$('#phoneNumTips').html('');
return true;
}
//校验地址
function testAddress() {
var address = $('#address').val();
if(address.trim() == ''){
$('#addressTips').html('请输入联系人地址');
return false;
}
$('#addressTips').html('');
return true;
}
function testRadioFlag(){
if(radioFlag == false){
$('#checkboxTips').html('请确认用户协议');
return false;
}
$('#checkboxTips').html('');
}
//供应商入驻协议
function supplierAgreement() {
$('#agreementModal').modal();
... ... @@ -521,6 +577,11 @@
//申请入驻
function applySettledIn() {
testUserName();
testIDCardNum();
testPhoneNum();
testAddress();
testRadioFlag();
var idCardBox_length = $('#idCardBox').parent().prev().find('.imagesItem').length;
console.log(idCardBox_length);
var handIDCardPhotoBox_length = $('#handIDCardPhotoBox').parent().prev().find('.imagesItem').length;
... ...
... ... @@ -144,18 +144,18 @@
<div class="formBox formBox">
<form>
<div class="form-group">
<input type="text" class="form-control" id="phoneNum" placeholder="手机号">
<input type="text" class="form-control" id="phoneNum" placeholder="手机号" onblur="testPhoneNum()">
<span id="phoneNumTips" class="tipsInfo"></span>
</div>
<div class="form-group">
<input type="text" class="form-control" id="verificationCode" placeholder="请输入图形验证码">
<input type="text" class="form-control" id="verificationCode" placeholder="请输入图形验证码" onblur="testImgCode()">
<span id="imgCodeTips" class="tipsInfo"></span>
<img src="{:captcha_src()}" alt="captcha" id="codeImg" onclick="this.src='{:captcha_src()}'">
</div>
<div class="form-group">
<input type="text" class="form-control" id="msgCode" placeholder="请输入短信验证码">
<input type="text" class="form-control" id="msgCode" placeholder="请输入短信验证码" onblur="testCode()">
<span id="msgCodeTips" class="tipsInfo"></span>
<span class="input-group-btn">
<span class="input-group-btn">
... ... @@ -176,11 +176,11 @@
<div class="formBox">
<form>
<div class="form-group">
<input type="password" class="form-control" id="newPsw" placeholder="请输入新密码">
<input type="password" class="form-control" id="newPsw" placeholder="请输入新密码" onblur="testNewPsw()">
<span id="newPswTips" class="tipsInfo"></span>
</div>
<div class="form-group">
<input type="password" class="form-control" id="repeatNewPsw" placeholder="重复新密码">
<input type="password" class="form-control" id="repeatNewPsw" placeholder="重复新密码" onblur="testRepeatNewPsw()">
<span id="repeatNewPswTips" class="tipsInfo"></span>
</div>
<button type="button" class="btn btn-submit" onclick="confirm()">确认</button>
... ... @@ -193,8 +193,42 @@
{include file="public/js"/}
<script>
var interval;
//校验手机号
function testPhoneNum() {
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var phoneNum = $('#phoneNum').val();
if(!reg.test(phoneNum)){
$('#phoneNumTips').html('请输入正确的手机号码');
return false;
}
$('#phoneNumTips').html('');
return true;
}
//校验图形验证码
function testImgCode() {
if($('#verificationCode').val().trim() == ''){
$('#imgCodeTips').html('请输入图形验证码');
return false;
}
$('#imgCodeTips').html('');
return true;
}
//校验短信验证码
function testCode() {
if($('#msgCode').val().trim() == ''){
$('#msgCodeTips').html('请输入短信验证码');
return false;
}
$('#msgCodeTips').html('');
return true;
}
//发送短信验证码
function sendMsg() {
testPhoneNum();
testImgCode();
var mobile = $('#phoneNum').val();
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var verificationCode = $('#verificationCode').val();
... ... @@ -240,6 +274,8 @@
//下一步
function next() {
testPhoneNum();
testCode();
var mobile = $('#phoneNum').val();
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var code = $('#msgCode').val();
... ... @@ -271,8 +307,41 @@
}
});
}
//校验新密码
function testNewPsw() {
var psw_test = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/;
var psw = $('#newPsw').val();
if(psw.trim() == ''){
$('#newPswTips').html('请输入新密码');
return false;
}else if(!psw_test.test(psw)){
$('#newPswTips').html('至少8个字符,包括1个大写字母,1个小写字母和1个数字');
return false;
}
$('#newPswTips').html('');
return true;
}
//校验重复新密码
function testRepeatNewPsw() {
if($('#repeatNewPsw').val().trim() == ''){
$('#repeatNewPswTips').html('请重复输入新密码');
return false;
}
if($('#newPsw').val() != $('#repeatNewPsw').val()){
$('#repeatNewPswTips').html('两次密码不一致');
return false;
}
$('#repeatNewPswTips').html('');
return true;
}
//确认修改新密码
function confirm() {
testPhoneNum();
testCode();
testNewPsw();
testRepeatNewPsw();
var mobile = $('#phoneNum').val();
var newPsw = $('#newPsw').val();
var repeatNewPsw = $('#repeatNewPsw').val();
... ...
... ... @@ -197,11 +197,11 @@
<div class="formBox msgFormBox">
<form>
<div class="form-group">
<input type="text" class="form-control" id="phoneNum" placeholder="手机号">
<input type="text" class="form-control" id="phoneNum" placeholder="手机号" onblur="testPhoneNum()">
<span id="phoneNumTips1" class="tipsInfo"></span>
</div>
<div class="form-group">
<input type="text" class="form-control" id="verificationCode" placeholder="请输入短信验证码">
<input type="text" class="form-control" id="verificationCode" placeholder="请输入短信验证码" onblur="testCode()">
<span id="codeTips" class="tipsInfo"></span>
<span class="input-group-btn">
<button class="btn" type="button" onclick="sendMsg()">
... ... @@ -218,12 +218,12 @@
<form>
<div class="form-group">
<img src="__CDN__/assets/store/images/loginUser.png" alt="loginUser">
<input type="text" class="form-control" id="phoneNum2" placeholder="手机号">
<input type="text" class="form-control" id="phoneNum2" placeholder="手机号" onblur="pswTestPhoneNum()">
<span id="phoneNumTips2" class="tipsInfo"></span>
</div>
<div class="form-group">
<img src="__CDN__/assets/store/images/lock.png" alt="loginUser">
<input type="password" class="form-control" id="psw" placeholder="密码">
<input type="password" class="form-control" id="psw" placeholder="密码" onblur="pswTest()">
<span id="pswTips" class="tipsInfo"></span>
</div>
<button type="button" class="btn btn-submit" onclick="loginByPsw()">登录</button>
... ... @@ -238,8 +238,32 @@
{include file="public/js"/}
<script>
var interval;
//验证码登录校验手机号
function testPhoneNum() {
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var phoneNum = $('#phoneNum').val();
if(!reg.test(phoneNum)){
$('#phoneNumTips1').html('请输入正确的手机号码');
return false;
}
$('#phoneNumTips1').html('');
return true;
}
//校验验证码
function testCode() {
var code = $('#verificationCode').val();
if(code.trim() == ''){
$('#codeTips').html('请输入验证码');
return false;
}
$('#codeTips').html('');
return true;
}
//发送短信验证码
function sendMsg() {
testPhoneNum();
var mobile = $('#phoneNum').val();
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
if(mobile == ''){
... ... @@ -279,6 +303,8 @@
//短信验证码登录
function loginByCode() {
testPhoneNum();
testCode();
var mobile = $('#phoneNum').val();
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var code = $('#verificationCode').val();
... ... @@ -326,8 +352,32 @@
$('#phoneNumTips1,#phoneNumTips2').html('');
}
//密码登录校验手机号
function pswTestPhoneNum() {
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var phoneNum = $('#phoneNum2').val();
if(!reg.test(phoneNum)){
$('#phoneNumTips2').html('请输入正确的手机号码');
return false;
}
return true;
$('#phoneNumTips2').html('');
}
//密码登录校验密码
function pswTest() {
if($('#psw').val() == ''){
$('#pswTips').html('请输入密码');
return false;
}
$('#pswTips').html('');
return true;
}
//密码登录
function loginByPsw() {
pswTestPhoneNum();
pswTest();
var mobile = $('#phoneNum2').val();
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var password = $('#psw').val();
... ...
... ... @@ -165,17 +165,17 @@
<div class="formBox">
<form>
<div class="form-group">
<input type="text" class="form-control" id="userName" placeholder="请设置用户名">
<input type="text" class="form-control" id="userName" placeholder="请设置用户名" onblur="testUserName()">
<span id="userNameTips" class="tipsInfo"></span>
</div>
<div class="form-group">
<input type="text" class="form-control" id="phoneNum" placeholder="请输入手机号">
<input type="text" class="form-control" id="phoneNum" placeholder="请输入手机号" onblur="testPhoneNum()">
<span id="phoneNumTips" class="tipsInfo"></span>
</div>
<div class="form-group">
<input type="text" class="form-control" id="verificationCode" placeholder="请输入验证码">
<input type="text" class="form-control" id="verificationCode" placeholder="请输入验证码" onblur="testVerificationCode()">
<span id="verificationCodeTips" class="tipsInfo"></span>
<span class="input-group-btn">
<button class="btn" type="button" onclick="sendMsg()">
... ... @@ -185,7 +185,7 @@
</div>
<div class="form-group">
<input type="password" class="form-control" id="psw" placeholder="请设置登录密码">
<input type="password" class="form-control" id="psw" placeholder="请设置登录密码" onblur="testPassword()">
<span id="pswTips" class="tipsInfo"></span>
</div>
... ... @@ -249,10 +249,58 @@
$("#checkbox").change(function() {
testCheckbox();
});
})
});
//校验用户名
function testUserName() {
if($('#userName').val().trim() == ''){
$('#userNameTips').html('请输入用户名');
return false;
}
$('#userNameTips').html('');
return true;
}
//校验手机号
function testPhoneNum() {
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
var phoneNum = $('#phoneNum').val();
if(!reg.test(phoneNum)){
$('#phoneNumTips').html('请输入正确的手机号码');
return false;
}
$('#phoneNumTips').html('');
return true;
}
//校验验证码
function testVerificationCode(){
if($('#verificationCode').val().trim() == ''){
$('#verificationCodeTips').html('请输入验证码');
return false;
}
$('#verificationCodeTips').html('');
return true;
}
//校验密码
function testPassword(){
var psw_test = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/;
var psw = $('#psw').val();
if(psw.trim() == ''){
$('#pswTips').html('请输入密码');
return false;
}else if(!psw_test.test(psw)){
$('#pswTips').html('至少8个字符,包括1个大写字母,1个小写字母和1个数字');
return false;
}
$('#pswTips').html('');
return true;
}
//发送验证码
function sendMsg() {
testPhoneNum();
var mobile = $('#phoneNum').val();
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
if(mobile == ''){
... ... @@ -303,6 +351,11 @@
//调用注册接口
function register() {
testUserName();
testPhoneNum();
testVerificationCode();
testPassword();
testCheckbox();
var username = $('#userName').val();
var mobile = $('#phoneNum').val();
var reg = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
... ...
... ... @@ -433,7 +433,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
$.ajax({
url:"index/forget",
type:"POST",
data:{'email':email},
data:{'mobile':mobile},
success:function(res){
console.log(res);
if(res.code == 1){
... ...