public function view_rollBackStock() { $orderid = isset($_GET['orderid']) ? intval($_GET['orderid']) : 0; if ($orderid < 1) { //传参不合法 $data = array('data' => array('参数不合法!'), 'link' => 'index.php?mod=unusualOrder&act=unusualOrderList'); goErrMsgPage($data); exit; } $po_obj = new PackingOrderModel(); $orderinfo = $po_obj->getOrderInfoById($orderid); if (empty($orderinfo)) { $data = array('data' => array('指定发货单不存在!'), 'link' => 'index.php?mod=unusualOrder&act=unusualOrderList'); goErrMsgPage($data); exit; } if ($orderinfo['orderStatus'] != PKS_UNUSUAL) { //该订单不在待复核状态 $data = array('data' => array('该订单不是异常订单!'), 'link' => 'index.php?mod=unusualOrder&act=unusualOrderList'); goErrMsgPage($data); exit; } $sod_obj = new ShipingOrderDetailModel(); $sku_havegot = $sod_obj->getSkuHavedone($orderid); //获得已经配货的sku列表 $rollbackresult = $sod_obj->rollBackStock($sku_havegot); if ($rollbackresult) { $data = array('data' => array('回滚成功!'), 'link' => 'index.php?mod=unusualOrder&act=unusualOrderList'); goOkMsgPage($data); exit; } else { $data = array('data' => array('该订单不是异常订单!'), 'link' => 'index.php?mod=dispatchBillQuery&act=showForm'); goErrMsgPage($data); exit; } }
public function view_submitEditData() { $tid = isset($_POST['tid']) ? intval($_POST['tid']) : 0; $name = isset($_POST['title']) ? trim($_POST['title']) : ''; $subject = isset($_POST['topic']) ? trim($_POST['topic']) : ''; $content = isset($_POST['content']) ? trim($_POST['content']) : ''; $countries = isset($_POST['country']) ? $_POST['country'] : false; $tpl_obj = new CommonModel('msg_ebaycstpl'); $tplRel_obj = new CommonModel('msg_ebaycsrel'); $tplInfo = $tpl_obj->findOne('*', " where id='{$tid}' "); if (empty($tplInfo)) { $msgdata = array('data' => array('不存在的模板!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList'); goErrMsgPage($msgdata); exit; } $tpl_obj->updateData(array('name' => $name, 'subject' => $subject, 'content' => $content, 'updateTime' => time()), " where id='{$tid}'"); $countries = CommonModel::transSafetySql($countries); $tplRel_obj->updateData(array('tplId' => 0), " where tplId='{$tid}'"); $contrySql = implode("', '", $countries); $tplRel_obj->updateData(array('tplId' => $tid), " where countryCode in ('{$contrySql}')"); $msgdata = array('data' => array('执行成功!'), 'link' => 'index.php?mod=messageTemplate&act=showEbayTplList'); goOkMsgPage($msgdata); exit; }
private function editMsgCategoryDataSubmit() { $data['name'] = isset($_POST['catname']) ? trim($_POST['catname']) : ''; //名称 $data['rules'] = isset($_POST['alphabet']) ? $_POST['alphabet'] : array(); $data['account'] = isset($_POST['account']) ? trim($_POST['account']) : ''; //账号 $data['site'] = isset($_POST['site']) ? trim($_POST['site']) : ''; $data['gmail'] = isset($_POST['gmail']) ? trim($_POST['gmail']) : ''; $data['notes'] = isset($_POST['notes']) ? trim($_POST['notes']) : ''; //备注 extract($this->platformRelate($type)); //特定平台相关信息 $data['rules'] = array_intersect($data['rules'], generate_alphabet()); //计算交集 以确保规则正确 $data['rules'] = implode(',', $data['rules']); $data = array_map('mysql_real_escape_string', $data); $msgcat_obj = new amazonmessagecategoryModel(); $lpower_obj = new LocalPowerAmazonModel(); $global_obj = new GetLoacalUserModel(); //print_r($_SESSION); $creater = $global_obj->getRealNameByGlobalId($_SESSION['globaluserid']); $data['creater'] = $creater['global_user_name']; $data['createtime'] = time(); if ($data['account'] == -1) { //未分配账号 $promptdata = array('data' => array('请分配账号!'), 'link' => $gobackurl); goErrMsgPage($promptdata); } $cid = isset($_POST['cid']) ? trim($_POST['cid']) : 0; //这下面是判断是新增分类还是编辑分类,然后执行相应操作 if ($cid === 0) { //新增加分类 try { $result = $msgcat_obj->addNewCategory($data); } catch (Exception $e) { $promptdata = array('data' => array('新增分类失败!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } if (empty($result)) { //不存在的id $promptdata = array('data' => array('不合法的id!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } else { /*----- 将新增的分类的权限给创建者 -----*/ try { $new_cid = $msgcat_obj->getCategoryInfoByCatname($data['name']); $lpower_obj->updatePowerByAddClass($_SESSION['userId'], $new_cid['id']); } catch (Exception $e) { print_r($new_cid); /* $promptdata = array('data'=>array('权限更新失败!'), 'link'=>$gobackurl); goErrMsgPage($promptdata); */ exit; } } } else { //更新分类 /*----- 如果是更新 则需确保数据分类是否和操作的向对应 -----*/ $catinfo = $msgcat_obj->getCategoryInfoById($cid); if (empty($catinfo)) { //不存在的id $promptdata = array('data' => array('不合法的id!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } $result = $msgcat_obj->updateCategoryInfo($cid, $data); } if ($result) { $promptdata = array('data' => array('操作成功!'), 'link' => $gobackurl); goOkMsgPage($promptdata); exit; } else { $promptdata = array('data' => array('操作失败!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } }
public function handleSubmitData() { extract($this->generateInfo()); $cids = isset($_POST['catids']) ? $_POST['catids'] : array(); $userid = isset($_POST['userid']) ? $_POST['userid'] : FALSE; if ($userid === FALSE) { $msgdata = array('data' => array('没指定用户!'), 'link' => $gobackurl); goErrMsgPage($msgdata); exit; } $msgcat_obj = new amazonmessagecategoryModel(); $catidlist = $msgcat_obj->getAllCategoryInfoList('', 'id'); $original = array(); foreach ($catidlist as $value) { $original[] = $value['id']; } $finalids = array_intersect($original, $cids); //保证提交的分类id都是该用户有拥有权限的分类id $powerlist = implode(',', $finalids); $lp_obj = new LocalPowerAmazonModel(); $upresult = $lp_obj->{$updatefunc}($userid, $powerlist); print_r($upresult); if ($upresult) { $msgdata = array('data' => array('成功!'), 'link' => $gobackurl); goOkMsgPage($msgdata); exit; } else { $msgdata = array('data' => array('失败!'), 'link' => $gobackurl); goErrMsgPage($msgdata); exit; } }
private function editMsgCategoryDataSubmit($type) { $data['name'] = isset($_POST['catname']) ? trim($_POST['catname']) : ''; //名称 $data['rules'] = isset($_POST['alphabet']) ? $_POST['alphabet'] : array(); $data['account'] = isset($_POST['account']) ? trim($_POST['account']) : ''; //账号 $data['notes'] = isset($_POST['notes']) ? trim($_POST['notes']) : ''; //备注 extract($this->platformRelate($type)); //特定平台相关信息 $data['rules'] = array_intersect($data['rules'], generate_alphabet()); //计算交集 以确保规则正确 $data['rules'] = implode(',', $data['rules']); $data['platform'] = $platformid; $data = array_map('mysql_real_escape_string', $data); $msgcat_obj = new messagecategoryModel(); if ($data['account'] == -1) { //未分配账号 $promptdata = array('data' => array('请分配账号!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } $cid = isset($_POST['cid']) ? trim($_POST['cid']) : 0; if ($cid === 0) { //新增加分类 $result = $msgcat_obj->addNewCategory($data); } else { //更新分类 /*----- 如果是更新 则需确保数据分类是否和操作的向对应 -----*/ $catinfo = $msgcat_obj->getCategoryInfoById($cid); if (empty($catinfo)) { //不存在的id $promptdata = array('data' => array('不合法的id!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } if ($catinfo['platform'] != $data['platform']) { //hack行为 $promptdata = array('data' => array('不合法的id!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } unset($data['platform']); //不运行更新所属平台 $result = $msgcat_obj->updateCategoryInfo($cid, $data); } if ($result) { $promptdata = array('data' => array('操作成功!'), 'link' => $gobackurl); goOkMsgPage($promptdata); exit; } else { $promptdata = array('data' => array('操作失败!'), 'link' => $gobackurl); goErrMsgPage($promptdata); exit; } }
public function view_formDataImport() { // $tir_obj = new TrackInfoRecordModel(); $ebay_id = $_POST['order'][1]; $tracking = $_POST['express'][1]; if (empty($ebay_id) && empty($tracking)) { $data = array("data" => array('发货单和跟踪号不能是空!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); } $where = "where id={$ebay_id}"; $order = orderPartionModel::selectOrder($where); if (!$order) { $data = array("data" => array('发货单不存在!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } if ($order[0]['orderStatus'] != PKS_PRINT_SHIPPING_INVOICE) { $data = array("data" => array($ebay_id . '此发货单状态不是在待打印面单状态!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } $array = array('shipOrderId' => $ebay_id, 'is_delete' => 0); //根据发货单号获取快递需要的箱子和跟踪号数量 $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id); $count_binding = WhOrderTracknumberModel::count($array); //发货单已经绑定跟踪号的数量 if (empty($result_tracking_count)) { if ($count_binding > 0) { $data = array("data" => array($ebay_id . "该发货单已经绑定好跟踪号了!"), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } } else { $result_tracking_count = $result_tracking_count['trackingCount']; //发货单需要绑定跟踪号的数量 if ($result_tracking_count <= $count_binding) { $data = array("data" => array($ebay_id . "该发货单已经绑定好跟踪号了!"), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } } //查询扫描的跟踪号是否已经扫描过了的 $result_select = WhOrderTracknumberModel::select_ByTracknumber($tracking); if ($result_select) { $data = array("data" => array('该跟踪号已经绑定' . $result_select['shipOrderId'] . ',请检查!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } $data_insert = array('tracknumber' => $tracking, 'shipOrderId' => $ebay_id, 'createdTime' => time()); $array_count = array('shipOrderId' => $ebay_id, 'is_delete' => 0); //根据发货单号获取快递需要的箱子和跟踪号数量 $result_tracking_count = WhWaveTrackingBoxModel::select_by_shipOrderId($ebay_id); //说明该快递单只有一个箱子和一个跟踪号,所以不需要在wh_wave_tracking_box "快递单号的箱子与跟踪号数量表"添加记录 if (empty($result_tracking_count)) { $count_binding = WhOrderTracknumberModel::count($array_count); //发货单已经绑定跟踪号的数量 if ($count_binding > 0) { $data = array("data" => array('该发货单号已经绑定好跟踪号了,不在需要和这个跟踪号绑定!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } WhBaseModel::begin(); $result_insert = WhOrderTracknumberModel::insert($data_insert); if (!$result_insert) { WhBaseModel::rollback(); $data = array("data" => array('跟踪号绑定失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } //更新发货表状态 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING); if (!$ostatus) { WhBaseModel::rollback(); $data = array("data" => array('更新发货单状态失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } WhPushModel::pushOrderStatus($ebay_id, 'PKS_WAITING_LOADING', $_SESSION['userId'], time()); //状态推送,需要改为待装车扫描(订单系统提供状态常量) WhBaseModel::commit(); $data = array("data" => array('绑定成功,请扫描另外一个发货单!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goOkMsgPage($data); } else { $result_tracking_count = $result_tracking_count['trackingCount']; //发货单需要绑定跟踪号的数量 $count_binding = WhOrderTracknumberModel::count($array_count); //发货单已经绑定跟踪号的数量 if ($result_tracking_count > $count_binding) { WhBaseModel::begin(); $result_insert = WhOrderTracknumberModel::insert($data_insert); if (!$result_insert) { WhBaseModel::rollback(); $data = array("data" => array('跟踪号绑定失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } $num = $result_tracking_count - $count_binding - 1; if ($num == 0) { //更新发货表状态 $ostatus = WhWaveOrderPartionScanReviewModel::updateShippingOrderStatus($ebay_id, $status = PKS_WAITING_LOADING); if (!$ostatus) { WhBaseModel::rollback(); $data = array("data" => array('更新发货单状态失败,请联系负责人!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } WhPushModel::pushOrderStatus($ebay_id, ' ', $_SESSION['userId'], time()); //状态推送,需要改为待装车扫描(订单系统提供状态常量) WhBaseModel::commit(); $data = array("data" => array('绑定成功,该发货单不需要绑定跟踪号了!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); } else { WhBaseModel::commit(); $data = array("data" => array('绑定成功,该发货单还需要绑定' . $num . '个跟踪号!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goOkMsgPage($data); } } else { $data = array("data" => array('绑定失败,绑定的跟踪号已经够' . $result_tracking_count . '个,请扫描另外一个发货单!'), 'link' => 'index.php?mod=expressRecheck&act=trackNumberInput'); goErrMsgPage($data); exit; } } $navlist = array(array('url' => '', 'title' => '出库'), array('url' => 'index.php?mod=expressRecheck&act=ExpressList', 'title' => '快递待复核'), array('url' => '', 'title' => '快递待复核数据导入 ')); $this->smarty->assign('navlist', $navlist); $toptitle = '待复核'; // 顶部链接 $this->smarty->assign('toptitle', $toptitle); $toplevel = 2; // 顶层菜单 $this->smarty->assign('toplevel', $toplevel); $secondlevel = '28'; // 当前的二级菜单 $this->smarty->assign('secondlevel', $secondlevel); $this->smarty->assign('secnev', 3); // 二级导航 $this->smarty->assign('list', TrackInfoRecordModel::$data); $this->smarty->display('tracknumimport.htm'); }
public function view_alarmDataSubmit() { $account = isset($_POST['account']) ? trim($_POST['account']) : ''; $mode = isset($_POST['mode']) ? intval($_POST['mode']) : ''; $time = isset($_POST['pushtime']) ? trim($_POST['pushtime']) : ''; $days = isset($_POST['days']) ? $_POST['days'] : ''; // print_r($_POST);exit; if (empty($account)) { $msgdata = array('data' => array('缺少参数!'), 'link' => 'index.php?mod=localPower&act=mailPushSettingList'); goErrMsgPage($msgdata); exit; } $modeList = array(1, 2); if (!in_array($mode, $modeList)) { $msgdata = array('data' => array('错误的模式!'), 'link' => 'index.php?mod=localPower&act=mailPushSettingList'); goErrMsgPage($msgdata); exit; } $alrm_obj = new MailPushAlarmModel(); $setInt = $alrm_obj->culDaysSetting($days); // echo $setInt;exit; $data = array('mode' => $mode, 'time' => $time, 'days' => $setInt, 'account' => $account); $result = $alrm_obj->updateSettings($data); if (FALSE === $result) { $msgdata = array('data' => array(MailPushAlarmModel::$errMsg), 'link' => 'index.php?mod=localPower&act=mailPushSettingList'); goErrMsgPage($msgdata); exit; } else { $msgdata = array('data' => array('更新成功'), 'link' => 'index.php?mod=localPower&act=mailPushSettingList'); goOkMsgPage($msgdata); exit; } }
public function view_editeSubmit() { $recipient = isset($_POST['recipient']) ? trim($_POST['recipient']) : ''; //收件人 $recipient = mysql_real_escape_string($recipient); $email = isset($_POST['email']) ? trim($_POST['email']) : ''; //邮箱 $email = mysql_real_escape_string($email); $countryname = isset($_POST['countryname']) ? trim($_POST['countryname']) : ''; //国家 $countryname = mysql_real_escape_string($countryname); //echo $countryname;exit; $abbreviation = isset($_POST['abbreviation']) ? trim($_POST['abbreviation']) : ''; //国家简称 $abbreviation = mysql_real_escape_string($abbreviation); $state = isset($_POST['state']) ? trim($_POST['state']) : ''; //州/省 $state = mysql_real_escape_string($state); $city = isset($_POST['city']) ? trim($_POST['city']) : ''; //市 $city = mysql_real_escape_string($city); $street = isset($_POST['street']) ? trim($_POST['street']) : ''; //街道 $street = mysql_real_escape_string($street); $address2 = isset($_POST['address2']) ? trim($_POST['address2']) : ''; //地址二 $address2 = mysql_real_escape_string($address2); $address3 = isset($_POST['address3']) ? trim($_POST['address3']) : ''; //地址三 $address3 = mysql_real_escape_string($address3); $currency = isset($_POST['currency']) ? trim($_POST['currency']) : ''; //币种 $currency = mysql_real_escape_string($currency); $shipping = isset($_POST['shippingtype']) ? intval($_POST['shippingtype']) : 0; //运输方式id $sellaccount = isset($_POST['sellaccount']) ? trim($_POST['sellaccount']) : ''; //销售账号 $sellaccount = mysql_real_escape_string($sellaccount); //$channel = isset($_POST['channel']) ? intval($_POST['channelId']) : 0; //渠道id $calcWeight = isset($_POST['calcWeight']) ? floatval($_POST['calcWeight']) : 0; //估算重量 $calcShipping = isset($_POST['calcShipping']) ? floatval($_POST['calcShipping']) : 0; //计算运费 $actualweight = isset($_POST['actualweight']) ? floatval($_POST['actualweight']) : 0; //实际重量 $acturalfee = isset($_POST['acturalfee']) ? floatval($_POST['acturalfee']) : 0; //实际重量 $orderid = isset($_POST['orderid']) ? intval($_POST['orderid']) : 0; if ($orderid < 1) { //id不合法 $data = array('data' => '发货单号不正确!', 'link' => 'index.php?mod=dispatchBillQuery&act=showForm'); goErrMsgPage($data); exit; } $str = "\n username='******', email='{$email}', countryName='{$countryname}',countrySn='{$abbreviation}',\n state='{$state}', city='{$city}', street='{$street}', address2='{$address2}', address3='{$address3}',\n currency='{$currency}', transportId={$shipping}, account='{$sellaccount}', calcWeight='{$calcWeight}',\n calcShipping={$calcShipping}\n "; //echo $str;exit; $sod_obj = new ShipingOrderDetailModel(); $recordinfo = $sod_obj->getShippingOrderRecordsById($orderid); if (!empty($recordinfo)) { //更新记录信息 $str1 = " actualWeight={$actualweight} , actualShipping={$acturalfee}"; $ur = $sod_obj->updateRecords($str1, ' and shipOrderId=' . $orderid); if (!$ur) { //更新失败 $data = array('data' => array('更新失败!'), 'link' => 'index.php?mod=dispatchBillQuery&act=showForm'); goErrMsgPage($data); exit; } } $po_obj = new PackingOrderModel(); $upre = $po_obj->updateShipingorder($str, ' and id=' . $orderid); if ($upre) { //更新成功 $data = array('data' => array('更新成功!'), 'link' => 'index.php?mod=dispatchBillQuery&act=showForm'); goOkMsgPage($data); exit; } else { $data = array('data' => array('更新失败!'), 'link' => 'index.php?mod=dispatchBillQuery&act=showForm'); goErrMsgPage($data); exit; } }