master
wangning 6 years ago
parent c56773120d
commit f502ac2f80

@ -533,4 +533,7 @@ CREATE TABLE `sys_client_pre_apply` (
`company_phone` varchar(20) DEFAULT NULL,
PRIMARY KEY (`client_pre_apply_id`),
UNIQUE KEY `username` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
alter table sys_accounts add COLUMN nation_code VARCHAR(5) DEFAULT NULL ;

@ -29,5 +29,5 @@ public interface SimpleClientApplyService {
JSONObject getBankInfo(String bsb_no);
void checkAccountName(String acocunt_name);
void checkAccountName(String contact_phone,String nation_code);
}

@ -217,8 +217,12 @@ public class SimpleClientApplyServiceImpl implements SimpleClientApplyService {
}
@Override
public void checkAccountName(String account_name) {
JSONObject account = clientAccountMapper.findByUsernameForDuplicate(account_name);
public void checkAccountName(String contact_phone,String nation_code) {
nation_code = nation_code.trim();
if(!nation_code.startsWith("+")){
nation_code ="+"+nation_code;
}
JSONObject account = clientAccountMapper.findByPhone(contact_phone,nation_code);
if (account != null){
throw new ForbiddenException("用户名已被注册");
}

@ -29,9 +29,9 @@ public class SimpleClientApplyController {
@Resource
private SimpleClientApplyService simpleClientApplyService;
@RequestMapping(value = "/account/{account_name}/check", method = RequestMethod.GET)
public void checkAccountName(@PathVariable String account_name) {
simpleClientApplyService.checkAccountName(account_name);
@RequestMapping(value = "/account/check", method = RequestMethod.GET)
public void checkAccountName(@RequestParam String nation_code,@RequestParam String phone) {
simpleClientApplyService.checkAccountName(phone,nation_code);
}
@RequestMapping(value = "/account/{codeKey}", method = RequestMethod.POST)

@ -26,6 +26,10 @@ public interface ClientAccountMapper {
@AutoSql(type = SqlType.SELECT)
JSONObject findByUsernameForDuplicate(@Param("username") String username);
@AutoSql(type = SqlType.SELECT)
@AdvanceSelect(addonWhereClause = "is_valid=1")
JSONObject findByPhone(@Param("contact_phone") String contact_phone,@Param("nation_code")String nation_code);
@AutoSql(type = SqlType.SELECT)
JSONObject findDetail(@Param("account_id") String accountId);

@ -265,7 +265,7 @@
<div class="row">
<div class="form-group col-xs-12"
ng-class="{'has-error':accountForm.contact_phone.$invalid && accountForm.contact_phone.$dirty}">
ng-class="{'has-error':accountForm.contact_phone.$invalid && accountForm.contact_phone.$dirty || name_exist}">
<div class="input-group">
<span class="input-group-addon">+61</span>
<input type="text" name="contact_phone" required ng-model="partner.contact_phone"

@ -58,7 +58,7 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.seconds = 6;
$scope.canClick=false;
$scope.description = "Send Code";
$scope.partner = {};
$scope.partner = {nation_code:"+61"};
$scope.bankaccount = {};
$scope.rate = {};
@ -70,9 +70,9 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.loadRoyalpayindustry();
$scope.checkUserName = function (username) {
if(username != null && username != ''){
$http.get('/register/account/' + $scope.partner.username+'/check').then(function (resp) {
$scope.checkUserName = function (phone,nation_code) {
if(phone && nation_code){
$http.get('/register/account/check?phone='+phone+'&nation_code='+nation_code).then(function (resp) {
$scope.name_exist = false;
}, function (resp) {
if (resp.data.status == 403){
@ -83,11 +83,13 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
};
$scope.chooseArray = new Array(true, false, false, false, false);
$scope.changeChoose = function (index) {
angular.forEach($scope.partner, function(key, value) {
if(value.trim()==''){
$scope.partner.remove(key);
$scope.repartner = {};
angular.forEach($scope.partner, function(value, key) {
if((value+'').trim()!=''){
$scope.repartner[key] = value;
}
});
$scope.partner = $scope.repartner;
$scope.chooseArray = new Array(false, false, false, false, false);
$scope.chooseArray[index] = true;
};
@ -134,8 +136,9 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
}
};
$scope.sendVerificationCode = function () {
$scope.checkUserName($scope.partner.contact_phone,$scope.partner.nation_code)
$scope.sendPhoneCodeTime();
$http.post('/register/info/phone/'+ $scope.partner.contact_phone +'/verify?'+'nation_code=61').then(function (resp) {
$http.post('/register/info/phone/'+ $scope.partner.contact_phone +'/verify?nation_code='+$scope.partner.nation_code).then(function (resp) {
}, function (resp) {
$scope.resError = resp.data.message;
});

Loading…
Cancel
Save