public function before($obj = null) { // 推荐商户设置 add by t-btei 2015/05/04 $companyId = Req::args('companyId'); if (isset($companyId)) { // 保存推荐ID setcookie('company_affiliate_uid', $companyId); } //测试平板或者手机端主题 $clientType = Chips::clientType(); if ($clientType == 'tablet' || $clientType == 'mobile') { $config_path = APP_CODE_ROOT . 'config/config.php'; $config = (require $config_path); if (isset($config['themes_mobile'])) { $themes_mobile = Tiny::app()->setTheme($config['themes_mobile']); } else { Tiny::app()->setTheme("default"); } } $config = Config::getInstance(); $site = $config->get('globals'); $other = $config->get('other'); $currency_symbol = isset($other['other_currency_symbol']) ? $other['other_currency_symbol'] : '¥'; $site_logo = isset($site['site_logo']) && $site['site_logo'] != '' ? $site['site_logo'] : 'static/images/logo.png'; $site_qr = isset($site['site_qr']) && $site['site_qr'] != '' ? $site['site_qr'] : 'static/images/qr-app.png'; $site_name = isset($site['site_name']) ? $site['site_name'] : 'TinyShop商城'; $site_icp = isset($site['site_icp']) ? $site['site_icp'] : '鲁ICP备00000100号'; $obj->assign('currency_symbol', $currency_symbol); $obj->assign('site_logo', $site_logo); $obj->assign('site_qr', $site_qr); $obj->assign('site_name', $site_name); $obj->assign('site_icp', $site_icp); }
private static function sessionId() { if (self::$safeLave == 0) { return 1; } if (self::$safeLave == 1) { return md5(Chips::getIP()); } if (self::$safeLave == 2) { return md5(Chips::getIP() . $_SERVER["HTTP_USER_AGENT"]); } }
public function packData($payment) { $config_path = APP_CODE_ROOT . 'config/config.php'; $config = (require $config_path); $return = array(); //基本参数 $return['partner'] = $return['seller_id'] = $payment['M_PartnerId']; $return['_input_charset'] = 'utf-8'; $return['payment_type'] = 1; $return['return_url'] = $this->callbackUrl; $return['notify_url'] = $this->asyncCallbackUrl; //业务参数 $return['enable_paymethod'] = 'directPay^bankPay'; $return['subject'] = $payment['M_Name']; $return['out_trade_no'] = $payment['M_OrderNO']; $return['price'] = number_format($payment['M_Amount'], 2, '.', ''); $return['quantity'] = 1; $return['logistics_fee'] = "0.00"; $return['logistics_type'] = "EXPRESS"; $return['logistics_payment'] = "SELLER_PAY"; if (isset($payment['P_Name'])) { $return['receive_name'] = $payment['P_Name']; $return['receive_address'] = $payment['P_Address']; $return['receive_zip'] = $payment['P_PostCode']; if (!empty($payment['P_Telephone'])) { $return['receive_phone'] = $payment['P_Telephone']; } if (!empty($payment['P_Mobile'])) { $return['receive_mobile'] = $payment['P_Mobile']; } } $return['currency'] = 'JPY'; $clientType = Chips::clientType(); if ($clientType == 'tablet' || $clientType == 'mobile') { $return['service'] = 'create_forex_trade_wap'; } else { $return['service'] = 'create_forex_trade'; } $return['rmb_fee'] = number_format($payment['M_Amount'], 2, '.', ''); /*** ---------------------------海关参数 start-------------------------***/ /*** 以下部分,是根据用户地址选择海关,目前业务不需要,因此以下代码仅仅作为今后维护参考用***/ // $model = new Model("order"); // $order = $model->where('order_no = '.$payment['M_OrderNO'].'')->find(); // //取得省份代码 // $provinceCode = $order['province']; // //取得城市代码 // $cityCode = $order['city']; // // //取得省份名称 // $model2 = new Model("area"); // $area = $model2->where('id = '.$provinceCode.'')->find(); // $provinceName = $area['name']; // // //如果是直辖市,则直接默认为城市名称 // if($provinceName == '北京市'|| $provinceName == '上海市'|| $provinceName == '天津市'||$provinceName == '重庆市'){ // $cityName = $provinceName; // $merchant_customs_code = $area['customs_code']; // // } else { // $area = $model2->where('id = '.$cityCode.'')->find(); // $cityName = $area['name']; // $merchant_customs_code = $area['customs_code']; // } // // //城市名称转拼音 // $pingying = new GetPingYing(); // $customs_place =$pingying->get_pinyin($cityName); // if (strpos($customs_place,'shishi')) { // str_replace('shishi','shi',$customs_place); // } else { // $customs_place = rtrim($customs_place, 'shi'); // } /*** ---------------------------海关参数 end-------------------------***/ //目前业务需要,只有杭州海关,所以写死 //-------------start---------- $customs_place = 'HangZhou'; $merchant_customs_code = '3302462005'; //-------------end------------- //海关对接参数 $return['ext_params'] = 'customs_place|' . $customs_place . '#merchant_customs_code|' . $merchant_customs_code; //除去待签名参数数组中的空值和签名参数 $filter_param = $this->filterParam($return); //对待签名参数数组排序 $para_sort = $this->argSort($filter_param); //生成签名结果 $mysign = $this->buildSign($para_sort, $payment['M_PartnerKey']); //签名结果与签名方式加入请求提交参数组中 $return['sign'] = $mysign; $return['sign_type'] = 'MD5'; return $return; }
/** * 登录验证动作 * * @access public */ public function check() { $this->safebox = Safebox::getInstance(); $this->title = '后台登录'; $code = $this->safebox->get($this->captchaKey); if ($code != strtolower(Req::args($this->captchaKey))) { $this->msg = '验证码错误!'; $this->layout = ""; $this->redirect('login', false); } else { $manager = new Manager(Req::args('name'), Req::args('password')); $this->msg = '验证码错误!'; if ($manager->getStatus() == 'online') { $back = Req::args('callback'); $model = new Model("manager"); $ip = Chips::getIP(); $model->data(array('last_ip' => $ip, 'last_login' => date("Y-m-d H:i:s")))->where("id=" . $manager->id)->update(); if ($back === null) { $back = $this->defaultAction; } $this->redirect($back, true); } else { $this->msg = '用户名或者密码错误'; $this->layout = ""; $this->redirect('login', false); } } }
public static function op($manager_id, $action, $content) { $logs = array('manager_id' => $manager_id, 'action' => $action, 'content' => $content, 'ip' => Chips::getIP(), 'url' => Url::requestUri(), 'time' => date('Y-m-d H:i:s')); $model = new Model('log_operation'); $model->data($logs)->insert(); }