function pour_out($pro_list, $pro_list_techs, $to_table, $uid, $pro_id) { $wechatObj = new wechatFlow(); $aa = "'"; $pid = 0; if (count($pro_list) > 0) { foreach ((array) $pro_list as $id => $item) { $pid = $id; unset($item['id']); $item['pro_id'] = $pro_id; $item['pid'] = 0; $curr_id = $wechatObj->insertWithArray($item, $to_table); if (!intval($curr_id)) { return $curr_id; } if (count($pro_list_techs) > 0) { foreach ((array) $pro_list_techs as $tech_id => $tech) { if ($pid == $tech['pid']) { unset($tech["id"]); $tech['pro_id'] = $pro_id; $tech['pid'] = $curr_id; $res = $wechatObj->insertWithArray($tech, $to_table . "_techs"); if (!intval($res)) { return $res; } } } } } } return 1; }
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"); } else { if (count(array_diff_assoc($values, $old_techs[$values["id"]])) > 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"]); } }
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); if ($value) { while ($row = mysql_fetch_array($value)) {
} if ($mod) { 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);