Example #1
0
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;
}
Example #2
0
<?php

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"] == "") {
Example #3
0
<?php

require_once "common.inc.php";
header("Content-type: text/html; charset=utf-8");
$othersql = " uid=" . $_G[id] . " order by id asc";
$uid = $_G[id];
$mod = $_GET[mod];
require_once "wechatLoop.php";
$wechatObj = new wechatFlow();
mysql_query("CREATE TABLE IF NOT EXISTS pro_process (\r\n    id int not null primary key auto_increment\r\n)");
//创建表
if ($mod) {
    switch ($mod) {
        case "oper":
            if ($_POST) {
                echo $wechatObj->category_oper($_POST);
            } else {
                echo $wechatObj->return_json(72003, "post null");
            }
            break;
        case "select":
            $data = $_POST['data'];
            $id = $_POST['id'];
            $result = $id;
            // print_r($data);
            if ($result) {
                echo $result;
            } else {
                echo $wechatObj->return_json(72058, $id);
            }
            break;
Example #4
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"]);
    }
}
<?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'];
}
Example #6
0
<?php

require_once "common.inc.php";
require_once "wechatLoop.php";
$wechatObj = new wechatFlow();
$uid = $_G[id];
$mod = $_GET[mod];
$page = $_GET[page];
$tableName = "pro_process";
$techs_table = $tableName . '_techs';
$data = array();
$result_table = 'pro_process';
function query_pro($tableName, $uid, $pro_id, $scores)
{
    $data = array();
    $result = mysql_query("SELECT * FROM {$tableName} WHERE pro_id ='" . $pro_id . "' ORDER BY id ASC");
    if ($result) {
        while ($row = mysql_fetch_assoc($result)) {
            $data[$row["id"]] = $row;
            $data[$row["id"]]["info"] = $row["info"];
            $data[$row["id"]]["keywords"] = array();
        }
    }
    $result = mysql_query("SELECT * FROM {$tableName}_techs WHERE pro_id ='" . $pro_id . "' ORDER BY id ASC");
    if ($result) {
        while ($row = mysql_fetch_assoc($result)) {
            array_push($data[$row["pid"]]["keywords"], $row);
        }
    }
    return $data;
}
Example #7
0
ini_set('display_startup_errors', TRUE);
date_default_timezone_set('Europe/London');
define('EOL', PHP_SAPI == 'cli' ? PHP_EOL : '<br />');
/** Include PHPExcel */
require_once "PHPExcel/Classes/PHPExcel.php";
require_once "common.inc.php";
require_once "wechatLoop.php";
function convertUTF8($str)
{
    if (empty($str)) {
        return '';
    }
    return $str;
    //iconv('gb2312', 'utf-8', $str);
}
$wechatObj = new wechatFlow();
$uid = $_G[id];
$pro_name = $_GET[pro_name];
$pro_id = $_GET[pro_id];
$pro_level = $_GET[pro_level];
$scores = $_GET[scores];
$meet = $_GET[meet];
$tableName = "pro_process";
$data = $wechatObj->query_pro($tableName, $uid, $pro_id, 1130);
// print_r($data);
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator(convertUTF8("zhanshuaibing"))->setLastModifiedBy(convertUTF8("zhanshuaibing"))->setTitle(convertUTF8("PHPExcel"))->setSubject(convertUTF8("PHPExcel"))->setDescription(convertUTF8("Test document for PHPExcel."))->setKeywords(convertUTF8("office PHPExcel php"))->setCategory(convertUTF8("Test result file"));
// Add some data
$objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', convertUTF8($pro_name . "可靠性符合性评价报告"));
Example #8
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 #9
0
<?php

require_once "common.inc.php";
//能够获取用户的id
header("Content-type: text/html; charset=utf-8");
$mod = $_GET[mod];
$uid = $_G["id"];
//将用户的id记录
require_once "wechatLoop.php";
$wechatObj = new wechatFlow();
function ifexsit($uid, $pro_name)
{
    $value = mysql_query("select * from pro_info where uid='" . $uid . "' and pro_name='" . $pro_name . "'");
    if ($row = mysql_fetch_array($value)) {
        return $row['id'];
    } else {
        return -1;
    }
}
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"];
Example #10
0
<?php

require_once "common.inc.php";
require_once "wechatLoop.php";
$wechatObj = new wechatFlow();
$uid = $_G[id];
$mod = $_GET[mod];
$page = $_GET[page];
$tableName = "pro_process";
$techs_table = $tableName . '_techs';
$data = array();
$result_table = $techs_table;
function query_pro($tableName, $uid, $pro_id, $scores)
{
    $data = array();
    $result = mysql_query("SELECT * FROM {$tableName} WHERE pro_id ='" . $pro_id . "' ORDER BY id ASC");
    if ($result) {
        while ($row = mysql_fetch_assoc($result)) {
            $data[$row["id"]] = $row;
            $data[$row["id"]]["info"] = $row["info"];
            $data[$row["id"]]["keywords"] = array();
        }
    }
    $result = mysql_query("SELECT * FROM {$tableName}_techs WHERE pro_id ='" . $pro_id . "' ORDER BY id ASC");
    if ($result) {
        while ($row = mysql_fetch_assoc($result)) {
            array_push($data[$row["pid"]]["keywords"], $row);
        }
    }
    return $data;
}