Exemplo n.º 1
0
 public static function orderLog($orderid, $ss, $note, $orderType = "")
 {
     !self::$dbConn ? self::initDB() : null;
     $where = "where id={$orderid}";
     $orderinfo = OmAvailableModel::getTNameList("om_unshipped_order", "*", $where);
     $sql = array();
     $sql['operatorId'] = $_SESSION['sysUserId'];
     $sql['omOrderId'] = $orderid;
     //$sql['note'] = "编辑订单";
     $sql['note'] = $note;
     $sql['sql'] = mysql_real_escape_string($ss);
     $sql['createdTime'] = time();
     if (!empty($orderType) && $orderinfo[0]['orderType'] != $orderType) {
         $sql['oldStatus'] = $orderinfo[0]['orderType'];
         $sql['newStatus'] = $orderType;
         $sql['note'] .= "修改订单状态";
     }
     $strmctime = date('Y_m', time());
     $sql = "INSERT INTO om_order_log_" . $strmctime . " set " . array2sql($sql);
     $sql = self::$dbConn->query($sql);
     if ($sql) {
         return true;
     } else {
         return false;
         //echo $sql;
     }
 }
Exemplo n.º 2
0
 /**
  * 插入订单快递描述的方法,key为fedexRemark,现在只有独立商城会用到
  * 以下为demo
  * @param array $data 为一个二维数组,至少是一条快递描述记录
  * @return bool
  * @author zqt
  * @modify 20140807 修改方法名,同时订单大数组键改为了declarationContent,表也换了
  */
 public function insertOrderDeclarationContent($data)
 {
     $data = array_filter($data);
     if (empty($data)) {
         //如果$data为空,则不支持操作,直接返回,因为订单跟踪号是非必须的
         return true;
     }
     //检测订单号是否插入成功
     if ($this->_orderid == 0) {
         return false;
     } else {
         foreach ($data as $key => $value) {
             $data[$key]['omOrderId'] = $this->_orderid;
             $data[$key]['datetime'] = time();
         }
     }
     $table = C('DB_PREFIX') . 'declaration_content';
     foreach ($data as $value) {
         $fdata = $this->formatInsertField($table, $value);
         if ($fdata === false) {
             self::$errMsg = $this->validatemsg;
             return false;
         }
         if (!$this->sql("INSERT INTO {$table} SET " . array2sql($fdata))->insert()) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * WebAdStatModel::updateStatInfo()
  * 更新广告访问统计信息
  * @param int $ipNum ip数值
  * @param int $ids 广告ID
  * @param array $data 数据集
  * @return array 结果集数组
  */
 public static function updateStatInfo($ipNum, $ids, $data)
 {
     self::initDB();
     $res = self::showIpAdStat($ipNum, $ids);
     $sql = array2sql($data);
     if ($res) {
         $id = $res['id'];
         $sql = "UPDATE `" . self::$prefix . self::$table . "` SET " . $sql . " WHERE id = '{$id}'";
     } else {
         $sql = "INSERT INTO `" . self::$prefix . self::$table . "` SET " . $sql;
     }
     $query = self::$dbConn->query($sql);
     if ($query) {
         $rows = self::$dbConn->affected_rows();
         if ($rows) {
             return $rows;
         } else {
             self::$errCode = 10001;
             self::$errMsg = "更新数据失败";
             return false;
         }
     } else {
         self::$errCode = 10000;
         self::$errMsg = "执行SQL语句出错";
         return false;
     }
 }
 /**
  * WhOrderPartionPrintDHLModel::insert_data()
  * 插入新加坡口袋信息
  * @param mixed $data
  * @return void
  */
 public static function insert_data($data)
 {
     self::initDB();
     $sql = 'insert into ' . self::$tablename . ' set ' . array2sql($data);
     $sql = self::$dbConn->query($sql);
     return self::$dbConn->insert_id();
 }
Exemplo n.º 5
0
 /**
  * WhWaveInfoModel::update_wave_info()
  * 更新配货单信息
  * @param array $update 更新字段内容
  * @param array $where 条件内容
  * @return void
  */
 public static function update_wave_info($update, $where)
 {
     self::initDB();
     $sql = 'update ' . self::$tablename . ' set ' . array2sql($update) . ' where ' . array2where($where);
     //echo $sql;
     $sql = self::$dbConn->query($sql);
     return $sql;
 }
Exemplo n.º 6
0
 public static function updateOrderRecord($where, $update)
 {
     self::initDB();
     $sql = 'update wh_orderb_history set ' . array2sql($update) . ' where ' . array2where($where);
     //echo $sql;exit;
     $sql = self::$dbConn->query($sql);
     return $sql;
 }
Exemplo n.º 7
0
 public static function updateUserCompetence($nameList, $smsnum)
 {
     self::initDB();
     $successnum = 0;
     $success = array();
     $error = array();
     //设置批量修改记录标志变量
     foreach ($nameList as $from) {
         $table = "`power_global_user`";
         //获取用户的global_user_id
         $filed = "global_user_id";
         $where = " global_user_status = 1 AND global_user_is_delete = 0 AND (global_user_login_name = '{$from}' OR global_user_name = '{$from}')  LIMIT 1 ";
         $ret = self::selectOneTable($table, $filed, $where);
         if (!$ret[0]['global_user_id']) {
             self::$errCode = "1057";
             self::$errMsg = "获取用户资料失败";
             return false;
         }
         $from = $ret[0]['global_user_id'];
         $username = $ret[0]['global_user_name'];
         $field = "num";
         $sql = "SELECT {$field} FROM `" . C('PREFIX') . self::$tabsmspower . "` WHERE 1 AND `global_user_id` = '{$from}' AND `is_delete` = 0 LIMIT 1 ";
         $query = self::$dbConn->query($sql);
         $sumnum = self::$dbConn->fetch_array_all($query);
         //查询在nt_sms_power中是否有sms_num记录
         if ($sumnum) {
             //存在记录则更新
             $field = "num";
             $sql = "UPDATE " . C('PREFIX') . self::$tabsmspower . " SET num = '{$smsnum}' WHERE global_user_id = '{$from}'";
             $query = self::$dbConn->query($sql);
             if ($query) {
                 $affectedrows = self::$dbConn->affected_rows();
                 $successnum++;
                 array_push($success, $username);
             } else {
                 array_push($error, $username);
             }
         } else {
             //不存在记录则插入
             $data = array("global_user_id" => $from, "num" => $smsnum, "is_delete" => "0");
             $def = array2sql($data);
             //将数组转为SET后面的sql语句
             $def = "INSERT INTO `" . C('PREFIX') . self::$tabsmspower . "` SET " . $def;
             $query = self::$dbConn->query($def);
             if ($query) {
                 $successnum++;
                 array_push($success, $username);
             } else {
                 array_push($error, $username);
             }
         }
     }
     if ($successnum === count($nameList)) {
         return array("ret" => "ok", "success" => $success);
     } else {
         return array("ret" => "no", "errorUser" => $error, "success" => $success);
     }
 }
Exemplo n.º 8
0
 /**
  * 修改指定表信息在unshiped表中,按照accountId条件
  * @param  int   $id          订单号
  * @param  array $userInfoArr 用户信息数组
  * @return bool
  * @author zqt
  */
 public function updateByAccountId($table, $accountId, $data)
 {
     $fdata = $this->formatUpdateField($table, $data);
     if ($fdata === false) {
         self::$errMsg = $this->validatemsg;
         return false;
     }
     $accountId = intval($accountId);
     //echo "UPDATE ".$table." SET ".array2sql($data)." WHERE accountId=$accountId AND is_delete=0";exit;
     return $this->sql("UPDATE " . $table . " SET " . array2sql($data) . " WHERE accountId={$accountId} AND is_delete=0")->update();
 }
Exemplo n.º 9
0
 /**
  * 更新箱子颜色表一条或多条记录,暂只支持一维数组
  * @param array $data
  * @param string $where
  * @return boolean
  * @author czq
  */
 public static function updateWaveBoxColor($data, $where = "")
 {
     self::initDB();
     $sql = "UPDATE " . self::$tablename . " SET " . array2sql($data) . " WHERE 1 " . $where;
     $query = self::$dbConn->query($sql);
     if ($query) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 10
0
function updateMateria($data)
{
    global $dbConn;
    $setContent = array2sql($data);
    $sql = "update ebay_materia_statistics set {$setContent} where sku='{$data['sku']}'";
    if ($dbConn->execute($sql)) {
        return 1;
    } else {
        return 0;
    }
}
Exemplo n.º 11
0
 /**
  * 写入LOG日志
  * @param $sql              //修改订单的SQL语句
  * @param $note             //修改订单的操作
  * @param $omOrderId        //订单ID
  * @return bool
  */
 function addSuperAmountSku($data)
 {
     $table = C('DB_PREFIX') . 'records_order_audit';
     $fdata = $this->formatInsertField($table, $data);
     if ($fdata === false) {
         self::$errMsg = $this->validatemsg;
         var_dump(self::$errMsg);
         exit;
         return false;
     }
     $this->sql("INSERT " . $table . " SET " . array2sql($fdata))->insert();
 }
Exemplo n.º 12
0
 public static function insertRecord($insertArr)
 {
     self::initDB();
     //$sql	 =	"INSERT INTO wh_tallying_list(batchNum,sku,num,tallyUserId,entryUserId,entryTime,purchaseId,storeId,entryStatus) VALUES('{$batchNum}','{$sku}',{$amount},{$checkUserId},{$userNameId},".time().",{$purchaseId},1,{$entryStatus})";
     $sql = "INSERT INTO wh_tallying_list set " . array2sql($insertArr);
     //echo $sql;
     $query = self::$dbConn->query($sql);
     if ($query) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 13
0
 /**
  * 波次配置表插入一条记录
  * @param array $data
  * @return number $insertId
  * @author czq
  */
 public static function insertWaveConfigRow($data)
 {
     self::initDB();
     $sql = "INSERT INTO " . self::$tablename . " SET " . array2sql($data);
     $query = self::$dbConn->query($sql);
     if ($query) {
         $insertId = self::$dbConn->insert_id();
         return $insertId;
     } else {
         self::$errCode = "003";
         self::$errMsg = "error";
         return false;
     }
 }
Exemplo n.º 14
0
 /**
  * 插入一条记录
  * @para $data as array
  * return insert_id
  */
 public static function insertRow($data)
 {
     self::initDB();
     $sql = array2sql($data);
     $sql = "INSERT INTO `" . self::$table . "` SET " . $sql;
     $query = self::$dbConn->query($sql);
     if ($query) {
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "error";
         return false;
     }
 }
 /**
  * 根据平台Id和accountid获取账号信息 分页显示
  * @param array $data   
  * @return array 
  * @author yxd
  */
 public function modifyDistributorBasicInformation($data)
 {
     $table = C('DB_PREFIX') . 'developer';
     $fdata = $this->formatInsertField($table, $data);
     if ($fdata === false) {
         $this::$errMsg = $this->validatemsg;
         return false;
     }
     $result = $this->sql("INSERT INTO {$table} SET " . array2sql($fdata))->insert();
     if ($result) {
         $this->_orderid = $this->getLastInsertId();
     }
     return $result;
 }
Exemplo n.º 16
0
 /**
  * 插入一条物品与仓位关联表记录
  * @para $data as array
  * return insert_id
  */
 public static function insertGoodsWhRow($data)
 {
     self::initDB();
     $sql = array2sql($data);
     $sql = "INSERT INTO `pc_goods_location_relation` SET " . $sql;
     $query = self::$dbConn->query($sql);
     if ($query) {
         $insertId = self::$dbConn->insert_id();
         return $insertId;
     } else {
         self::$errCode = "003";
         self::$errMsg = "444444444";
         return false;
     }
 }
Exemplo n.º 17
0
 /**
  * 删除
  */
 public function delAgreement()
 {
     global $dbConn;
     $data = array('is_delete' => 1, 'modifyTime' => date("Y-m-d H:i:s"), 'modifyUserId' => $_SESSION['sysUserId']);
     $ids = post_check($_POST['idArr']);
     $where = "id in (" . implode(',', $ids) . ") ";
     $dataSql = array2sql($data);
     $sql = "update ph_agreement set {$dataSql} where {$where}";
     if ($dbConn->execute($sql)) {
         $arr = array('code' => 1, 'msg' => '添加成功');
     } else {
         $arr = array('code' => 0, 'msg' => '添加失败');
     }
     return json_encode($arr);
 }
Exemplo n.º 18
0
 public function addFloor($data)
 {
     self::initDB();
     $extralsql = array2sql($data);
     $sql = "INSERT " . self::$table . " SET {$extralsql} ";
     $query = self::$dbConn->query($sql);
     if ($query) {
         self::$errCode = "200";
         self::$errMsg = "success";
         return true;
     } else {
         self::$errCode = "003";
         self::$errMsg = "error";
         return false;
     }
 }
Exemplo n.º 19
0
function updateSkuInfo($data)
{
    global $dbConn, $configArgument;
    $setContent = array2sql($data);
    $sql = "select count(*) as totalnum,purchasedays,safeStockDays,cycle_days from ow_stock where sku='{$data['sku']}'";
    $sql = $dbConn->execute($sql);
    $num = $dbConn->fetch_one($sql);
    $comObj = new CommonAct();
    $booknums = $comObj->getOrderSkuNum($data['sku']);
    //已订购库存
    if ($num['totalnum'] > 0) {
        $alertdays = $configArgument['onseadays'] + max($configArgument['stockreaddays'], $configArgument['shipredaydays']) + $configArgument['reshelfdays'] + $num['safeStockDays'] + $num['cycle_days'];
        //预警天数计算
        if ($data['everyday_sale'] != 0) {
            $days = ($data['virtual_stock'] + $data['onWayCount'] + $data['b_stock_cout'] + $booknums) / $data['everyday_sale'];
            $out_alert_days = $data['virtual_stock'] / $data['everyday_sale'];
            //可用天数
            if ($days < $alertdays) {
                $is_alert = 1;
            } else {
                $is_alert = 0;
            }
            if ($out_alert_days <= 5) {
                $out_alert = 1;
                //超卖控制
            } else {
                $out_alert = 0;
            }
        } else {
            $is_alert = 0;
            $out_alert = 0;
        }
        $sql = "update ow_stock set {$setContent}, is_alert='{$is_alert}',out_alert='{$out_alert}',booknums='{$booknums}' where sku='{$data['sku']}'";
    } else {
        $is_alert = 0;
        $out_alert = 0;
        $sql = "INSERT INTO `ow_stock`(`sku`,`everyday_sale`, `count`, `onWayCount`, `salensend`, `booknums`, `virtual_stock`, `b_stock_cout`,`is_alert`,out_alert) VALUES ('{$data['sku']}','{$data['everyday_sale']}','{$data['count']}','{$data['onWayCount']}','{$data['salensend']}','{$booknums}','{$data['virtual_stock']}','{$data['b_stock_cout']}','{$is_alert}','{$out_alert}')";
    }
    echo $sql . "\n";
    if ($dbConn->execute($sql)) {
        return 1;
    } else {
        echo $sql . "\n";
        return 0;
    }
}
Exemplo n.º 20
0
 /**
  * 写入LOG日志
  * @param $sql              //修改订单的SQL语句
  * @param $note             //修改订单的操作
  * @param $omOrderId        //订单ID
  * @return bool
  */
 function orderOperatorLog($sql, $note, $omOrderId)
 {
     $nowtime = time();
     $noteArr = array();
     $noteArr['operatorId'] = $_SESSION['sysUserId'] ? $_SESSION['sysUserId'] : 0;
     $noteArr['omOrderId'] = $omOrderId;
     $noteArr['operatorNote'] = $note;
     $noteArr['sql'] = addslashes($sql);
     $noteArr['createdTime'] = $nowtime;
     $table = C('DB_PREFIX') . 'order_logs';
     $fdata = $this->formatInsertField($table, $noteArr);
     if ($fdata === false) {
         self::$errMsg = $this->validatemsg;
         return false;
     }
     $this->sql("INSERT " . $table . " SET " . array2sql($noteArr))->insert();
 }
Exemplo n.º 21
0
 /**
  * 插入一条记录
  * @para $data as array
  * return insert_id
  */
 public static function insertRow($data)
 {
     self::initDB();
     $sql = array2sql($data);
     $sql = "INSERT INTO `" . self::$table . "` SET " . $sql;
     //echo $sql.'<br>';
     $query = self::$dbConn->query($sql);
     if ($query) {
         publishMQ($table, $sql, C("MQSERVERADDRESS"));
         $insertId = self::$dbConn->insert_id();
         return $insertId;
     } else {
         self::$errCode = "003";
         self::$errMsg = "444444444";
         return false;
     }
 }
Exemplo n.º 22
0
 public static function updateAreaList($data, $where)
 {
     self::initDB();
     $extral_sql = array2sql($data);
     $sql = "update " . self::$table . " set {$extral_sql} {$where} ";
     $query = self::$dbConn->query($sql);
     if ($query) {
         self::$errCode = "200";
         self::$errMsg = "更新成功";
         return $query;
         //插入成功
     } else {
         self::$errCode = "003";
         self::$errMsg = "更新失败";
         return false;
         //插入失败
     }
 }
Exemplo n.º 23
0
 public static function update($data, $where = "", $table = "nt_email")
 {
     self::initDB();
     $sql = array2sql($data);
     if ($table == 'nt_email') {
         $sql = "UPDATE `" . self::$tabemail . "` SET " . $sql . " WHERE 1 " . $where;
     } else {
         $sql = "UPDATE `" . self::$tabsms . "` SET " . $sql . " WHERE 1 " . $where;
     }
     $query = self::$dbConn->query($sql);
     if ($query) {
         return true;
     } else {
         self::$errCode = "005";
         self::$errMsg = "Error occurred!Function=" . __FUNCTION__ . " sql= " . $sql;
         return false;
     }
 }
Exemplo n.º 24
0
function updateSkuInfo($data)
{
    global $dbConn;
    $setContent = array2sql($data);
    $sql = "select count(*) as totalnum from ph_sku_statistics where sku='{$data['sku']}'";
    $sql = $dbConn->execute($sql);
    $num = $dbConn->fetch_one($sql);
    if ($num['totalnum'] > 0) {
        $sql = "update ph_sku_statistics set {$setContent} where sku='{$data['sku']}'";
    } else {
        $sql = "insert into  ph_sku_statistics set {$setContent} ";
    }
    if ($dbConn->execute($sql)) {
        return 1;
    } else {
        return 0;
    }
    //echo $sql;
}
Exemplo n.º 25
0
function deal_partner()
{
    global $dbConn;
    $sql = "select * from ph_partner ";
    $sql = $dbConn->execute($sql);
    $numberInfo = $dbConn->getResultArray($sql);
    foreach ($numberInfo as $item) {
        $sql = "select company_name from ph_partner_unique where company_name='{$item['company_name']}'";
        $sql = $dbConn->execute($sql);
        $skuInfo = $dbConn->fetch_one($sql);
        if (empty($skuInfo['company_name'])) {
            $dataSet = array2sql($item);
            $sql = "insert into  ph_partner_unique set {$dataSet} ";
            if ($dbConn->execute($sql)) {
                echo $sql . "\n";
            }
        }
    }
}
Exemplo n.º 26
0
 public static function insertOrderLog($omOrderId, $note)
 {
     !self::$dbConn ? self::initDB() : null;
     $data = array('operatorId' => $_SESSION['sysUserId'], 'omOrderId' => $omOrderId, 'note' => $note, 'createdTime' => time());
     $string = array2sql($data);
     //var_dump($string); exit;
     $sql = "INSERT INTO `" . self::$orderLogTable . "` SET " . $string;
     //echo $sql; exit;
     $query = self::$dbConn->query($sql);
     if ($query) {
         self::$errCode = "200";
         self::$errMsg = "插入成功";
         return true;
     } else {
         self::$errCode = "001";
         self::$errMsg = "获取数据失败";
         return false;
         //失败则设置错误码和错误信息, 返回false
     }
 }
Exemplo n.º 27
0
 /**
  * UserCompetenceModel::Competence()
  * 添加修改用户权限
  * @param array $data 数组
  * @return  bool
  */
 public static function competence($data)
 {
     self::initDB();
     $sql = array2sql($data);
     $sql = "REPLACE INTO " . self::$prefix . self::$table_user . " SET " . $sql;
     $query = self::$dbConn->query($sql);
     if ($query) {
         $affectedrows = self::$dbConn->affected_rows();
         if ($affectedrows) {
             return true;
         } else {
             self::$errCode = "10000";
             self::$errMsg = "用户权限操作失败";
             return false;
         }
     } else {
         self::$errCode = "10001";
         self::$errMsg = "执行SQL语句失败";
         return false;
     }
 }
Exemplo n.º 28
0
 public function replaceData($id, $data, $column = 'id')
 {
     $id = intval($id);
     $column = addslashes($column);
     if ($id == 0) {
         return false;
     }
     $fdata = $this->formatUpdateField($this->getTableName(), $data);
     if ($fdata === false) {
         self::$errMsg = $this->validatemsg;
         return false;
     }
     if ($this->checkIsExists($fdata)) {
         return false;
     }
     $check = $this->sql("SELECT COUNT(*) AS count FROM {$this->getTableName()} WHERE {$column}={$id}")->count();
     if ($check == 0) {
         $fdata[$column] = $id;
         return $this->insertData($fdata);
     } else {
         return $this->sql("UPDATE " . $this->getTableName() . " SET " . array2sql($fdata) . " WHERE {$column}={$id}")->update();
     }
 }
Exemplo n.º 29
0
 /**
  * 功能:保存店铺信息,存在更新,不存在插入
  * @prama array
  * @return string
  * @author zjr
  */
 public function saveShopInfo($dpId, $shopId, $data)
 {
     $tableName = $this->getTableName();
     if (!$this->formatWhereField($tableName, array('dp_id' => $dpId))) {
         self::$errMsg = $this->validatemsg;
         return false;
     }
     $check = $this->sql("SELECT COUNT(*) AS count FROM {$tableName} WHERE dp_id ={$dpId} and id = '{$shopId}' and is_delete=0")->count();
     if ($check == 0) {
         $rowAffacted = $this->insertData($data);
         if ($rowAffacted > 0) {
             $lastRow = $this->sql("SELECT id FROM {$tableName} where is_delete=0 order by id desc")->page(1)->perpage(1)->select();
         }
         return $lastRow[0]['id'];
     } else {
         $data = $this->formatUpdateField($tableName, $data);
         if (!$data) {
             self::$errMsg = $this->validatemsg;
             return false;
         }
         return $this->sql("UPDATE " . $tableName . " SET " . array2sql($data) . " WHERE dp_id ={$dpId} and id = '{$shopId}' and is_delete=0")->update();
     }
 }
Exemplo n.º 30
0
 /**
  * PaymentOrderModel::addPayment()
  * 保存财务付款记录
  * @param array $data 数组
  * @return  bool
  */
 public static function addPayment($data)
 {
     self::initDB();
     $sql = array2sql($data);
     $sql = "INSERT INTO " . self::$prefix . "pay_order" . " SET " . $sql;
     $query = self::$dbConn->query($sql);
     if ($query) {
         $affectedrows = self::$dbConn->affected_rows();
         if ($affectedrows) {
             $sqlstat = "";
             $sqlstat = "UPDATE " . self::$prefix . "order" . " SET paystatus = '3' WHERE id = '{$data['order_id']}'";
             $query = self::$dbConn->query($sqlstat);
             return $affectedrows;
         } else {
             self::$errCode = "0002";
             self::$errMsg = "付款记录保存失败";
             return false;
         }
     } else {
         self::$errCode = "0002";
         self::$errMsg = "付款记录保存失败";
         return false;
     }
 }