|
@@ -413,7 +413,22 @@
|
|
$scope.vm = result.data.data;
|
|
$scope.vm = result.data.data;
|
|
$scope.vm.number = '';
|
|
$scope.vm.number = '';
|
|
$scope.vm.payType = 2;
|
|
$scope.vm.payType = 2;
|
|
- })
|
|
|
|
|
|
+ });
|
|
|
|
+ if($scope.ios.isIOS){
|
|
|
|
+ var productIds = ['apple100000','apple100001','apple100002','apple100003','apple100004']; // <- Add your product Ids here
|
|
|
|
+ msg.loading();
|
|
|
|
+ inAppPurchase
|
|
|
|
+ .getProducts(productIds)
|
|
|
|
+ .then(function (products) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ $scope.products = products;
|
|
|
|
+ console.log('products:'+JSON.stringify(products));
|
|
|
|
+ })
|
|
|
|
+ .catch(function (err) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ console.log(err);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
});
|
|
});
|
|
$scope.payExplain = function(){
|
|
$scope.payExplain = function(){
|
|
$state.go("app.payExplain")
|
|
$state.go("app.payExplain")
|
|
@@ -460,21 +475,33 @@
|
|
//充值
|
|
//充值
|
|
$scope.charge = function(number){
|
|
$scope.charge = function(number){
|
|
if($scope.ios.isIOS){
|
|
if($scope.ios.isIOS){
|
|
- if ($scope.ios.productid.length<2){
|
|
|
|
|
|
+ if (number<2){
|
|
msg.text('请选择充值金额');
|
|
msg.text('请选择充值金额');
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ console.log('购买productid:'+number);
|
|
|
|
+ msg.loading();
|
|
inAppPurchase
|
|
inAppPurchase
|
|
- .buy($scope.ios.productid)
|
|
|
|
|
|
+ .buy(number)
|
|
.then(function (data) {
|
|
.then(function (data) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ console.log('购买then:'+JSON.stringify(data));
|
|
return inAppPurchase.consume(data.productType, data.receipt, data.signature);
|
|
return inAppPurchase.consume(data.productType, data.receipt, data.signature);
|
|
})
|
|
})
|
|
- .then(function () {
|
|
|
|
|
|
+ .then(function (data) {
|
|
|
|
+ msg.hide();
|
|
|
|
+ myService.orderIos(number).then(function (result) {
|
|
|
|
+ console.log('服务器端购买成功:'+number);
|
|
|
|
+ }, function (erro) {
|
|
|
|
+ });
|
|
|
|
+ console.log('购买成功:'+number);
|
|
msg.success('购买成功');
|
|
msg.success('购买成功');
|
|
$ionicHistory.goBack();
|
|
$ionicHistory.goBack();
|
|
})
|
|
})
|
|
.catch(function (err) {
|
|
.catch(function (err) {
|
|
- alert('购买失败:'+err);
|
|
|
|
|
|
+ msg.hide();
|
|
|
|
+ console.log('购买失败:'+JSON.stringify(err));
|
|
|
|
+ // alert('购买失败:'+JSON.stringify(err));
|
|
});
|
|
});
|
|
}else{
|
|
}else{
|
|
if (!number) {
|
|
if (!number) {
|