Example #1
0
function updateinfo($data)
{
    $Obj = new wechatFlow();
    global $othersql;
    global $info;
    $tableName = "rel_menu";
    $olddata = $info;
    $delarray = array();
    for ($i = 0; $i < count($data); $i++) {
        $value = $data[$i];
        $value["orderid"] = $i;
        $value["pid"] = "0";
        $sub_button = $value["sub_button"];
        unset($value["sub_button"]);
        if ($value["id"] == "") {
            $value["id"] = $Obj->insertWithArray($value, $tableName);
        } else {
            $Obj->updateWithArray($value, $tableName, $value["id"]);
            unset($olddata[$value["id"]]);
        }
        for ($j = 0; $j < count($sub_button); $j++) {
            $values = $sub_button[$j];
            $values["orderid"] = $j;
            $values["pid"] = $value["id"];
            if ($values["id"] == "") {
                $values["id"] = $Obj->insertWithArray($values, $tableName);
            } else {
                $Obj->updateWithArray($values, $tableName, $values["id"]);
                unset($olddata[$values["id"]]);
            }
        }
    }
    if (is_array($olddata)) {
        foreach ($olddata as $value) {
            array_push($delarray, $value["id"]);
        }
    }
    if (count($delarray) > 0) {
        delWithArray($delarray, $tableName);
    }
    $type = array("", "click", "view");
    $data = array();
    $result = mysql_query("SELECT * FROM rel_menu ORDER BY `pid` ASC,`orderid` ASC");
    while ($row = mysql_fetch_assoc($result)) {
        $infos[$row["id"]] = $row;
    }
    foreach ($infos as $value) {
        $array["name"] = $value["name"];
        if ($value["type"] == 1) {
            $array["type"] = $type[$value["type"]];
            $array["key"] = "menu_id_" . $value["id"];
        } elseif ($value["type"] == 3) {
            $array["type"] = $type[1];
            $array["key"] = "menu_id_" . $value["id"];
        } elseif ($value["type"] == 2) {
            $array["type"] = $type[$value["type"]];
            $array["url"] = $value["data"];
        } elseif ($value["type"] == 0) {
            $array["id"] = $value["id"];
            $array["sub_button"] = array();
        }
        if ($value["pid"] != "0") {
            for ($i = 0; $i < count($data); $i++) {
                if ($data[$i]["id"] == $value["pid"]) {
                    array_push($data[$i]["sub_button"], $array);
                }
            }
        } else {
            array_push($data, $array);
        }
        unset($array);
    }
    for ($i = 0; $i < count($data); $i++) {
        unset($data[$i]["id"]);
        if (count($data[$i]["sub_button"]) == 0 && $data[$i]["type"] == "") {
            unset($data[$i]);
        }
    }
    $postdata["button"] = $data;
    $result = $Obj->curl_http_request($url, $Obj->JSON($postdata));
    $result = json_decode($result["json"], true);
    if ($result["errcode"] > 0) {
        exit($result["errmsg"]);
    }
}
Example #2
0
header("Content-type: text/html; charset=utf-8");
require_once "common.inc.php";
require_once "wechatLoop.php";
$Obj = new wechatFlow();
$actiontype = $_GET[actiontype];
$uid = $_G[id];
//print_r($_G);
$tableName = "rel_" . $actiontype;
if ($_GET["mod"] == "save") {
    $delarray = array();
    $data = json_decode($_POST["data"], true);
    $keywords = $data["keywords"];
    unset($data["keywords"]);
    if ($data["id"]) {
        $Obj->updateWithArray($data, $tableName, $data["id"]);
    } else {
        $data["id"] = $Obj->insertWithArray($data, $tableName);
    }
    $result = mysql_query("SELECT * FROM " . $tableName . "_techs WHERE pid='" . $data["id"] . "'AND uid ='" . $uid . "'");
    if ($result) {
        while ($row = mysql_fetch_assoc($result)) {
            $old_techs[$row["id"]] = $row;
        }
    }
    if (is_array($keywords)) {
        for ($i = 0; $i < count($keywords); $i++) {
            $keywords[$i]["pid"] = $data["id"];
            $values = $keywords[$i];
            if ($old_techs[$values["id"]]["id"] == "") {
                $keywords[$i]["id"] = $Obj->insertWithArray($values, $tableName . "_techs");
<?php 
require_once "common.inc.php";
header("Content-type: text/html; charset=utf-8");
$mod = $_GET[mod];
$id = $_G["id"];
require_once "wechat_MySqlConn.php";
require_once "wechatLoop.php";
$wechatObj = new wechatFlow();
if ($mod) {
    switch ($mod) {
        case "modified":
            $id = $wechatObj->updateWithArray($_POST, "rel_manager", $id);
            /*$id = $wechatObj->insertWithArray($_POST, "rel_manager");*/
            if (is_numeric($id)) {
                echo $wechatObj->return_json(0, $id);
            } else {
                echo $wechatObj->return_json(72056, $id);
            }
            break;
    }
    exit;
}
$value = mysql_query("select * from rel_manager where id=" . $id);
while ($row = mysql_fetch_array($value)) {
    $manager_name = $row['manager_name'];
    $id = $row['id'];
    $address = $row['address'];
    $phone = $row['phone'];
    $company = $row['company'];
    $job = $row['job'];
}
$id = $_G["id"];
$name = $_G["manager_name"];
require_once "wechat_MySqlConn.php";
require_once "wechatLoop.php";
$wechatObj = new wechatFlow();
if ($mod) {
    switch ($mod) {
        case "modified":
            $password = md5($_POST["manager_password"]);
            $ifexsit = ifexsit($id, $password);
            if ($ifexsit == 0) {
                echo "1";
            } else {
                $post = array();
                $post["manager_password"] = md5($_POST["new_password"]);
                $id = $wechatObj->updateWithArray($post, "rel_manager", $id);
                if (is_numeric($id)) {
                    echo $wechatObj->return_json(0, $id);
                } else {
                    echo $wechatObj->return_json(72056, $id);
                }
            }
            break;
    }
    exit;
}
function ifexsit($id, $password)
{
    $value = mysql_query("select * from rel_manager where id='" . $id . "' and manager_password='******'");
    if ($row = mysql_fetch_array($value)) {
        return 1;
Example #5
0
<?php 
require_once "common.inc.php";
require_once "config.php";
header("Content-type: text/html; charset=utf-8");
$mod = $_GET[mod];
$uid = $_G["id"];
require_once "wechat_MySqlConn.php";
require_once "wechatLoop.php";
$wechatObj = new wechatFlow();
if ($mod) {
    switch ($mod) {
        case "modified":
            $ifexist = $wechatObj->record_exsit("name", $_POST["name"], "rel_alg_curr");
            if ($ifexist > 0) {
                $id = $wechatObj->updateWithArray($_POST, "rel_alg_curr", $ifexist);
            } else {
                $delete = mysql_query("delete from rel_alg_curr where uid = '" . $uid . "'");
                $id = $wechatObj->insertWithArray($_POST, "rel_alg_curr");
            }
            if (is_numeric($id)) {
                echo $wechatObj->return_json(0, $id);
            } else {
                echo $wechatObj->return_json(72056, $id);
            }
            break;
    }
    exit;
}
$sql = "select * from rel_alg where uid='" . $uid . "'";
$data = array();
$value = mysql_query($sql);
Example #6
0
    switch ($mod) {
        case "modified":
            //$id = $wechatObj->insertWithArray($_POST, "pro_info");
            if (is_numeric($id)) {
                echo $wechatObj->return_json(0, $id);
            } else {
                echo $wechatObj->return_json(72056, $id);
            }
            break;
        case "save":
            $pro_name = $_POST["pro_name"];
            $ifexsit = ifexsit($uid, $pro_name);
            if ($ifexsit < 0) {
                $id = $wechatObj->insertWithArray($_POST, "pro_info");
            } else {
                $id = $wechatObj->updateWithArray($_POST, "pro_info", $ifexsit);
            }
            if (is_numeric($id)) {
                echo $wechatObj->return_json(0, $id);
            } else {
                echo $wechatObj->return_json(72056, $id);
            }
            break;
    }
    exit;
}
$sql = "select * from pro_info where uid='" . $uid . "' and scores > 0";
$data = array();
$value = mysql_query($sql);
if ($value) {
    while ($row = mysql_fetch_array($value)) {
Example #7
0
        }
        //print $line;
    }
    // print $lines;
}
if ($mod) {
    switch ($mod) {
        case "save":
            $data = $_POST['data'];
            $pro = $_POST['pro'];
            $pro_id = $_POST['id'];
            $_score = $_POST["_score"];
            if (is_array($data)) {
                foreach ($data as $value) {
                    if ($_score) {
                        $id = $wechatObj->updateWithArray($value, $result_table, $value["id"]);
                    } else {
                        $id = $wechatObj->updateWithArray($value, $result_table, $value["id"]);
                    }
                }
            }
            $pro_id = $wechatObj->updateWithArray($pro, 'pro_info', $pro_id);
            if (is_numeric($id) && is_numeric($pro_id)) {
                echo $wechatObj->return_json(0, $pro_id);
            } else {
                echo $wechatObj->return_json(72056, $pro_id);
            }
            break;
        case "check":
            $data = $_POST['data'];
            $id = $data["id"];