Giter VIP home page Giter VIP logo

Bayashka's Projects

apps icon apps

A collection of apps built on Electron

codehub-push icon codehub-push

Push notification server built in Node.js for the iOS application CodeHub

explore icon explore

Community-curated topic pages on GitHub

w icon w

<?php header("Content-Type: application/json; encoding=utf-8"); $secret_key = 'hiUl8U4F9q3BcbAl28va'; // Защищенный ключ приложения $input = $_POST; // Проверка подписи $sig = $input['sig']; unset($input['sig']); ksort($input); $str = ''; foreach ($input as $k => $v) { $str .= $k.'='.$v; } if ($sig != md5($str.$secret_key)) { $response['error'] = array( 'error_code' => 10, 'error_msg' => 'Несовпадение вычисленной и переданной подписи запроса.', 'critical' => true ); } else { // Подпись правильная switch ($input['notification_type']) { case 'get_item': // Получение информации о товаре $item = $input['item']; // наименование товара if ($item == 'item1') { $response['response'] = array( 'item_id' => 25, 'title' => '300 золотых монет', 'photo_url' => 'http://somesite/images/coin.jpg', 'price' => 5 ); } elseif ($item == 'item2') { $response['response'] = array( 'item_id' => 27, 'title' => '500 золотых монет', 'photo_url' => 'http://somesite/images/coin.jpg', 'price' => 10 ); } else { $response['error'] = array( 'error_code' => 20, 'error_msg' => 'Товара не существует.', 'critical' => true ); } break; case 'get_item_test': // Получение информации о товаре в тестовом режиме $item = $input['item']; if ($item == 'item1') { $response['response'] = array( 'item_id' => 125, 'title' => '300 золотых монет (тестовый режим)', 'photo_url' => 'http://somesite/images/coin.jpg', 'price' => 5 ); } elseif ($item == 'item2') { $response['response'] = array( 'item_id' => 127, 'title' => '500 золотых монет (тестовый режим)', 'photo_url' => 'http://somesite/images/coin.jpg', 'price' => 10 ); } else { $response['error'] = array( 'error_code' => 20, 'error_msg' => 'Товара не существует.', 'critical' => true ); } break; case 'order_status_change': // Изменение статуса заказа if ($input['status'] == 'chargeable') { $order_id = intval($input['order_id']); // Код проверки товара, включая его стоимость $app_order_id = 1; // Получающийся у вас идентификатор заказа. $response['response'] = array( 'order_id' => $order_id, 'app_order_id' => $app_order_id, ); } else { $response['error'] = array( 'error_code' => 100, 'error_msg' => 'Передано непонятно что вместо chargeable.', 'critical' => true ); } break; case 'order_status_change_test': // Изменение статуса заказа в тестовом режиме if ($input['status'] == 'chargeable') { $order_id = intval($input['order_id']); $app_order_id = 1; // Тут фактического заказа может не быть - тестовый режим. $response['response'] = array( 'order_id' => $order_id, 'app_order_id' => $app_order_id, ); } else { $response['error'] = array( 'error_code' => 100, 'error_msg' => 'Передано непонятно что вместо chargeable.', 'critical' => true ); } break; } } echo json_encode($response); ?>

windows-uwp icon windows-uwp

Conceptual and overview content for developing Microsoft Universal Windows Platform (UWP) apps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.