/** * 切换优惠卡/券状态 * @return bool */ public function ActionAjaxChangeDiscountCardValid() { $id = $_POST['id']; // 获取要修改的优惠卡/券ID $valid = $_POST['valid']; // 获取该优惠卡/券当前的状态 [0:禁用 / 1:启用] $valid = $valid == 0 ? 1 : 0; $discount_card_model = DiscountCard::model(); $discount_card_info = $discount_card_model->findByPk($id); // 查询更改的优惠卡/券信息 // 执行更新 if ($discount_card_info->updateByPk($id, array('Valid' => $valid)) > 0) { // 添加操作日志 [S] $log = Yii::app()->user->name . '于 ' . date('Y-m-d H:i:s', time()) . ' ' . ($valid == 0 ? '禁用了' : '启用了') . ' 【' . $discount_card_info['DiscountCardName'] . '】 优惠卡/券'; OperationLogManage::AddOperationLog($log); // 添加日志 // 添加操作日志 [E] echo true; } else { echo false; } }
/** * 查看购物中心 * @param $shopping_mall_id 购物中心ID */ public function ActionViewShoppingMall($shopping_mall_id) { $shopping_mall_model = ShoppingMall::model(); $shopping_mall_info = $shopping_mall_model->findByPk($shopping_mall_id); // 获取全部品牌 $brand_criteria = new CDbCriteria(); $brand_criteria->select = array('Id', 'BrandName'); $brand = IconvEncode::ObjArrChangeArray(Brand::model()->findAll($brand_criteria), 'BrandName'); // 获取全部餐厅 $restaurant_criteria = new CDbCriteria(); $restaurant_criteria->select = array('Id', 'RestaurantName'); $restaurant = IconvEncode::ObjArrChangeArray(Restaurant::model()->findAll($restaurant_criteria), 'RestaurantName'); // 获取全部优惠卡/券 $discount_criteria = new CDbCriteria(); $discount_criteria->select = array('Id', 'DiscountCardName'); $discount_card = IconvEncode::ObjArrChangeArray(DiscountCard::model()->findAll($discount_criteria), 'DiscountCardName'); // 获取购物中心所在的的 大洲/国家/城市 $area = AreaManage::getAreaByCityid($shopping_mall_info['CityId']); $this->renderPartial('view_shopping_mall', array('shopping_mall_info' => $shopping_mall_info, 'brand' => $brand, 'restaurant' => $restaurant, 'discount_card' => $discount_card, 'area' => $area)); }