示例#1
0
<?php

include_once '../include/headers.php';
include_once '../include/dbutils.php';
include_once '../include/main.php';
include_once 'domain/providers.php';
db_connect();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $request_payload = file_get_contents('php://input');
    //var_dump($request_payload);
    $json = json_decode($request_payload);
    if (isset($_GET['updateCode'])) {
        $value = updateProductCode($json);
    } else {
        if (isset($_GET['updatePrice'])) {
            $value = updateProductPrice($json);
        } else {
            if (isset($_GET['updateName'])) {
                $value = updateProviderName($json);
            } else {
                $value = saveNewProduct($json);
            }
        }
    }
    //return JSON array
    exit(json_encode($value));
}
    $addnum = $_GET["addnum"];
    //条码输入时,增加的数量
    addProduct($productId, $im, $addnum);
    //增加新产品
} else {
    if ($action == "empty") {
        clearProduct($rowid);
        //清空列表
    } else {
        if ($action == "del") {
            delProduct($id);
            //删除产品
        } else {
            if ($action == "updatePrice") {
                $price = $_GET["price"];
                updateProductPrice($id, $price);
                //更新产品价格
            } else {
                if ($action == "updateAmount") {
                    $amount = $_GET["amount"];
                    updateProductAmount($id, $amount);
                    //更新产品数量
                } else {
                    if ($action == "updateZhekou") {
                        $zhekou = $_GET["zhekou"];
                        updateProductZhekou($id, $zhekou);
                        //更新产品数量
                    } else {
                        if ($action == "updateMoney") {
                            $jine = $_GET["jine"];
                            updateProductJine($id, $jine);