add enable_link

master
yuan 6 years ago
parent 2f7c05f474
commit f83270be4c

@ -320,4 +320,7 @@ public interface ClientManager {
void removeSub(String client_moniker, JSONObject manager);
String getShortLink(String client_moniker);
@Transactional
void switchHfLink(JSONObject manager, String clientMoniker,boolean allow);
}

@ -262,6 +262,9 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
private ClearingDetailMapper clearingDetailMapper;
@Resource
private ClearingLogMapper clearingLogMapper;
@Resource
private ClientConfigMapper clientConfigMapper;
private static final String SOURCE_AGREE_FILE = "source_agree_file";
@ -3666,6 +3669,30 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid
mailService.removeUnsub(sub.getLong("id"));
}
@Override
public void switchHfLink(JSONObject manager, String clientMoniker, boolean allow) {
JSONObject client = getClientInfoByMoniker(clientMoniker);
if (client == null) {
throw new InvalidShortIdException();
}
checkOrgPermission(manager, client);
if(allow){
if(StringUtils.isEmpty(client.getString("hf_pay_url"))){
String hf_pay_url = getShortLink(clientMoniker);
client.put("hf_pay_url",hf_pay_url);
JSONObject clientConfig = new JSONObject();
clientConfig.put("hf_pay_url",hf_pay_url);
clientConfig.put("client_id",client.getIntValue("client_id"));
clientConfigMapper.update(clientConfig);
clientMapper.update(client);
}
}
clientModifySupport.processClientConfigModify(new SwitchPermissionModify(manager, clientMoniker, "enable_link", allow));
}
@Override
public String getShortLink(String client_moniker){
String longUrl = PlatformEnvironment.getEnv().concatUrl("/api/v1.0/hf_gateway/partners/"+client_moniker+"/jump");

@ -536,4 +536,9 @@ public class PartnerManageController {
clientManager.removeSub(clientMoniker,manager);
}
@ManagerMapping(value = "/{clientMoniker}/hf", method = RequestMethod.PUT, role = {ManagerRole.SERVANT, ManagerRole.DEVELOPER})
public void switchHfPermission(@PathVariable String clientMoniker, @RequestBody JSONObject pass, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager) {
clientManager.switchHfLink(manager, clientMoniker, pass.getBooleanValue("allow"));
}
}

@ -1234,7 +1234,7 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
})
};
$scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false};
$scope.init = {jsapi: false, gateway: false, offline: false, refund: false,common_sub_merchant_id:false, channel: {},gateway_alipay_online:false,hf_Link:false};
$scope.switchCommonSubMerchantId = function () {
if (!$scope.paymentInfo) {
return;
@ -1274,6 +1274,28 @@ define(['angular', 'decimal', 'static/commons/commons', 'uiBootstrap', 'uiRouter
})
})
};
$scope.toggleHfLink = function (channel) {
if (!channel) {
return;
}
if (!$scope.paymentInfo) {
return;
}
if (!$scope.init.hf_Link) {
$scope.init.hf_Link = true;
return;
}
$http.put('/sys/partners/' + $scope.partner.client_moniker + '/hf', {allow: $scope.paymentInfo.enable_link}).then(function () {
$scope.loadPartnerPaymentInfo();
}, function (resp) {
commonDialog.alert({
title: 'Failed to change enable_link permission status',
content: resp.data.message,
type: 'error'
});
})
};
$scope.toggleJsApi = function () {
if (!$scope.paymentInfo) {
return;

@ -161,31 +161,31 @@
<div class="panel-heading">Channels</div>
<div class="panel-body">
<div class="form-horizontal">
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
<label class="col-xs-6 control-label">Alipay|支付宝</label>
<div class="col-xs-6">
<input type="checkbox" ng-model="paymentInfo.enable_alipay" bs-switch switch-change="toggleChannel('alipay')">
</div>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
<label class="col-xs-6 control-label">Bestpay|翼支付</label>
<div class="col-xs-6">
<input type="checkbox" ng-model="paymentInfo.enable_bestpay" bs-switch switch-change="toggleChannel('bestpay')">
</div>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
<label class="col-xs-6 control-label">WeChat|微信</label>
<div class="col-xs-6">
<input type="checkbox" ng-model="paymentInfo.enable_wechat" bs-switch switch-change="toggleChannel('wechat')">
</div>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
<label class="col-xs-6 control-label">JD|京东</label>
<div class="col-xs-6">
<input type="checkbox" ng-model="paymentInfo.enable_jd" bs-switch switch-change="toggleChannel('jd')">
</div>
</div>
<div class="form-group col-sm-6">
<div class="form-group col-sm-4">
<label class="col-xs-6 control-label">HF|汇付</label>
<div class="col-xs-6">
<input type="checkbox" ng-model="paymentInfo.enable_hf" bs-switch switch-change="toggleChannel('hf')">
@ -313,6 +313,14 @@
</p>
</div>
</div>
<hr>
<div class="form-group">
<label class="col-sm-2 control-label">HF Pay Link</label>
<div class="col-sm-10">
<input type="checkbox" ng-model="paymentInfo.enable_link" bs-switch switch-change="toggleHfLink('hf')">
&nbsp;&nbsp;<span ng-if="paymentInfo.enable_link">{{paymentInfo.hf_pay_url}}</span>
</div>
</div>
</div>
</div>
</div>

Loading…
Cancel
Save