Exemple #1
0
 /**
  * Static method get
  *
  * @param  array $group
  * @return \helpers\database
  */
 public static function get($group = null)
 {
     // Determining if exists or it's not empty, then use default group defined in config
     $group = !$group ? array('type' => DB_TYPE, 'host' => DB_HOST, 'name' => DB_NAME, 'user' => DB_USER, 'pass' => DB_PASS, 'port' => DB_PORT) : $group;
     // Group information
     $type = $group['type'];
     $host = $group['host'];
     $name = $group['name'];
     $user = $group['user'];
     $pass = $group['pass'];
     $port = $group['port'];
     // ID for database based on the group information
     $id = "{$type}.{$host}.{$port}.{$name}.{$user}.{$pass}";
     // Checking if the same
     if (isset(self::$instances[$id])) {
         return self::$instances[$id];
     }
     try {
         // I've run into problem where
         // SET NAMES "UTF8" not working on some hostings.
         // Specifiying charset in DSN fixes the charset problem perfectly!
         $instance = new Database("{$type}:host={$host};port={$port};dbname={$name};charset=utf8", $user, $pass);
         $instance->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         // Setting Database into $instances to avoid duplication
         self::$instances[$id] = $instance;
         return $instance;
     } catch (PDOException $e) {
         //in the event of an error record the error to ErrorLog.html
         Logger::newMessage($e);
         Logger::customErrorMsg();
     }
 }
Exemple #2
0
    public function main() {
        if (\helper\StringHelper::isNull($this->callback)) {
            throw new \Exception('Callback is required');
        }

        if (!isset($_POST['exec'])) {
            $curl = curl_init();

            curl_setopt($curl, CURLOPT_URL, 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']);
            curl_setopt($curl, CURLOPT_POST, 1);
            curl_setopt($curl, CURLOPT_POSTFIELDS, array('exec' => 'true'));
            curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

            $result = trim(curl_exec($curl));

            echo $result;

            curl_close($curl);

        } else {
            \core\Logger::info('start');

            \helper\ReflectionHelper::getMethodResultFromInstance($this, $this->callback);

            \core\Logger::info('stop');
        }
    }
Exemple #3
0
 /**
  * 调用Dc接口锁定/解锁域名
  * @param string $domain
  * @param int $status 
  * @return true:操作成功 array(false,'错误原因')
  */
 public function lockDomain($domain, $status)
 {
     $resultMsg = array('322002' => '提示用户域名在临时模板下不能交易', '322020' => '非白名单模板域名不能交易');
     $rs = self::getDcObj('domain/setdomainmystatus')->getPostData(array('domain' => $domain, 'status' => $status));
     if ($rs['msg']['result'] !== true) {
         \core\Logger::write("DOMAIN_LOG", array(__METHOD__, '域名 ' . $domain . ' 设置状态为 ' . $status . ' 失败,msg信息为:' . $rs['msg']['msg']));
         $code = $rs['msg']['code'];
         if (isset($resultMsg[$code])) {
             return array(false, $resultMsg[$code]);
         } else {
             return array(false, '系统错误,请联系客服处理');
         }
     }
     return true;
 }
Exemple #4
0
 /**
  * 判断一口价交易卖家是否违约
  */
 public function IndexAction()
 {
     $limit = 100;
     $condition = array('t_status' => 4, 't_end_time <' => time());
     $transResult = new \NewTransResultModel();
     $data = $transResult->getListByWhere($condition, '0,100', '*');
     $domains = new \common\Domain();
     foreach ($data as $v) {
         $transId = $v['t_id'];
         // 判断域名是否在卖家ID下
         $result = $domains->checkDnInUser($v['t_enameId'], $v['t_dn']);
         // 如果如果存在 则执行“一口价交易流程”
         if ($result) {
             $lock = $domains->lockDomain($v['t_dn'], 2);
             // 设置成交易状态
             if (!$lock) {
                 Logger::write('buynowtask_index', 'lock domain false ' . $v['t_id'] . '-' . $v['t_dn'] . '--' . $lock[1]);
                 continue;
             }
             $finance = new \finance\Orders($v['t_enameId']);
             if (!$finance->cancelOrder($v['t_seller_order'])) {
                 Logger::write('buynowtask_index', 'cancel order false .' . $v['t_seller_order']);
             }
             //PUSH域名
             $domains->PushDomain($v['t_enameId'], $v['t_buyer'], $v['t_dn']);
             //确认订单 扣掉买家的钱给卖家
             unset($finance);
             $finance = new \finance\Orders($v['t_buyer']);
             $finance->confirmOrder($v['t_order_id'], $v['t_money_type'], $v['t_enameId']);
             //更新关注表
             $transLogic = new \TransLogic();
             $transLogic->updateWatchInfo($v['t_id'], $v['t_now_price']);
             $messageObj = new \common\Message();
             //通知卖家
             $sms = (new \common\Users())->noticeSellerIsOk($v['t_enameId'], 'T204');
             $messageObj->sendBuyNowSeller($v['t_enameId'], $v['t_dn'], $v['t_now_price'], $v['t_id'], $sms);
             //通知买家
             $messageObj->sendBuyNowBuyer($v['t_buyer'], $v['t_dn'], $v['t_now_price'], $v['t_id']);
         } else {
             Logger::write('buynowtask_index', 'lock domain false not at user id ' . $v['t_id'] . '-' . $v['t_dn']);
             $trans = new \trans\Weiyue();
             $trans->main($v);
         }
     }
 }
 /**
  * Saves the new settings and calls the render
  *
  * @param array $args
  *            Array containing the request
  */
 public function save(array $args)
 {
     /* Save the settings */
     if (isset($_REQUEST['language'])) {
         $settings['lang'] = $_REQUEST['language'];
     } else {
         $settings['lang'] = \Core\Config::$DEFAULT_LANG;
     }
     if (isset($_REQUEST['theme'])) {
         $settings['theme'] = $_REQUEST['theme'];
     } else {
         $settings['theme'] = \Core\Config::$DEFAULT_CSS_THEME;
     }
     /* REMOTE_SERVER_IP must have http:// at the start of the string */
     if (isset($_REQUEST['serverIp'])) {
         $prefix = 'http://';
         $settings['serverIp'] = $_REQUEST['serverIp'];
         if (!(substr($settings['serverIp'], 0, strlen($prefix)) === $prefix)) {
             $settings['serverIp'] = $prefix . $settings['serverIp'];
         }
     } else {
         $settings['serverIp'] = \Core\Config::$REMOTE_SERVER_IP;
     }
     /* Cache string for the latest change in generated javascripts */
     $settings['cacheTime'] = time();
     $ctrl = $this->model->saveSettings($settings);
     /* Loads the new settings */
     \Core\Config::dynamicLoad();
     /* Reloads the model and renders the page */
     $this->model = new settingsModel();
     $this->view = new settingsView($this->model);
     $this->view->render();
     /* Renders the notification */
     if ($ctrl === TRUE) {
         $this->view->renderNotification(_('Settings saved successfully'), 'success');
     } else {
         $this->view->renderNotification(_('Error saving settings'), 'danger');
         \Core\Logger::logWarning('Failed to save settings');
     }
 }
 /**
  * [fixedBuy description]
  * @param  int $uId 买家id
  * @param  bool $isUseNickName 买家是否选择使用昵称
  * @param  array $transIds  交易id
  * @param string $buyerIp 买家ip
  * @return  array('accessTrans' => $accessTrans, 'denyTrans' => $denyTrans);
  */
 public function fixedBuy($uId, $transIds, $isUseNickName = false, $buyerIp = '')
 {
     try {
         $goServ = new \core\driver\GoServer();
         $config = \core\Config::item('fixedBuy');
         // 以下步骤使用goServer并行处理
         //
         // step 调用logic方法,一次判断下面step1,step2,step3返回结果
         // step1 获取该交易id的信息,不存在则该交易结束
         // step2 判断交易里买家和卖家是否同一个
         // step3 判断交易里的当前价格和提交上来的价格是否一致
         $accessTrans = $denyTrans = array();
         foreach ($transIds as $transId => $curId) {
             $goServ->call($transId, 'TransLogic::checkTransInfo', array($transId, $uId, $curId));
         }
         $res = $goServ->send();
         foreach ($res as $transId => $value) {
             $rs = $value['TransLogic::checkTransInfo'];
             if (isset($rs['goError']) || !$rs['flag']) {
                 $denyTrans[$transId] = isset($rs['goError']) ? $config->systemError : $rs['msg'];
             } else {
                 $accessTrans[$transId] = $rs['msg'];
             }
         }
         if (empty($accessTrans)) {
             return array('accessTrans' => $accessTrans, 'denyTrans' => $denyTrans);
         }
         // step4 创建冻结订单
         foreach ($accessTrans as $transId => $info) {
             $goServ->call($transId, 'TransLogic::freezeMoney', array($info['t_dn'], $uId, $info['t_now_price']));
         }
         $res = $goServ->send();
         foreach ($res as $transId => $value) {
             $rs = $value['TransLogic::freezeMoney'];
             if (isset($rs['goError']) || !$rs) {
                 $denyTrans[$transId] = isset($rs['goError']) ? $config->systemError : $config->invalidBalance;
                 unset($accessTrans[$transId]);
             } else {
                 // 冻结成功,记录财务订单id
                 $info['financeId'] = $rs;
                 $accessTrans[$transId] = $info;
             }
         }
         if (empty($accessTrans)) {
             return array('accessTrans' => $accessTrans, 'denyTrans' => $denyTrans);
         }
         // step5 根据交易里的我司和非我司标志更新交易记录状态,我司域名状态直接更新为14,非我司更新为等待卖家确认
         //       同时非我司的交易记录要更新买家违约时间和卖家违约时间
         //       若step5失败,则发起解冻step4里面的冻结订单
         $buyerIp = $buyerIp ?: \common\Client::getIp();
         foreach ($accessTrans as $transId => $info) {
             $buyerNick = $isUseNickName ? \common\common::getNickname($uId, $transId) : false;
             $goServ->call($transId, 'TransLogic::updateTransInfo', array($transId, $info['t_type'], $info['t_is_our'], $uId, $buyerNick, $buyerIp, $info['financeId']));
             $accessTrans[$transId]['buyerNick'] = $buyerNick;
         }
         $res = $goServ->send();
         foreach ($res as $transId => $value) {
             $rs = $value['TransLogic::updateTransInfo'];
             $info = $accessTrans[$transId];
             if (isset($rs['goError']) || !$rs) {
                 // 更新信息失败,解冻订单
                 $goServ->call($transId, 'TransLogic::unfreezeMoney', array($info['t_enameId'], $info['financeId']));
                 $denyTrans[$transId] = isset($rs['goError']) ? $config->systemError : $config->updateFailed;
                 unset($accessTrans[$transId]);
             } else {
                 // step6 我司域名 使用go 异步并行处理下面多个流程
                 //      调用logic里面的asyncDeal处理下面步骤
                 //      1、调用接口解锁和Push域名
                 //      2、调用接口确认冻结财务订单
                 //      3、将该交易记录插入到new_trans_history表
                 //      4、写入待评价表
                 //      5、更新其他用户关注表的交易结束时间,买家信息
                 //      6、发送通知买家邮件和站内信
                 //      7、根据卖家设置,通知卖家
                 //
                 // step6: 非我司域名 使用go异步并行处理下面多个流程
                 //      调用logic里面的asyncDeal处理下面步骤
                 //      1、发送通知邮件、发送站内信、短信通知卖家
                 //      4、复制该交易id的记录到new_trans_result表
                 $goServ->call($transId, 'TransLogic::asyncDeal', array($info));
             }
         }
         $goServ->asyncSend();
         return array('accessTrans' => array_keys($accessTrans), 'denyTrans' => $denyTrans);
     } catch (\Exception $e) {
         \core\Logger::write('FixedbuyController.log', array('出现异常', $e->getMessage(), $e->getFile(), $e->getLine()));
         return false;
     }
 }
Exemple #7
0
 /**
  * 复制非我司域名的交易信息到new_trans_result表,状态需要修改
  * @param $transInfo array [交易信息]
  * @param $status int [修改交易状态]
  * @param $finishTime int [交易完成时间]
  * @return int|boolean [lastid or false]
  */
 public function copyToResult($transInfo, $status, $finishTime = false)
 {
     $transInfo['t_status'] = $status;
     $transInfo['t_last_time'] = $transInfo['t_complate_time'] = !$finishTime ? $_SERVER['REQUEST_TIME'] : $finishTime;
     $resModel = new NewTransResultModel();
     $res = $resModel->setTransResult($transInfo);
     if (!$res) {
         \core\Logger::write("domain.log", array(__METHOD__, "域名{$domain}插入到交易结果表new_trans_result失败,发布时间:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME'])));
     }
     return $res;
 }
Exemple #8
0
 public function Send($params = [])
 {
     $s = $this->initCurl($params["url"]);
     logger::info("Connect to: " . $params["url"]);
     $this->response = curl_exec($s);
     logger::info("Response: " . $this->response);
     if (curl_errno($s) == CURLE_COULDNT_CONNECT) {
         throw new \Exception('Couldnt connect.');
     }
     $status = curl_getinfo($s, CURLINFO_HTTP_CODE);
     $last_url = parse_url(curl_getinfo($s, CURLINFO_EFFECTIVE_URL));
     $err = curl_error($s);
     curl_close($s);
 }
Exemple #9
0
 /**
  * 交易发布
  *
  * @param s $uId
  *        	int
  * @param s $domains
  *        	array 包含我司和非我司域名的二维数组,一个域名包含价格和简介以及出售周期
  * @param s $cashType
  *        	int 提现类型,在控制器检查,2 不可提现 3 可体现
  * @param s $type
  *        	发布类型
  * @param s $ip
  *        	用户ip
  */
 public function fixedPrice($uId, $domains, $cashType, $type, $ip)
 {
     try {
         $redis = core\driver\Redis::getInstance('default');
         $domains = array_merge($domains['domainEname'], $domains['domainNoEname']);
         $succDomains = $failDomains = $verifyDomains = array();
         // step1:检测域名后缀
         $res = $this->checkDomainTld(array_keys($domains));
         $succDomains = $res[0];
         $failDomains = array_merge($failDomains, $res[1], $res[2]);
         if (empty($succDomains)) {
             return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
         }
         if (in_array($type, array(\core\Config::item('transType')->zhuantipaimai, \core\Config::item('transType')->yipaiyimai))) {
             //专题拍卖和易卖易卖是否需要审核
             foreach ($succDomains as $v) {
                 $this->goSer->call($v, 'DomainLogic::checkOtherTrans', array($v, $type));
             }
             $res = $this->goSer->send();
             $succDomains = array();
             foreach ($res as $k => $v) {
                 $v = $v['DomainLogic::checkOtherTrans'];
                 if (isset($v['goError'])) {
                     $failDomains[$k] = '系统繁忙,请重试';
                 } else {
                     if ($v === 1) {
                         $succDomains[] = $k;
                     } elseif ($v === 3) {
                         $verifyDomains[$k] = 1;
                     } else {
                         $failDomains[$k] = '不符合专题拍卖条件';
                     }
                 }
             }
             if (empty($succDomains)) {
                 return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
             }
             if (in_array($type, array(4, 5))) {
                 //专题拍卖和易卖易卖是否需要审核
                 foreach ($succDomains as $v) {
                     $this->goSer->call($v, 'DomainLogic::checkOtherTrans', array($v, $type));
                 }
                 $res = $this->goSer->send();
                 $succDomains = array();
                 foreach ($res as $k => $v) {
                     $v = $v['DomainLogic::checkOtherTrans'];
                     if (isset($v['goError'])) {
                         $failDomains[$k] = '系统繁忙,请重试';
                     } else {
                         if ($v === 1) {
                             $succDomains[] = $k;
                         } elseif ($v === 3) {
                             $verifyDomains[$k] = 1;
                         } else {
                             $failDomains[$k] = '不符合专题拍卖条件';
                         }
                     }
                 }
                 if (empty($succDomains)) {
                     return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
                 }
                 //专题是否存在
                 foreach ($succDomains as $v) {
                     $this->goSer->call($v, 'DomainLogic::checkTopId', array($domains[$v]['topic']));
                 }
                 $res = $this->goSer->send();
                 $succDomains = array();
                 foreach ($res as $k => $v) {
                     $v = $v['DomainLogic::checkTopId'];
                     if (isset($v['goError'])) {
                         $failDomains[$k] = '系统繁忙,请重试';
                     } else {
                         if ($v === true) {
                             $succDomains[] = $k;
                         } else {
                             $failDomains[$k] = '专题不存在';
                         }
                     }
                 }
                 if (empty($succDomains)) {
                     return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
                 }
             }
         }
         // step2:检测域名简介是否包含关键词
         // 检测出售天数,价格
         // 使用go并行处理
         foreach ($succDomains as $v) {
             $this->goSer->call($v, 'DomainLogic::checkBaseInfo', array($domains[$v], $type));
         }
         $res = $this->goSer->send();
         $succDomains = array();
         foreach ($res as $k => $v) {
             $v = $v['DomainLogic::checkBaseInfo'];
             if (isset($v['goError'])) {
                 $failDomains[$k] = '系统繁忙,请重试';
             } else {
                 if ($v['flag'] === true) {
                     $succDomains[] = $k;
                 } else {
                     $failDomains[$k] = $v['msg'];
                 }
             }
         }
         if (empty($succDomains)) {
             return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
         }
         // step3:存在我司域名调用判断我司域名是否可发布
         // 非我司域名判断是否$domains里面有非我司域名,有的话从redis中取出
         // 上一步缓存的已经认证过的域名,排除$domains里面非我司域名那个数组
         // 里面不在缓存中得域名
         // 通过go并行调用返回数据
         foreach ($succDomains as $v) {
             $this->goSer->call($v, 'DomainLogic::checkMyDomain', array($uId, $v));
         }
         $res = $this->goSer->send();
         $enameDomains = $notInEnameDomains = array();
         foreach ($res as $k => $v) {
             $v = $v['DomainLogic::checkMyDomain'];
             if (isset($v['goError'])) {
                 $failDomains[$k] = '系统繁忙,请重试';
             } else {
                 $inEname = $v['flag'];
                 if ($inEname == 1) {
                     $enameDomains[$k] = $v['msg'];
                     $domains[$k]['expireTime'] = strtotime($v['msg']['expireTime']);
                     $domains[$k]['isOur'] = 1;
                 } elseif ($inEname == 2) {
                     $whois = $redis->get('whois:' . $uId . $k);
                     if ($whois) {
                         $notInEnameDomains[] = $k;
                         $domains[$k]['expireTime'] = strtotime($whois);
                         $domains[$k]['isOur'] = 2;
                     } else {
                         $failDomains[$k] = '非我司域名认证失败';
                     }
                 } else {
                     $failDomains[$k] = $v['msg'];
                 }
                 if (isset($domains[$k]['expireTime'])) {
                     $minute = rand(0, 59);
                     $domains[$k]['endTime'] = strtotime(date('Y-m-d', time() + 86400 * $domains[$k]['day']) . ' ' . $domains[$k]['hour'] . ':' . $minute . ':00');
                     if ($domains[$k]['endTime'] > $domains[$k]['expireTime']) {
                         $domains[$k]['endTime'] = $domains[$k]['expireTime'];
                         $domains[$k]['endTimeChange'] = true;
                     }
                 }
             }
         }
         if (empty($enameDomains) && empty($notInEnameDomains)) {
             return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
         }
         // 我司域名检测 状态 注册时间和 过期时间
         $succComDomains = array();
         if (!empty($enameDomains)) {
             $res = $this->comCheck($uId, $enameDomains, $type);
             $succComDomains = $res[0];
             $failDomains = array_merge($failDomains, $res[1]);
         }
         // 非我我司域名检测 tld 和 是否在黑名单
         $succNonComDomains = array();
         if (!empty($notInEnameDomains)) {
             $res = $this->nonComCheck($uId, $notInEnameDomains);
             $succNonComDomains = $res[0];
             $failDomains = array_merge($failDomains, $res[1]);
         }
         if (empty($succComDomains) && empty($succNonComDomains)) {
             return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
         }
         // step4:域名检测是否在交易中
         $succComTranDomains = array();
         if (!empty($succComDomains)) {
             $res = $this->isDomainTrans($succComDomains, $type);
             $succComTranDomains = $res[0];
             $failDomains = array_merge($failDomains, $res[1]);
         }
         $succNonComTranDomains = array();
         if (!empty($succNonComDomains)) {
             $res = $this->isDomainTrans($succNonComDomains, $type);
             $succNonComTranDomains = $res[0];
             $failDomains = array_merge($failDomains, $res[1]);
         }
         if (empty($succComTranDomains) && empty($succNonComTranDomains)) {
             return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
         }
         $succLockDomains = array();
         $succFreezeDomains = array();
         // step6:对于可发布的我司域名和非我司域名
         // 处理我司域名锁定
         if (!empty($succComTranDomains)) {
             foreach ($succComTranDomains as $k => $v) {
                 $this->goSer->call($k, 'DomainLogic::lockDomain', array($k));
             }
             $res = $this->goSer->send();
             foreach ($res as $k => $v) {
                 $v = $v['DomainLogic::lockDomain'];
                 if (isset($v['goError'])) {
                     $failDomains[$k] = '系统繁忙,请重试';
                 } else {
                     $domains[$k]['orderId'] = 0;
                     if ($v) {
                         $succLockDomains[$k] = 1;
                     } else {
                         $failDomains[$k] = '域名锁定失败';
                     }
                 }
             }
         }
         //非我司域名冻结保证金
         if (!empty($succNonComTranDomains)) {
             foreach ($succNonComTranDomains as $k => $v) {
                 $this->goSer->call($k, 'DomainLogic::freezeMoney', array($uId, $k, \core\Config::item('baozhengjin')->fabu));
             }
             $res = $this->goSer->send();
             foreach ($res as $k => $v) {
                 $v = $v['DomainLogic::freezeMoney'];
                 if (isset($v['goError'])) {
                     $failDomains[$k] = '系统繁忙,请重试';
                 } else {
                     if ($v) {
                         $domains[$k]['orderId'] = $v;
                         $succFreezeDomains[$k] = 1;
                     } else {
                         $failDomains[$k] = '保证金冻结失败';
                     }
                 }
             }
         }
         // step5:从step3和step4里面合并获取可发布的我司域名和非我司域名
         // 调用go去并行处理我司和非我司的可发布情况返回来
         $succDomains = array_merge($succFreezeDomains, $succLockDomains);
         if (empty($succDomains)) {
             return array('flag' => TRUE, 'msg' => array('succ' => array(), 'fail' => $failDomains));
         }
         // 从redis里面获取域名是否推荐数据进行标识
         // 同时将推荐域名推到redis中做bbs推荐
         // 调用go并发处理
         foreach ($succDomains as $k => $v) {
             $promote = $redis->exists('promote:' . $uId . $k);
             if ($promote) {
                 $domains[$k]['isHot'] = 1;
                 $bbs = $redis->lRange('bbs:domain', 0, -1);
                 if (!in_array($uId, $bbs)) {
                     $redis->lPush('bbs:domain', $uId);
                 }
             } else {
                 $domains[$k]['isHot'] = 0;
             }
         }
         // step7:将域名写入交易表
         // 调用go并行处理
         foreach ($succDomains as $k => $v) {
             $this->goSer->call($k, 'DomainLogic::publicDomain', array($uId, $k, $domains[$k]['description'], $domains[$k]['expireTime'], $type, $domains[$k]['price'], $domains[$k]['endTime'], $cashType, $domains[$k]['isOur'], $domains[$k]['isHot'], $ip, $domains[$k]['orderId']));
         }
         $res = $this->goSer->send();
         $succInsertDomains = array();
         foreach ($res as $k => $v) {
             $v = $v['DomainLogic::publicDomain'];
             if (isset($v['goError'])) {
                 $failDomains[$k] = '系统繁忙,请重试';
             } else {
                 if ($v) {
                     $succInsertDomains[$k] = isset($domains[$k]['endTimeChange']) ? $domains[$k]['endTime'] : 0;
                 } else {
                     $failDomains[$k] = '写入交易表失败';
                 }
             }
         }
         $msg = array('succ' => $succInsertDomains, 'fail' => $failDomains);
         //加入审核表
         $succVerifyDomains = array();
         if ($verifyDomains) {
             foreach ($verifyDomains as $k => $v) {
                 $this->goSer->call($k, 'DomainLogic::publicToCheck', array($uId, $k, $domains[$k]['description'], $domains[$k]['expireTime'], $type, $domains[$k]['price'], $domains[$k]['endTime'], $cashType, $domains[$k]['isOur'], $domains[$k]['isHot'], $ip, $domains[$k]['topic'], $domains[$k]['orderId']));
             }
             $res = $this->goSer->send();
             foreach ($res as $k => $v) {
                 $v = $v['DomainLogic::publicToCheck'];
                 if (isset($v['goError'])) {
                     $failDomains[$k] = '系统繁忙,请重试';
                 } else {
                     if ($v) {
                         $succVerifyDomains[$k] = isset($domains[$k]['endTimeChange']) ? $domains[$k]['endTime'] : 0;
                     } else {
                         $failDomains[$k] = '写入审核表失败';
                     }
                 }
             }
         }
         $msg = array('succ' => $succInsertDomains, 'fail' => $failDomains, 'verify' => $succVerifyDomains);
         return array('flag' => TRUE, 'msg' => $msg);
     } catch (\Exception $e) {
         \core\Logger::write('FABU', array('出现异常', $e->getMessage(), $e->getFile(), $e->getLine()));
         return array('flag' => FALSE, 'msg' => $e->getMessage());
     }
 }
Exemple #10
0
 private function handleException(\Exception $e) {
     $content = array(BasePresentation::EXCEPTION_VALIDATION => $e->getMessage());
     if ($e instanceof \core\exception\MappingNotFoundException) {
         \core\Logger::warning($e);
         $this->renderPage(Config::ERROR_PAGE_404, null, $content);
     } else {
         \core\Logger::error($e);
         $this->renderPage(Config::ERROR_PAGE_500, null, $content);
     }
 }
Exemple #11
0
 /**
  * 发布域名到审核表
  * @params $domain string 域名
  * @params $type int 交易类型
  *
  */
 public function publicToCheck($uId, $domain, $desc, $expireTime, $type, $price, $endTime, $moneyType, $isOur, $isHot, $ip, $topic, $orderId = false, $startTime = false)
 {
     $domainInfo = new \common\Common();
     $body = $domainInfo->getDomainBody($domain);
     $domainClass = \common\domain\Domain::getDomainClass($domain);
     $data = array('t_dn' => $domain, 't_body' => $domainClass[4], 't_type' => $type, 't_topic' => $topic, 't_enameid' => $uId, 't_start_price' => $price, 't_now_price' => $price, 't_create_time' => $_SERVER['REQUEST_TIME'], 't_start_time' => $startTime ? $startTime : $_SERVER['REQUEST_TIME'], 't_end_time' => $endTime, 't_tld' => $domainInfo->getTldType($domain), 't_len' => $domainClass[3], 't_desc' => $desc, 't_money_type' => $moneyType, 't_ip' => $ip, 't_is_our' => $isOur, 't_exp_time' => $expireTime, 't_hot' => $isHot, 't_class_name' => $domainClass[0], 't_two_class' => !$domainClass[1] ? 0 : $domainClass[1], 't_three_class' => !$domainClass[2] ? 0 : $domainClass[2]);
     $verifyModel = new NewTaoVerifyModel();
     $res = $verifyModel->insertVerify($data);
     if (!$res) {
         \core\Logger::write("domain.log", array(__METHOD__, "域名{$domain}发布插入到审核表new_tao_verify失败,用户id:{" . $uId . "},发布时间:" . date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME'])));
     }
     return $res;
 }
Exemple #12
0
    \Core\Logger::logProxy('[Code: 404][Method: ' . $_SERVER['REQUEST_METHOD'] . '][URL: Not Set]');
    return;
}
/* Request options */
$opts = array('http' => array('method' => $_SERVER['REQUEST_METHOD'], 'timeout' => -1, 'ignore_errors' => true));
/* Timestamp */
$headers = getallheaders();
if (isset($headers['timestamp'])) {
    $opts['http']['header'] = 'timestamp: ' . $headers['timestamp'];
}
$context = stream_context_create($opts);
/* Optimization */
session_write_close();
/* Enconde whitespaces */
$request_url = str_replace(' ', '%20', $_REQUEST[PROXY_ID]);
/* Call the FPGA Web Service */
$result = file_get_contents(\Core\Config::$REMOTE_SERVER_IP . $request_url, false, $context);
/* Output the content */
if (!isset($http_response_header)) {
    header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found', true, 404);
    header('Status: 404 Not Found');
    $_SERVER['REDIRECT_STATUS'] = 404;
    /* Log the call */
    \Core\Logger::logProxy('[Code: 404][Method: ' . $_SERVER['REQUEST_METHOD'] . '][URL: ' . $_REQUEST[PROXY_ID] . ']');
    return;
}
header($http_response_header[0]);
echo $result;
/* Log the call */
\Core\Logger::logProxy('[Code: ' . $http_response_header[0] . '][Method: ' . $_SERVER['REQUEST_METHOD'] . '][URL: ' . $_REQUEST[PROXY_ID] . ']');