master
wangning 7 years ago
parent c56773120d
commit f502ac2f80

@ -533,4 +533,7 @@ CREATE TABLE `sys_client_pre_apply` (
`company_phone` varchar(20) DEFAULT NULL, `company_phone` varchar(20) DEFAULT NULL,
PRIMARY KEY (`client_pre_apply_id`), PRIMARY KEY (`client_pre_apply_id`),
UNIQUE KEY `username` (`username`) USING BTREE 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); 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 @Override
public void checkAccountName(String account_name) { public void checkAccountName(String contact_phone,String nation_code) {
JSONObject account = clientAccountMapper.findByUsernameForDuplicate(account_name); nation_code = nation_code.trim();
if(!nation_code.startsWith("+")){
nation_code ="+"+nation_code;
}
JSONObject account = clientAccountMapper.findByPhone(contact_phone,nation_code);
if (account != null){ if (account != null){
throw new ForbiddenException("用户名已被注册"); throw new ForbiddenException("用户名已被注册");
} }

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

@ -26,6 +26,10 @@ public interface ClientAccountMapper {
@AutoSql(type = SqlType.SELECT) @AutoSql(type = SqlType.SELECT)
JSONObject findByUsernameForDuplicate(@Param("username") String username); 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) @AutoSql(type = SqlType.SELECT)
JSONObject findDetail(@Param("account_id") String accountId); JSONObject findDetail(@Param("account_id") String accountId);

@ -265,7 +265,7 @@
<div class="row"> <div class="row">
<div class="form-group col-xs-12" <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"> <div class="input-group">
<span class="input-group-addon">+61</span> <span class="input-group-addon">+61</span>
<input type="text" name="contact_phone" required ng-model="partner.contact_phone" <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.seconds = 6;
$scope.canClick=false; $scope.canClick=false;
$scope.description = "Send Code"; $scope.description = "Send Code";
$scope.partner = {}; $scope.partner = {nation_code:"+61"};
$scope.bankaccount = {}; $scope.bankaccount = {};
$scope.rate = {}; $scope.rate = {};
@ -70,9 +70,9 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
$scope.loadRoyalpayindustry(); $scope.loadRoyalpayindustry();
$scope.checkUserName = function (username) { $scope.checkUserName = function (phone,nation_code) {
if(username != null && username != ''){ if(phone && nation_code){
$http.get('/register/account/' + $scope.partner.username+'/check').then(function (resp) { $http.get('/register/account/check?phone='+phone+'&nation_code='+nation_code).then(function (resp) {
$scope.name_exist = false; $scope.name_exist = false;
}, function (resp) { }, function (resp) {
if (resp.data.status == 403){ 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.chooseArray = new Array(true, false, false, false, false);
$scope.changeChoose = function (index) { $scope.changeChoose = function (index) {
angular.forEach($scope.partner, function(key, value) { $scope.repartner = {};
if(value.trim()==''){ angular.forEach($scope.partner, function(value, key) {
$scope.partner.remove(key); if((value+'').trim()!=''){
$scope.repartner[key] = value;
} }
}); });
$scope.partner = $scope.repartner;
$scope.chooseArray = new Array(false, false, false, false, false); $scope.chooseArray = new Array(false, false, false, false, false);
$scope.chooseArray[index] = true; $scope.chooseArray[index] = true;
}; };
@ -134,8 +136,9 @@ angular.module('applyPartnerApp', ['ngMessages']).controller('applyPartnerCtrl',
} }
}; };
$scope.sendVerificationCode = function () { $scope.sendVerificationCode = function () {
$scope.checkUserName($scope.partner.contact_phone,$scope.partner.nation_code)
$scope.sendPhoneCodeTime(); $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) { }, function (resp) {
$scope.resError = resp.data.message; $scope.resError = resp.data.message;
}); });

Loading…
Cancel
Save