Exemplo n.º 1
0
 function getTrafficGB()
 {
     $mt = $this->getMonthTraffic();
     $mt = Comm::toGB($mt);
     $mt = round($mt, 3);
     return $mt;
 }
Exemplo n.º 2
0
Arquivo: Api.php Projeto: hihus/newpi
 protected function _checkInnerApi()
 {
     $sign = Pi::get('global.innerapi_sign', '');
     $sign_name = Pi::get('global.innerapi_sign_name', '_pi_inner_nm');
     if (Comm::req($sign_name) == $sign) {
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
Arquivo: Api.php Projeto: hihus/pi
 protected function checkInnerApi()
 {
     $sign_name = Pi::get('global.innerapi_sign_name', '_pi_inner_nm');
     $sign = Comm::req($sign_name, null);
     $mod = Comm::req('mod', null);
     if (!is_null($sign) && PiRPC::checkSign($mod, $sign)) {
         return true;
     }
     return false;
 }
Exemplo n.º 4
0
 /**
  * Overriding no route action to check for CMS pages.
  *
  * @return Bengine_Comm_Controller_Index
  */
 protected function norouteAction()
 {
     if ($row = Comm::getCMS()->getPage($this->_action)) {
         Hook::event("ShowCMSPage", array(&$row));
         $this->assign("page", $row["title"]);
         $this->assign("content", $row["content"]);
         $this->setTemplate("cms_page");
     } else {
         parent::norouteAction();
     }
     return $this;
 }
Exemplo n.º 5
0
 public function dispatch()
 {
     if (!$this->checkSign()) {
         $this->output('api.err sign', 7099);
     }
     $mod_name = Pcf::get("global.mod", 'mod');
     $func_name = Pcf::get("global.func", 'func');
     $mod_seg = Pcf::get("global.mod_seg", '/');
     $api_path = Pcf::get("global.base_path", PI_APP_ROOT . PI_APP_NAME . DOT . 'logic' . DOT);
     $mod = Comm::Req($mod_name);
     $func = Comm::Req($func_name);
     $mod = explode($mod_seg, $mod);
     $pattern = '/^[0-9a-zA-Z\\/]*$/';
     $class = '';
     if (!empty($mod)) {
         foreach ($mod as $k => $m) {
             if (empty($m) || !is_string($m)) {
                 if (!preg_match($pattern, $m)) {
                     $this->output('api.err error format mod:' . $m, 1005);
                 }
                 unset($mod[$k]);
             }
             $mod[$k] = strtolower($m);
             $class .= ucfirst($mod[$k]);
         }
     }
     if (empty($mod)) {
         $this->output('api.err empty api mod:' . $mod, 1006);
     }
     if (empty($func) || !is_string($func) || !preg_match($pattern, $func)) {
         $this->output('api.err empty or error api func:' . $func, 1007);
     }
     Pi::inc(PI_CORE . 'BaseApi.php');
     $file = $api_path . implode(DOT, $mod) . DOT . $class . '.api.php';
     if (!Pi::inc($file)) {
         $this->output('api.err api router can not load file:' . $file, 1008);
     }
     if (!class_exists($class)) {
         $this->output('api.err api router not find class:' . $class, 1009);
     }
     $cls = new $class();
     if (!is_subclass_of($cls, 'PiBaseApi')) {
         $this->output('api.err is not the subclass of BaseApi', 1010);
     }
     if (!is_callable(array($cls, $func))) {
         $this->output('api.err api class:' . $class . ' can not call method:' . $func, 1011);
     }
     $res = Pi::piCallMethod($cls, $func);
     return $res;
 }
Exemplo n.º 6
0
 public function dispatch()
 {
     $mod_name = Conf::get("global.mod", 'mod');
     $func_name = Conf::get("global.func", 'func');
     $mod_seg = Conf::get("global.mod_seg", '/');
     $api_path = Conf::get("global.base_path", APP_ROOT . APP_NAME . DOT . 'logic' . DOT);
     $mod = Comm::Req($mod_name);
     $func = Comm::Req($func_name);
     $mod = explode($mod_seg, $mod);
     $pattern = '/^[0-9a-zA-Z\\/]*$/';
     $class = '';
     if (!empty($mod)) {
         foreach ($mod as $k => $m) {
             if (empty($m) || !is_string($m)) {
                 if (!preg_match($pattern, $m)) {
                     throw new Exception('error format mod:' . $m, 1005);
                 }
                 unset($mod[$k]);
             }
             $mod[$k] = strtolower($m);
             $class .= ucfirst($mod[$k]);
         }
     }
     if (empty($mod)) {
         throw new Exception('empty api mod:' . $mod, 1006);
     }
     if (empty($func) || !is_string($func) || !preg_match($pattern, $func)) {
         throw new Exception("empty api func:" . $func, 1007);
     }
     $file = $api_path . implode(DOT, $mod) . DOT . $class . '.api.php';
     if (!is_readable($file)) {
         throw new Exception('api router can not load file:' . $file, 1008);
     }
     Pi::inc(PI_CORE . 'BaseApi.php');
     Pi::inc($file);
     if (!class_exists($class)) {
         throw new Exception('api router not find class:' . $class, 1009);
     }
     $cls = new $class();
     if (!is_subclass_of($cls, 'BaseApi')) {
         throw new Exception('api.err is not the subclass of BaseApi ', 1010);
     }
     $res = $this->_call_method($cls, $func);
     if ($res === false) {
         throw new Exception('api class:' . $class . ' call method ' . $func . ' err ', 1011);
     }
 }
Exemplo n.º 7
0
 /**
  * baseController里面提供登录校验的机制
  */
 protected function checkLogin()
 {
     $token = request::get('token');
     $info = Comm::checkLogin($token);
     if ($info === false) {
         // 此处再去校验是不是管理员登陆,如果是管理员登陆的话那就可以是god模式
         $uid = request::get('uid');
         if (!empty($uid)) {
             $this->checkAdminLogin();
             if (!is_object($this->msg)) {
                 return $uid;
                 // 返回前台传过来的UID
             }
         }
         $this->msg = new Msg(-1, '对不起,请先登录');
         exit;
     }
     if (empty($info['enable'])) {
         $this->msg = new Msg(-2, '该账号已被封,请联系管理员');
         exit;
     }
     return $info['uid'];
 }
Exemplo n.º 8
0
 static function Server()
 {
     $mod = Comm::req('mod');
     $add = Comm::req('add');
     $method = Comm::req('method');
     $args = Comm::req('param', array());
     try {
         $class = picom($mod, $add, true);
         if (is_callable(array($class, $method))) {
             $reflection = new ReflectionMethod($class, $method);
             $argnum = $reflection->getNumberOfParameters();
             if ($argnum > count($args)) {
                 self::output("inner api call the {$method} from {$mod} {$add} with err args", 5010);
             }
             //公共方法才允许被调用
             $res = $reflection->invokeArgs($class, $args);
             self::output($res);
         }
         self::output("inner api not callable the {$mod} {$add} from {$method} fail", 5009);
     } catch (Exception $e) {
         self::output("inner api execute the {$mod} {$add} from {$method} fail", 5008);
     }
 }
Exemplo n.º 9
0
 public function customRouter($url = null, $domain = '')
 {
     $this->setBasePath(APP_CTR_ROOT);
     $uri = $url == null ? $this->uri : $url;
     if (empty($uri)) {
         return false;
     }
     //去掉空path
     $tmp_uri = explode('/', $uri);
     $uri = array();
     //去掉空元素
     if (!empty($tmp_uri)) {
         foreach ($tmp_uri as $v) {
             if (!empty($v)) {
                 $uri[] = $v;
             }
         }
     }
     //附加二级域名处理
     $host = explode('.', $this->host);
     $this->host_pre = empty($host) ? 'www' : $host[0];
     if (is_string($domain) && !empty($domain)) {
         $this->host_pre = $domain;
     }
     if ($this->host_pre == 'ajax') {
         array_unshift($uri, 'ajax');
     }
     if (isset($uri[0]) && $uri[0] == 'ajax') {
         $this->setBasePath(APP_CTR_ROOT . 'ajax' . DOT);
         array_shift($uri);
         $this->class_pre = 'Ajax';
     } else {
         $this->class_pre = '';
     }
     if (Pcf::get('route.second_domain_enable', true)) {
         $base = Pcf::get("route.alias_" . $this->host_pre, $this->host_pre);
         if (!empty($base) && $this->host_pre != 'www' && $this->host_pre != 'ajax') {
             array_unshift($uri, $base);
         }
     }
     $uri = implode('/', $uri);
     //检查uri安全性
     if (!preg_match('/^[\\+\\-_0-9a-zA-Z\\/]*$/', $uri)) {
         throw new Exception('router.err illegal uri visit ' . $uri, 1027);
     }
     //处理自定义路由,支持目前只匹配带有数字,数字字母混合参数的uri和绝对跳转
     $self_router = Pcf::get('route.custom_router');
     //绝对跳转,没有参数在path_info
     if (isset($self_router[$uri])) {
         $uri = $self_router[$uri];
     } else {
         $param_pattern = '/[\\+\\-_0-9]+/';
         if (preg_match($param_pattern, $uri)) {
             //带参转换
             $tmp_mod = explode('/', $uri);
             $guess_router = '';
             $params = array();
             if (!empty($tmp_mod)) {
                 foreach ($tmp_mod as $p) {
                     if (preg_match($param_pattern, $p)) {
                         $params[] = $p;
                         $p = '(:p)';
                     }
                     $guess_router .= $p . '/';
                 }
                 $guess_router = rtrim($guess_router, '/');
                 if (isset($self_router[$guess_router])) {
                     $uri = $self_router[$guess_router]['url'];
                     $self_params = $self_router[$guess_router]['p'];
                     if (!empty($self_params)) {
                         foreach ($self_params as $pn) {
                             Comm::setReq($pn, array_shift($params));
                         }
                     }
                 }
             }
         }
     }
     //处理完自定义路由后防止内部调用dispath循环跳转。如果有发现问题,跳转到主页
     $this->uri = $url != null && $uri == $this->uri ? '' : $uri;
     return $this->uri;
 }
Exemplo n.º 10
0
 /**
  * Returns the configuration
  *
  * @return array
  */
 public function getConfig()
 {
     if ($this->_config === null) {
         $meta = Comm::getMeta();
         $this->_config = $meta["config"]["signature"];
     }
     return $this->_config;
 }
Exemplo n.º 11
0
 /**
  * 图片上传资料整理(与数据库对比后返回的更新到数据库的json数据)
  * @param $id:int 品牌id	
  * @return 成功返回整理后的json数据,否则返回false
  */
 private static function brandImgUp($id = 0)
 {
     $id = trim($id);
     try {
         Comm::checkValue($id, 'ID', 1, 1);
     } catch (Exception $e) {
         return false;
     }
     $arr = uploadd::SessionGet($id, self::$Img_Session_name);
     //获取session里的暂存数据
     if ($arr) {
         $arr = trim($arr);
         if (!empty($arr)) {
             $arr = json_decode($arr, true);
             if (count($arr) > 0) {
                 try {
                     $data = Yii::app()->db->createCommand()->select('logoimgpath')->from('beu_brand')->where('id=:id', array(':id' => $id))->queryAll();
                     if ($data[0]['logoimgpath'] != '') {
                         Comm::arrayDelete($data[0]['logoimgpath']);
                         //删除需要被替换的文件
                     }
                 } catch (Exception $e) {
                 }
                 return json_encode($arr);
             }
         }
     }
     return false;
 }
Exemplo n.º 12
0
 function AddCode($money)
 {
     $code = Comm::get_random_char(32);
     $this->db->insert($this->table, ["add_time" => time(), "code" => $code, "money" => $money]);
     return $code;
 }
Exemplo n.º 13
0
 /**
  * 根据父级查询分类详细信息 
  * @param parentid int 分类id 默认0查询所有
  * @return 如果查询数据成功返回结果集
  * 否则返回false
  */
 public function categorySelectByParent($parentid = 0)
 {
     $parentid = trim($parentid);
     try {
         Comm::checkValue($parentid, Yii::t('beu_category', '父级编号'), 1, 1);
     } catch (BeubeuException $e) {
         echo $e->getMessage();
         return false;
     }
     try {
         $date = beu_category::model()->find('id=:parentid', array(':parentid' => $parentid));
         if (empty($date)) {
             throw new BeuBeuException(Yii::t('public', '查询数据失败'), BeuBeuException::SQL_SELECT_ERR);
         } else {
             return $date;
         }
     } catch (BeubeuException $e) {
         throw new BeuBeuException(Yii::t('public', '查询数据失败'), BeuBeuException::SQL_SELECT_ERR);
     }
 }
Exemplo n.º 14
0
 protected function jump($url, $inner = false)
 {
     if ($inner === false) {
         Comm::jump($url);
     } else {
         $this->router->dispatch($url);
     }
 }
Exemplo n.º 15
0
 /**
  * Returns the last messages for the user.
  *
  * @param integer $offset
  * @param integer $count
  *
  * @return array
  */
 protected function getItems($offset, $count)
 {
     $folderClassCache = array();
     $items = array();
     /* @var Bengine_Game_Model_Collection_Message $messages */
     $messages = Comm::getCollection("game/message");
     $messages->addTimeOrder()->addReceiverFilter($this->user_id)->addFolderJoin();
     $select = $messages->getSelect();
     $select->limit($offset, $count);
     $select->where("m.mode != ?", self::OUTBOX_FOLDER_ID);
     /* @var Bengine_Game_Model_Message $message */
     foreach ($messages as $message) {
         /* @var Bengine_Game_MessageFolder_Abstract $folderObj */
         $folderCode = $message->get("folder_class");
         if (!isset($folderClassCache[$folderCode])) {
             $folderClass = explode("/", $folderCode);
             $folderClass = $folderClass[0] . "/messageFolder_" . $folderClass[1];
             $folderObj = Application::factory($folderClass);
             $folderClassCache[$folderCode] = $folderObj;
         } else {
             $folderObj = $folderClassCache[$folderCode];
         }
         $folderObj->formatMessage($message, true);
         $items[] = array("date" => Date::timeToString(3, $message->getTime(), "D, d M Y H:i:s O", false), "author" => $message->get("username") ? $message->get("username") : "System", "title" => strip_tags($message->get("subject")), "text" => $message->get("message"), "link" => $message->get("link"), "date_atom" => Date::timeToString(3, $message->getTime(), "c", false), "guid" => $message->getId());
     }
     return $items;
 }
Exemplo n.º 16
0
 /**
  * 根据触摸屏id对其下的modellimit字段修改
  * @param $touchid 触摸屏id
  * @param $arr 模特数组 array(模特)
  */
 public static function touchUpdateByIdModel($touchid, $arr = array())
 {
     $touchid = trim($touchid);
     try {
         Comm::checkValue($touchid, Yii::t('public', '触摸屏号'), 1, 1);
     } catch (BeubeuException $e) {
         throw new BeubeuException($e->getMessage(), $e->getCode());
     }
     if (count($arr) > 0 && gettype($arr) == 'array') {
         $modellimit = json_encode($arr);
         try {
             touch_config::model()->updateAll(array('modellimit' => $modellimit), 'id=:textx', array(':textx' => $touchid));
         } catch (BeubeuException $e) {
             throw new BeubeuException(Yii::t('public', '修改数据失败'), BeubeuException::SQL_UPDATE_ERR);
         }
     }
 }
Exemplo n.º 17
0
 /**
  * 修改单品的主次关系
  * @parm clothes 衣服数组 键值对 键为衣服id 值为衣服即将修改的状态
  * @parm touchid 触摸屏id
  **/
 static function upmainClothes($clothes, $touchid)
 {
     $ret = array('status' => 0, 'msg' => '');
     try {
         $Display_status_num = 11;
         //上架显示状态
         $no_Display_status_num = 10;
         //上架不显示状态
         $out_status_num = 8;
         //下架状态
         $ForSale_status_num = 12;
         //待售状态
         $Logic_clothes_arr = array();
         //逻辑整理后的单品
         $Logic_clothes_arr[$Display_status_num] = array();
         $Logic_clothes_arr[$no_Display_status_num] = array();
         $Logic_clothes_arr[$out_status_num] = array();
         $Logic_clothes_arr[$ForSale_status_num] = array();
         $Related_arr = self::beuRelatedSelectByClothesid(implode(',', array_keys($clothes)));
         // 获取衣服的不同色
         //将衣服对应的每组不同色提取出来
         $Related_clothes_arr = array();
         //单品的不同色数组
         $Different_clothes_arr = array();
         //单品的不同穿数组
         $clothesid_arr = array();
         //衣服数组 用于查询其状态
         $clothes_status_arr = array();
         //衣服数组 用于查询其状态
         foreach ($Related_arr as $value) {
             $c_arr = array();
             foreach ($value as $v_key => $v_value) {
                 if ($v_key == 'id' || empty($v_value)) {
                     continue;
                 }
                 $c_arr[] = $v_value;
                 $clothesid_arr[] = $v_value;
             }
             if (count($c_arr) > 0) {
                 $Related_clothes_arr[] = $c_arr;
             }
         }
         $no_Related_arr = Comm::array_diff_fast(array_keys($clothes), $clothesid_arr);
         //获取还未做个SKU关联的单品
         $clothesid_arr = array_merge($clothesid_arr, $no_Related_arr);
         //将还未做个SKU关联的单品拼接进衣服数组做状态查询
         foreach ($no_Related_arr as $value) {
             $Related_clothes_arr[] = array($value);
         }
         //查询单品的状态
         $t_clothes_ret = self::getTouchclothesinfo('clothesid,status', array('touchid' => '=' . $touchid, 'clothesid' => ' in(' . implode(',', $clothesid_arr) . ')'));
         if ($t_clothes_ret['status'] == 0) {
             throw new Exception($t_clothes_ret['msg']);
         }
         //获取单品的不同穿
         $Different_arr = self::beuDifferentSelectByClothesid(implode(',', $clothesid_arr));
         $Diff_clothes = array();
         foreach ($Different_arr as $value) {
             $c_arr = array();
             foreach ($value as $v_key => $v_value) {
                 if ($v_key == 'id' || empty($v_value)) {
                     continue;
                 }
                 $c_arr[] = $v_value;
                 $Diff_clothes[] = $v_value;
             }
             if (count($c_arr) > 0) {
                 $Different_clothes_arr[] = $c_arr;
             }
         }
         $no_Different_arr = Comm::array_diff_fast(array_keys($clothes), $Diff_clothes);
         //获取还未做个SKC关联的单品
         foreach ($no_Different_arr as $value) {
             $Different_clothes_arr[] = array($value);
         }
         //将单品的状态进行归总
         foreach ($t_clothes_ret['data'] as $value) {
             $clothes_status_arr[$value['clothesid']] = $value['status'];
             if (in_array($value['clothesid'], $no_Different_arr)) {
                 //当前单品属于未做SKU关联的单品
                 $Logic_clothes_arr[$clothes[$value['clothesid']]][] = $value['clothesid'];
             }
         }
         //逻辑判断单品修改后的状态
         foreach ($Related_clothes_arr as $value) {
             $current_status = array();
             //当前SKU状态数组
             $up_status = array();
             //SKU修改状态数组
             $Display_clothes = array();
             //逻辑判断后的显示单品
             $no_Display_clothes = array();
             //逻辑判断后的不显示单品
             $out_clothes = array();
             //逻辑判断后的下架单品
             $ForSale_clothes = array();
             //逻辑判断后的待售单品
             $up_Related_clothes = array();
             //需要修改的SKU单品数组
             foreach ($value as $v_key => $v_value) {
                 $s_str = $clothes_status_arr[$v_value];
                 //获取单品的当前状态
                 if (!isset($current_status[$s_str])) {
                     //当前SKU状态数组 不存在此状态时对其添加
                     $current_status[$s_str] = array();
                 }
                 $current_status[$s_str][] = $v_value;
                 //将单品添加到 SKU状态数组对应状态下
                 $up_Related_clothes[] = $v_value;
                 if (isset($clothes[$v_value])) {
                     $up_s_str = $clothes[$v_value];
                     //获取单品修改状态
                     if (!isset($up_status[$up_s_str])) {
                         //SKU修改状态数组 不存在此状态时对其添加
                         $up_status[$up_s_str] = array();
                     }
                     $up_status[$up_s_str][] = $v_value;
                     //将单品添加到 SKU修改状态数组对应状态下
                 }
             }
             //显示单品
             if (isset($up_status[$Display_status_num])) {
                 //SKU修改状态数组里存在显示单品时 就将其第一个设为显示 其他设为不显示
                 $Display_clothes[0] = $up_status[$Display_status_num][0];
             }
             //下架单品
             if (isset($up_status[$out_status_num])) {
                 //SKU修改状态数组存在下架状态
                 $out_clothes = $up_status[$out_status_num];
             }
             //待售单品
             if (isset($up_status[$ForSale_status_num])) {
                 //SKU修改状态数组存在待售状态
                 $ForSale_clothes = $up_status[$ForSale_status_num];
             }
             if (isset($current_status[$Display_status_num])) {
                 //当前SKU状态数组存在显示单品时
                 $current_status[$Display_status_num] = Comm::array_diff_fast($current_status[$Display_status_num], array_merge($out_clothes, $ForSale_clothes));
                 //去除原有上架修改为下架或待售的单品
                 if (count($current_status[$Display_status_num]) > 0) {
                     if (isset($up_status[$Display_status_num])) {
                         $Display_intersect = Comm::array_intersect_fast($current_status[$Display_status_num], $up_status[$Display_status_num]);
                         //获取其同时存在显示状态的单品
                         if (count($Display_intersect) > 0) {
                             //SKU修改状态数组需要显示单品与当前SKU状态数组显示单品存在相同单品 就显示其第一个相同单品
                             $Display_clothes[0] = $Display_intersect[0];
                         }
                     } else {
                         $Display_clothes[0] = $current_status[$Display_status_num][0];
                     }
                 }
             }
             //获取未设置的单品
             $dirr_Related = Comm::array_diff_fast($value, array_merge($ForSale_clothes, $out_clothes, $Display_clothes));
             foreach ($dirr_Related as $dirr_value) {
                 if (isset($up_status[$Display_status_num]) && in_array($dirr_value, $up_status[$Display_status_num])) {
                     //暂未设置单品需设为上架,因已有单品上架 所以修改为上架不显示
                     $no_Display_clothes[] = $dirr_value;
                 } else {
                     if ($clothes_status_arr[$dirr_value] == $Display_status_num) {
                         $no_Display_clothes[] = $dirr_value;
                     } else {
                         if ($clothes_status_arr[$dirr_value] == $ForSale_status_num) {
                             $ForSale_clothes[] = $dirr_value;
                         } else {
                             if ($clothes_status_arr[$dirr_value] == $out_status_num) {
                                 $out_clothes[] = $dirr_value;
                             } else {
                                 $no_Display_clothes[] = $dirr_value;
                             }
                         }
                     }
                 }
             }
             //将SKU的下单品的按状态加入到数组
             $Logic_clothes_arr[$Display_status_num] = array_merge($Logic_clothes_arr[$Display_status_num], $Display_clothes);
             $Logic_clothes_arr[$no_Display_status_num] = array_merge($Logic_clothes_arr[$no_Display_status_num], $no_Display_clothes);
             $Logic_clothes_arr[$out_status_num] = array_merge($Logic_clothes_arr[$out_status_num], $out_clothes);
             $Logic_clothes_arr[$ForSale_status_num] = array_merge($Logic_clothes_arr[$ForSale_status_num], $ForSale_clothes);
         }
         //去除单品状态数组里的重复值和空值
         foreach ($Logic_clothes_arr as $key => $value) {
             $value = array_filter($value);
             $Logic_clothes_arr[$key] = array_unique($value);
         }
         //单品不同穿状态设置
         foreach ($Different_clothes_arr as $value) {
             $out_c_arr = Comm::array_intersect_fast($value, $Logic_clothes_arr[$out_status_num]);
             //获取当前不同穿关联 是否做下架处理
             $ForSale_c_arr = Comm::array_intersect_fast($value, $Logic_clothes_arr[$ForSale_status_num]);
             //获取当前不同穿关联 是否做待售处理
             if (count($out_c_arr) > 0) {
                 //当前单品状态为下架 那么其不同穿关联就做下架
                 $Logic_clothes_arr[$out_status_num] = array_merge($Logic_clothes_arr[$out_status_num], $value);
             } else {
                 if (count($ForSale_c_arr) > 0) {
                     //当前单品状态为待售 那么其不同穿关联就做待售
                     $Logic_clothes_arr[$ForSale_status_num] = array_merge($Logic_clothes_arr[$ForSale_status_num], $value);
                 } else {
                     $Display_c_arr = Comm::array_intersect_fast($value, $Logic_clothes_arr[$Display_status_num]);
                     //获取当前不同穿关联 是否做显示处理
                     $Display_clothes_id_arr = array();
                     $Display_c_arr_len = count($Display_c_arr);
                     if ($Display_c_arr_len > 0) {
                         $Display_clothes_id_arr = array(array_shift($Display_c_arr));
                     }
                     //当前单品状态为上架不显示
                     $no_Display_c_arr = Comm::array_diff_fast($value, array_merge($Display_clothes_id_arr, $Logic_clothes_arr[$ForSale_status_num], $Logic_clothes_arr[$out_status_num], $Logic_clothes_arr[$Display_status_num]));
                     $Logic_clothes_arr[$no_Display_status_num] = array_merge($Logic_clothes_arr[$no_Display_status_num], $no_Display_c_arr);
                     //上架单品数量大于1时 只取第一个做上架 其他做上架不显示
                     if ($Display_c_arr_len > 1) {
                         $Logic_clothes_arr[$Display_status_num] = Comm::array_diff_fast($Logic_clothes_arr[$Display_status_num], $Display_c_arr);
                     }
                 }
             }
             foreach ($Related_clothes_arr as $R_key => $R_value) {
                 if (count(Comm::array_intersect_fast($value, $R_value)) > 0) {
                     $R_value = array_merge($R_value, $value);
                     $R_value = array_unique($R_value);
                     $Related_clothes_arr[$R_key] = $R_value;
                     break;
                 }
             }
         }
         //检查关联单品 是否有上架单品存在
         /*foreach($Related_clothes_arr as $value){
         			$no_Display_v_arr=Comm::array_intersect_fast($value,$Logic_clothes_arr[$no_Display_status_num]);
         			$Display_v_arr=Comm::array_intersect_fast($value,$Logic_clothes_arr[$Display_status_num]);
         			if(count($Display_v_arr)==0 && count($no_Display_v_arr)>0){//当前关联单品组合是没有上架单品 将不显示单品提取一个改为上架
         				$s_vlue=array_shift($Display_c_arr);
         				$Logic_clothes_arr[$Display_status_num][]=$s_vlue;
         				unset($Logic_clothes_arr[$no_Display_status_num][array_search($s_vlue,$Logic_clothes_arr[$no_Display_status_num])]);
         			}
         		}
         		print_r($Logic_clothes_arr);*/
         //修改单品的状态
         foreach ($Logic_clothes_arr as $key => $value) {
             $value = array_filter($value);
             $value = array_unique($value);
             if (count($value) == 0) {
                 continue;
             }
             Yii::app()->db->createCommand('update touch_clothes set status=' . $key . ' where clothesid in(' . implode(',', $value) . ') and touchid=' . $touchid)->execute();
         }
         $ret['status'] = 1;
     } catch (Exception $e) {
         $ret['msg'] = $e->getMessage();
     }
     return $ret;
 }
Exemplo n.º 18
0
 /**
  * 获取用户可访问的权限
  * @return array('status'=>0,'msg'=>'','data'=>array(),'user_type'=>0) 成功status为1 有data数据,用户权限
  */
 static function getPowerAll()
 {
     $ret = array('status' => 0, 'msg' => '');
     try {
         if (!isset($_SESSION['user_id'])) {
             throw new Exception('用户ID不能为空');
         }
         $userid = $_SESSION['user_id'];
         $ret_judge_bool = permission::judgeUserIP();
         //获取用户是否需要判断来源IP
         if ($ret_judge_bool['status'] == 0) {
             throw new Exception($ret_judge_bool['msg']);
         }
         if ($ret_judge_bool['is_bool_ip']) {
             //需要判断来源IP
             $ret_ip = self::getIpLimit($userid);
             //获取用户的IP白名单
             if ($ret_ip['status'] == 0 && !isset($ret_ip['data'])) {
                 throw new Exception($ret_ip['msg']);
             }
             $is_bool = false;
             foreach ($ret_ip['data'] as $value) {
                 if ($value['IP'] == Comm::getSourceIp()) {
                     $is_bool = true;
                     break;
                 }
             }
             if (!$is_bool) {
                 //未在IP白名单里找到来源IP
                 throw new Exception('来源IP未添加到用户的IP白名单里');
             }
         }
         $user_type = $ret_judge_bool['user_type'];
         //用户权限级别
         if ($user_type != 1) {
             //不为超级管理员时才查询其访问权限
             $cache = Yii::app()->cache->get(CacheName::getCacheName('user_action_Info') . $userid . $user_type);
             if ($cache === false) {
                 $ret_Action = self::getActionInfoByUser($userid, $user_type);
                 if ($ret_Action['status'] == 0) {
                     throw new Exception($ret_Action['msg']);
                 }
                 Yii::app()->cache->set(CacheName::getCacheName('user_action_Info') . $userid . $user_type, $ret_Action, 300);
                 //设置用户的可访问页面列表缓存
             } else {
                 $ret_Action = $cache;
             }
             if ($user_type == Yii::app()->params['main_type'] && $_SESSION['sub_id'] != 0) {
                 //当期帐号权限为总屏权限时,并且切换到了子屏
                 $ret_Action = self::getActionInfoByUser($_SESSION['sub_id'], Yii::app()->params['sub_type']);
                 //获取子屏访问权限
             }
             $ret['data'] = $ret_Action['data'];
         }
         $ret['status'] = 1;
         $ret['user_type'] = $user_type;
     } catch (Exception $e) {
         $ret['msg'] = $e->getMessage();
     }
     return $ret;
 }
Exemplo n.º 19
0
</div></div></div>
    <div class="fl w140 border_rt" style="height: 100%;"><div class="div_table"><div class="div_table_cell"><?php 
        if (is_array($value['o_addtime'])) {
            $o_name_arr = array();
            foreach ($value['o_addtime'] as $o_value) {
                $o_name_arr[] = substr($o_value, 0, 10);
            }
            echo implode('<br/>', $o_name_arr);
        } else {
            echo substr($value['o_addtime'], 0, 10);
        }
        ?>
</div></div></div>
    <div class="fl w115" style="height: 100%;">
    <div class="div_table"><div class="div_table_cell"><a target="_blank" href="/erp/manageinfo/id/<?php 
        echo Comm::strencrypt($value['id']);
        ?>
" class="button button-primary button-rounded button-small" style=" width:50px; padding:0 5px;">审图</a>
	
	<?php 
        if (Beu_Power::selectAction('/erp/delClothesByclothesid')) {
            ?>
		<br/>
	<a onclick="delClothesByclothesidpop(this)" class="button button-primary button-rounded button-small" style=" width:50px; padding:0 5px;margin-top:15px">删除</a>
	<?php 
        }
        ?>
	</div></div>
    </div>
  </div>
  <?php 
Exemplo n.º 20
0
?>
';
var img_sku='<?php 
echo $data['clothes']['sku'];
?>
';
var istop_id='<?php 
echo Comm::strencrypt($istop_id);
?>
';
var domain='<?php 
echo $domain;
?>
';
var orderid_str='<?php 
echo Comm::strencrypt($data['clothes']['orderid']);
?>
';
$(function(){
	$('.color_page .color_count').html($(".color_scrollable ul>div").length)
	try{
		$(".color_scrollable").scrollable({
			size: 1,
			items:'.color_scrollable ul',
			vertical:false,
			prev:'.color_prev',
			next:'.color_next',
			onSeek:currentlistbutton
		});
		if($('.color_scrollable ul>div').length>1){
			$('.color_next').removeClass('txt_gray');
Exemplo n.º 21
0
 /**     
  * 静态方法,该方法输入数组并返回数组     
  *     
  * @param unknown_type $array 输入的数组     
  * @param unknown_type $in 输入数组的编码     
  * @param unknown_type $out 返回数组的编码     
  * @return unknown 返回的数组     
  */
 public static function Conversion($array, $in, $out)
 {
     self::$in = $in;
     self::$out = $out;
     return self::arraymyicov($array);
 }
Exemplo n.º 22
0
?>
';
var id='<?php 
echo Comm::strencrypt($data['clothes']['id']);
?>
';
var id_sku='<?php 
echo implode(',', $id_to_str_arr);
?>
';
var img_sku='<?php 
echo $data['clothes']['sku'];
?>
';
var istop_id='<?php 
echo Comm::strencrypt($istop_id);
?>
';
var domain='<?php 
echo $domain;
?>
';
$(function(){
	$('.color_page .color_count').html($(".color_scrollable ul>div").length)
	try{
		$(".color_scrollable").scrollable({
			size: 1,
			items:'.color_scrollable ul',
			vertical:false,
			prev:'.color_prev',
			next:'.color_next',
Exemplo n.º 23
0
 /**
  * 推送页面
  */
 public function actionpushlist()
 {
     $res = array("status" => 0, "mes" => "", "data" => array());
     $brandid = isset($_SESSION['brandid']) ? $_SESSION['brandid'] : 0;
     //品牌ID
     $userid = $_SESSION['user_id'];
     //用户ID
     $patformid = Yii::app()->request->getParam("patformid");
     //平台ID
     //以逗号分隔款号所对应的ID,是加密的,需转换为ID号
     $clothes_string = Yii::app()->request->getParam("clothes_string");
     $clothes_m_array = explode(",", $clothes_string);
     $clothes_id_array = array();
     foreach ($clothes_m_array as $value) {
         $id = Comm::strdecipher($value);
         $clothesorder = new clothesorderclass();
         $c_ret = $clothesorder->select_Single_clothes($_SESSION['brandid'], array('id' => $id));
         $ret_sku = $c_ret['sku'];
         if ($this->Website_template != 'SKC') {
             //获取SKU下所有的SKC信息
             $sku_ret = $clothesorder->select_all_clothes($_SESSION['brandid'], -1, array('sku' => $ret_sku));
             foreach ($sku_ret['data'] as $sku_value) {
                 $clothes_id_array[] = $sku_value;
             }
         } else {
             //通过衣服skcID查找skc对应的信息
             $clothes_id_array[] = $c_ret;
         }
     }
     //获取平台信息
     $cut_class = new cut_detaileclass();
     $cut_obj = $cut_class->select_erp_cut_detaile($brandid);
     $cutid = 0;
     $cut_array = array();
     foreach ($cut_obj as $value) {
         if ($value['patformid'] == $patformid) {
             $cutid = $value['id'];
             $cut_array['cut_obj'] = $value;
             break;
         }
     }
     //水印信息
     $watermark_obj = watermarkclass::select_erp_watermark($brandid);
     $pushDetaileclass = new pushDetaileclass();
     foreach ($clothes_id_array as $key => $value) {
         $pushdetaile_obj = $pushDetaileclass->select_all_push($brandid, array("cutid" => $cutid, "pushstatus" => 0, "skc" => $value['brandnumber']));
         foreach ($pushdetaile_obj['data'] as $push_key => $push_value) {
             $pushdetaile_obj['data'][$push_key]['patformid'] = $patformid;
             foreach ($watermark_obj as $watermark_value) {
                 if ($watermark_value['id'] == $push_value['watermarkid']) {
                     $pushdetaile_obj['data'][$push_key]['watermarkurl'] = $watermark_value['url'];
                     break;
                 }
             }
         }
         $clothes_id_array[$key]['push_detaile'] = json_encode($pushdetaile_obj['data']);
     }
     $res['status'] = 1;
     $res['cut_obj'] = $cut_array['cut_obj'];
     $res['data'] = $clothes_id_array;
     echo $this->render('/erp/pushlist', $res);
     //echo json_encode($res);
     exit;
 }
Exemplo n.º 24
0
 /**
  * 添加缓存sessin数据
  * @param $id 衣服id
  * @param $type 谁用 例:clothesVoid
  * @param $data 需要存在数据里的值 
  * @param $addess 需要存在数据里的值的位置 例:array('dd'=>array('kk'=>'da')),要将数据保存在二维数组kk下的写法 ('dd/kk')
  */
 public static function SessionAdd($id = 0, $type = '', $data = '', $addess = '')
 {
     $id = trim($id);
     $type = trim($type);
     $addess = trim($addess);
     $data = trim($data);
     try {
         Comm::checkValue($id, 'ID', 1, 1);
         Comm::checkValue($type, '', 0, 1);
         Comm::checkValue($addess, '', 0, 1);
         Comm::checkValue($data, '', 0, 1);
     } catch (Exception $e) {
         return false;
     }
     $addess2 = explode('/', $addess);
     $json_data = '';
     if ($id == 999999999) {
         $id = session_id();
     }
     if (isset($_SESSION[$type . $id])) {
         $json_data = $_SESSION[$type . $id];
         $json_data = trim($json_data);
         if (!empty($json_data)) {
             $json_data = json_decode($json_data, true);
         }
     }
     if (gettype($json_data) != 'array') {
         $json_data = array();
     }
     $xb = array_pop($addess2);
     //去除数组最后一个元素
     $json_data = json_encode(Comm::arrayAdd($json_data, $addess2, array($xb => $data)));
     $_SESSION[$type . $id] = $json_data;
     //		echo $type.$id.'---';
     //		print_r($json_data);exit();
 }
Exemplo n.º 25
0
$lang_tables[] = 'departments.php';
$lang_tables[] = 'phone.php';
$lang_tables[] = 'doctors.php';
define('LANG_FILE', 'edp.php');
$local_user = '******';
require_once $root_path . 'include/inc_front_chain_lang.php';
require_once $root_path . 'include/care_api_classes/class_department.php';
require_once $root_path . 'include/care_api_classes/class_comm.php';
$breakfile = 'dept_list.php' . URL_APPEND;
if (!isset($mode)) {
    $mode = '';
}
# Create department object
$dept_obj = new Department();
#create com object
$comm = new Comm();
//$db->debug=1;
# Validate 3 most important inputs
if (isset($mode) && !empty($mode) && $mode != 'select') {
    if (empty($_POST['name_formal']) || empty($_POST['id']) || empty($_POST['type'])) {
        $inputerror = TRUE;
        # Set error flag
    }
    //if($mode=='update'&&empty($_POST['id'])) $inputerror=TRUE;
}
if (!empty($mode) && !$inputerror) {
    $is_img = false;
    # If a pic file is uploaded move it to the right dir
    if (is_uploaded_file($_FILES['img']['tmp_name']) && $_FILES['img']['size']) {
        $picext = substr($_FILES['img']['name'], strrpos($_FILES['img']['name'], '.') + 1);
        if (stristr('jpg,gif,png', $picext)) {
Exemplo n.º 26
0
Arquivo: Web.php Projeto: xtzlyp/newpi
 function page_5xx()
 {
     $url = Conf::get('global.404', APP_ROOT . APP_NAME . '/5xx.html');
     Comm::jump($url);
 }
Exemplo n.º 27
0
 /**
  * 查询状态表
  * @param $userid
  * @return usermode用户状态数组
  */
 public function usermodeSeleteStatus($userid)
 {
     $usermode = array();
     try {
         Comm::checkValue($userid, yii::t('beu_users', "用户编号"), 1, 1);
         //用户编号
     } catch (BeubeuException $e) {
         return $usermode;
     }
     $where = "userid={$userid}";
     $usermode = Yii::app()->db->createCommand()->select('*')->from("beu_usermode")->where($where)->queryAll();
     return $usermode;
 }
Exemplo n.º 28
0
 public function filterInput()
 {
     Comm::reqFilter();
 }
Exemplo n.º 29
0
 /**
  * Sets the CMS.
  *
  * @return Bengine_Comm_CMS
  */
 protected static function setCMS()
 {
     self::$cmsObject = new Bengine_Comm_CMS();
     return self::$cmsObject;
 }