Ejemplo n.º 1
0
 /**
  * Constructor
  *
  */
 public function __construct($viewsHome = null)
 {
     if (is_null($viewsHome)) {
         $viewsHome = Cola::getConfig('_viewsHome');
     }
     if ($viewsHome) {
         $this->viewsHome = $viewsHome;
     }
 }
Ejemplo n.º 2
0
 /**
  * Init Cola_Ext_Cache
  *
  * @param mixed $name
  * @return Cola_Ext_Cache
  */
 public function cache($name = null)
 {
     is_null($name) && ($name = $this->_cache);
     if (is_array($name)) {
         return Cola::factory('Cola_Ext_Cache', $name);
     }
     $regName = "_cola_cache_{$name}";
     if (!($cache = Cola::getReg($regName))) {
         $config = (array) Cola::getConfig($name);
         $cache = Cola::factory('Cola_Ext_Cache', $config);
         Cola::setReg($regName, $cache);
     }
     return $cache;
 }
Ejemplo n.º 3
0
 /**
  * 删除订单
  */
 public function delAction()
 {
     if (ComTool::isAjax()) {
         if (!$this->isLogin()) {
             ComTool::ajax(Cola::getConfig('_error.mustlogin'), '请先登录,即将跳转至登录页面');
         }
         $currUser = $this->getCurrentUser();
         $orderId = $this->post('oid', '');
         if (!$orderId) {
             ComTool::ajax(100001, '未知订单');
         }
         $orderId = ComTool::escape($orderId);
         $updateTime = time();
         $sql = "update `order` set `status`=4,update_time='{$updateTime}' where id='{$orderId}' and user_id='{$currUser['id']}'";
         $res = OrderData::sql($sql);
         if ($res === false) {
             ComTool::ajax(100001, '服务器忙,请重试');
         }
         //暂时不删除订单详情(order_detail表)
         ComTool::ajax(100000, 'ok');
     }
 }
Ejemplo n.º 4
0
 static function delete($name)
 {
     self::set($name, '', -3600);
     $prefix = Cola::getConfig("_cookie.COOKIE_PREFIX");
     unset($_COOKIE[$prefix . $name]);
 }
Ejemplo n.º 5
0
 /**
  * 加入圈子
  */
 public function joingroupAction()
 {
     if (ComTool::isAjax()) {
         if (isset($_POST['captcha'])) {
             $captcha = trim($this->post('captcha'));
             if (!ComTool::checkCaptcha($captcha)) {
                 ComTool::ajax(100001, '验证码错误');
             }
         }
         $city = trim($this->post('city'));
         ComTool::checkEmpty($city, '请选择城市');
         $area = trim($this->post('area'));
         ComTool::checkEmpty($area, '请选择区域');
         $group = trim($this->post('group'));
         ComTool::checkEmpty($group, '请选择圈子');
         $addr_desc = trim($this->post('addr_desc'));
         ComTool::checkEmpty($addr_desc, '请填写详细位置');
         ComTool::checkMaxLen($addr_desc, 32, '详细位置最多32位');
         $currUser = $this->getCurrentUser();
         $groupsNumLimit = Cola::getConfig('_groupsNumLimit');
         $groups = UserGroupData::getGroupsByUid($currUser['id']);
         foreach ($groups as $v) {
             if ($group == $v['group_id']) {
                 ComTool::ajax(100001, '已加入该圈子');
             }
         }
         if (count($groups) > $groupsNumLimit) {
             ComTool::ajax(100001, '已加入圈子数超过限制');
         }
         $res = UserGroupData::add(array('user_id' => $currUser['id'], 'group_id' => $group, 'detail' => $addr_desc, 'status' => 1));
         ComTool::result($res, '操作失败,请刷新重试', '操作成功');
     }
 }