Plugin Directory

Changeset 1465826


Ignore:
Timestamp:
08/02/2016 07:35:57 AM (10 years ago)
Author:
hostbaran
Message:

Fix error

Location:
taknod/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • taknod/trunk/functions/core.php

    r1434791 r1465826  
    1 <?php 
     1<?php
    22
    3 define('taknode_base_api_url','http://taknod.com/eset/sell/');
     3define('taknode_base_api_url', 'http://taknod.com/eset/sell/');
    44
    55function taknode_json_price($apiKey)
    66{
    7     if (empty($apiKey)) {
    8         return null;
    9     }
     7    if (empty($apiKey)) {
     8        return null;
     9    }
    1010
    11     return file_get_contents(taknode_base_api_url.'esResellerPrice/'.$apiKey);
     11    return file_get_contents(taknode_base_api_url . 'esResellerPrice/' . $apiKey);
    1212}
    1313
    1414function taknode_core_check_callbak()
    1515{
    16     //file_put_contents('postdata.dat',var_export($_POST, true));
    17     if (isset($_POST['error'])) {
    18         if ($_POST['error']=='200') {
    19             //success
    20             return $_POST;
    21         }else{
    22             return taknode_callback_error((int)$_POST['error']);
    23         }
    24     }
     16    //file_put_contents('postdata.dat',var_export($_POST, true));
     17    if (isset($_POST['error'])) {
     18        if ($_POST['error'] == '200') {
     19            //success
     20            return $_POST;
     21        } else {
     22            return taknode_callback_error((int) $_POST['error']);
     23        }
     24    }
    2525}
    2626
    2727function taknode_callback_error($code)
    2828{
    29     $errors=['کلید API نامعتبر.',
    30                 'اطلاعات محصول اشتباه است.',
    31                 'اطلاعات کاربر اشتباه است.',
    32                 'اطلاعات لایسنس اشتباه است.',
    33                 'کد درخواست لایسنس نا معتبر',
    34                 'کد درخواست لایسنس قبلا استفاده شده است.',
    35                 'خطا در دریافت لایسنس از سرور Eset .',
    36                 -1=>'پارامتر ها کامل ارسال نشده است.',
    37                 -2=>'عدم برقراری ارتباط با بانک.',
    38                 -3=>'پرداخت ناموفق.'] ;
    39     return empty($error[$code]) ? 'خطای تعریف نشده!': $error[$code];
     29    $errors = ['کلید API نامعتبر.',
     30        'اطلاعات محصول اشتباه است.',
     31        'اطلاعات کاربر اشتباه است.',
     32        'اطلاعات لایسنس اشتباه است.',
     33        'کد درخواست لایسنس نا معتبر',
     34        'کد درخواست لایسنس قبلا استفاده شده است.',
     35        'خطا در دریافت لایسنس از سرور Eset .',
     36        -1 => 'پارامتر ها کامل ارسال نشده است.',
     37        -2 => 'عدم برقراری ارتباط با بانک.',
     38        -3 => 'پرداخت ناموفق.'];
     39    return empty($errors[$code]) ? 'خطای تعریف نشده!' : $errors[$code];
    4040}
  • taknod/trunk/js/taknode.js

    r1434791 r1465826  
    11var app = angular.module('taknodeApp', ['ngRoute']);
    2 app.config(function($routeProvider, $locationProvider) {
     2app.config(['$routeProvider', '$locationProvider',function($routeProvider, $locationProvider) {
    33  $routeProvider.when('/', {
    44    templateUrl: 'main.tpl',
    55    controller: 'main'
    66  }).otherwise({redirectTo:'/'});
    7 });
     7}]);
    88
    9 app.controller('main', function($scope,$http,$window,$timeout){
     9app.controller('main', ['$scope','$http','$window','$timeout',function($scope,$http,$window,$timeout){
    1010    var s    = $scope;
    1111    s.setPrice = function(pr,proId){
     
    1717    };
    1818    s.setYear = function(type){
    19         console.log(type);
     19       
    2020        s.finalPrice = null ;
    2121        s.year = s.price[type];
     
    2525    };
    2626    s.setPerUser = function(per,year) {
    27         console.log(per);
    28         console.log(year);
     27       
     28       
    2929        s.finalPrice = null ;
     30        s.prFin = null ;
    3031        s.perUser = per.perUser ;
    3132        s.pr.year = year;
    3233    };
    33     s.calcPrice = function(amount,quan){
    34         s.finalPrice =Math.round( (s.plan.dollarPrice * amount) * (1+(s.plan.profit / 100)) ) / 10;
    35         s.pr.quantity = quan;
    36         s.pr.amount = amount ;
    37         console.log(s.pr);
     34    s.calcPrice = function(p){
     35        s.finalPrice =Math.round( (s.plan.dollarPrice * p.price) * (1+(s.plan.profit / 100)) ) / 10;
     36        s.pr.quantity = p.count;
     37        s.pr.amount = p.price ;
     38        s.prFin = p ;
     39       
    3840    };
    3941
    4042    s.esLicReq = function() {
    41         $http.post(s.plan.apiUrl+'/esLicRequest', s.pr).then(function(resp) {
     43        $http.post(s.plan.apiUrl+'/esLicRequest', s.pr,{headers:{'Content-Type': undefined}}).then(function(resp) {
    4244            resp.data.error === 0 ?
    4345                ($window.location.href=s.plan.apiUrl+"/esGetLic/"+resp.data.licReqCode) :
     
    5153        $timeout(function() {
    5254            angular.forEach(s.plan.price,function(pro,key) {
    53                 console.log(pro);
     55               
    5456                angular.forEach(pro,function(p,pKey) {
    5557                    if (pKey == 'ENAHE') {
     
    5759                       s.setYear('new');
    5860                       angular.forEach(s.year,function(yPer,yKey) {
    59                             //console.log(per);console.log(yKey);
    6061                            if (yKey==1) {
    6162                                s.setPerUser(yPer,yKey);
    62                                 angular.forEach(yPer.perUser,function(dollar,count) {
    63                                     count==1 ? s.calcPrice(dollar,count) : null ;
    64                                 });
     63                                s.calcPrice(yPer.perUser[0]);
    6564                            }
    6665                       });
    67                        
    68                        //s.calcPrice(s.perUser[0],1);
    6966                    }
    7067                });
     
    7471
    7572    s.init();
    76 });
     73}]);
    7774
    7875app.factory('object', function() {
  • taknod/trunk/readme.txt

    r1464084 r1465826  
    1 === taknod ===
     1=== Plugin Name ===
    22Donate link: http://taknod.com/
    3 Tags: لایسنس انتی ویروس,taknod,نمایندگی انتی ویروس , nod32,licencha.Com,taknod.com
     3Tags: payment_ha,taknod,hostbaran , nod32,licencha
    44Requires at least: 3.0.1
    5 Tested up to: 4.5.3
    6 Stable tag: 4.3.3
     5Tested up to: 3.4
     6Stable tag: 4.3
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5252== Changelog ==
    5353
    54 = 1.2 =
    55 *Fix bug
    56 
    57 = 1.1 =
    58 *change CSS
    59 
    6054= 1.0 =
    6155* Initial release.
  • taknod/trunk/taknode.php

    r1464089 r1465826  
    33/**
    44 * @package taknode
    5  * @version 1.2
     5 * @version 1.0
    66 */
    77/*
     
    1010Description: با استفاده از این پلاگین میتوانید با API خود به فروش محصولات نود بپردازید.
    1111Author: taknod.com
    12 Version: 1.2
     12Version: 1.3
    1313Author URI: taknod.com
    1414*/
  • taknod/trunk/template/main.php

    r1434791 r1465826  
    6565                            <td ng-show="perUser">
    6666                                <div class="form-group">
    67                                     <select  class="form-control" >
    68                                         <option ng-repeat="(key, licPrice) in perUser" ng-click="calcPrice(licPrice,key)" value="{{key}}" ng-model="pr.quantity">{{key}} کاربره</option>
    69                                     </select>
     67                                    <select  class="form-control" ng-options="val as val.count for val in perUser track by val.count" ng-model="prFin" ng-change="calcPrice(prFin)">
     68<!--                                        <option ng-repeat="(key, licPrice) in perUser"  value="{{key}}" >{{key}} کاربره</option>
     69 -->                                    </select>
    7070                                </div>
    7171                            </td>
Note: See TracChangeset for help on using the changeset viewer.