/** * 编辑页面分类 */ public function edit() { $id = $this->input->get('id'); if (!$id) { remind::set(Kohana::lang('o_global.bad_request'), 'site/doc_category'); } $data = Mydoc_category::instance($id)->get(); if ($_POST) { $category_name = $this->input->post('category_name'); $parent_id = $this->input->post('parent_id'); if (empty($category_name)) { remind::set(Kohana::lang('o_site.doc_category_cannot_null')); } else { if ($parent_id == $id) { remind::set(Kohana::lang('o_site.doc_parent_category_cannot_self')); } else { if (Mydoc_category::instance()->name_exist($category_name, $id)) { remind::set(Kohana::lang('o_site.doc_category_has_exist')); } else { if (Mydoc_category::instance($id)->edit($_POST)) { remind::set(Kohana::lang('o_global.update_success'), 'site/doc_category', 'success'); } else { remind::set(Kohana::lang('o_global.update_error') . Mydoc_category::instance($id)->error()); } } } } $data = array_merge($data, $_POST); } $doc_categories = Mydoc_category::instance()->doc_categories(0); $this->template->content = new View("site/doc_category_edit"); $this->template->content->data = $data; $this->template->content->doc_categories = $doc_categories; }
public static function is_allowed($permission = 'default', $site_id = 0, $type = NULL) { $verify = true; $site_ids = role::get_site_ids($type); //超级管理员root不需要检查权限 zhu modify if (role::is_root()) { $verify = true; } else { if ($site_id > 0 && !in_array($site_id, $site_ids)) { $verify = false; } $acl = Session::instance()->get(self::$acl_tag); if ($acl) { $acl = unserialize($acl); } else { $acl = self::acl_init(); } $manager = role::get_manager(); $verify = $acl->is_allowed($manager["username"], $permission); } //验证操作 if ($verify) { return $site_ids; } else { if (request::is_ajax()) { $return_struct = array('status' => 0, 'code' => 501, 'msg' => Kohana::lang('o_global.access_denied'), 'content' => array()); die(json_encode($return_struct)); } else { $referrer = tool::referrer_url(); remind::set('权限不足', $referrer, 'error'); } } }
public function index() { $route_data = Myroute::instance()->get(); if ($_POST) { $site_next_flow = site::site_next_flow($this->current_flow); $submit_target = intval($this->input->post('submit_target')); if (Myroute::instance()->edit($_POST)) { //判断添加成功去向 switch ($submit_target) { case 2: remind::set(Kohana::lang('o_global.update_success'), $site_next_flow['url'], 'success'); default: remind::set(Kohana::lang('o_global.update_success'), 'site/route', 'success'); } } else { remind::set(Kohana::lang('o_global.update_error'), 'site/route'); } } $this->template->content = new View("site/route_edit"); $this->template->content->is_modify = 0; if ($this->manager_is_admin == 1) { $this->template->content->is_modify = 1; } $this->template->content->data = $route_data; $this->template->content->site_id = $this->site_id; }
public function index() { $site_id = 1; $theme_id = 2; $server = Storage_server::instance(); $filename = $this->input->get('filename'); $theme_views = $server->get_site_themes($site_id, $theme_id, 'views'); $theme_js = $server->get_site_themes($site_id, $theme_id, 'js'); $theme_css = $server->get_site_themes($site_id, $theme_id, 'css'); if (in_array($filename, $theme_views)) { $type = 'views'; } else { if (in_array($filename, $theme_js)) { $type = 'js'; } else { if (in_array($filename, $theme_css)) { $type = 'css'; } else { $type = 'views'; $filename = 'index.php'; } } } if ($_POST) { $file = $_POST['file']; $server->cache_site_theme($site_id, $theme_id, $type, $filename, $file); remind::set('add ' . $_POST['file'], url::current(TRUE)); } $code = $server->get_site_theme($site_id, $theme_id, $type, $filename); $this->template->content = new View("site/theme_edit"); $this->template->content->theme_files = array_merge($theme_views, $theme_js, $theme_css); $this->template->content->data = $code; $this->template->content->filename = $filename; }
/** * 物流对应的地区列表 */ function index($id) { if (!$id) { remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error'); } $deliverycn_service = DeliverycnService::get_instance(); $deliverycn_region_service = Deliverycn_regionService::get_instance(); //验证此条物流 $data = $deliverycn_service->get($id); if (!$data['id']) { remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error'); } //初始化请求结构体 $query_struct = array('where' => array('deliverycn_id' => $id), 'like' => array(), 'orderby' => array('position' => 'ASC', 'id' => 'ASC'), 'limit' => array('per_page' => 2000, 'offset' => 0)); // 每页条目数 controller_tool::request_per_page($query_struct, $request_data); $count = $deliverycn_region_service->query_count($query_struct); // 模板输出 分页 $this->pagination = new Pagination(array('total_items' => $count, 'items_per_page' => $query_struct['limit']['per_page'])); $query_struct['limit']['offset'] = $this->pagination->sql_offset; $query_struct['limit']['page'] = $this->pagination->current_page; //调用列表 $deliverycn_regions = $deliverycn_region_service->get_delivery_regions_by_position($query_struct); $this->template->content = new View("site/deliverycn/region"); $this->template->content->deliverycn_regions = $deliverycn_regions; $this->template->content->data = $data; $this->template->content->regions = $deliverycn_region_service->get_regions(); }
/** * 改变状态 */ function do_active($id) { //权限验证 role::check('user_charge'); if (!$id) { remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge'); } $db = Database::instance(); $data = array_shift($db->query('SELECT * FROM user_charge_order WHERE id=' . $id)->result_array(false)); if ($data['id'] <= 0 || $data['status'] > 0) { remind::set(Kohana::lang('o_global.bad_request'), 'user/user_charge'); } $logodata = array(); $logodata['manager_id'] = $this->manager_id; $logodata['ip'] = tool::get_str_ip(); $logodata['user_log_type'] = 27; $logodata['method'] = __CLASS__ . '::' . __METHOD__ . '()'; $logodata['memo'] = "充值订单号:" . $data['order_num'] . ", 购买拍点数:" . $data['price'] . ", 充值金额:" . $data['money']; $sql = "UPDATE user_charge_order SET status=1 WHERE id='" . $id . "' "; if ($db->query($sql)) { //充值用户Money $sql_reward = "UPDATE users \r\n SET user_money = user_money+" . $data['price'] . "\r\n WHERE id='" . $data['user_id'] . "'\r\n "; $db->query($sql_reward); //操作log ulog::add($logodata); remind::set(Kohana::lang('o_global.update_success'), 'user/user_charge', 'success'); } else { //操作log ulog::add($logodata, 1); remind::set(Kohana::lang('o_global.update_error'), 'user/user_charge', 'error'); } }
public function add() { if ($_POST) { //标签过滤 tool::filter_strip_tags($_POST, array('content')); $site_next_flow = site::site_next_flow($this->current_flow); $submit_target = intval($this->input->post('submit_target')); $faq = Myfaq::instance(); if ($faq->add($_POST)) { //判断添加成功去向 switch ($submit_target) { case 1: remind::set(Kohana::lang('o_global.add_success'), 'site/faq/add', 'success'); case 2: remind::set(Kohana::lang('o_global.add_success'), $site_next_flow['url'], 'success'); default: remind::set(Kohana::lang('o_global.add_success'), 'site/faq', 'success'); } } else { remind::set(Kohana::lang('o_global.add_error'), 'site/faq/add'); } } $this->template->content = new View("site/faq_add"); $this->template->content->title = "site faq add"; }
/** * delete mail_category */ public function delete($id) { if (Mymail_category::instance($id)->delete()) { remind::set(Kohana::lang('o_global.delete_success'), 'manage/mail_category', 'success'); } else { $error = Mymail_category::instance($id)->error(); remind::set(Kohana::lang('o_global.delete_error') . $error, 'manage/mail_category'); } }
/** * Template loading and setup routine. */ public function __construct() { parent::__construct(); // checke request is ajax $this->ajax_request = request::is_ajax(); // Load the template $this->template = new View($this->template); if ($this->auto_render == TRUE) { Event::add('system.post_controller', array($this, '_render')); } /** * 判断用户登录情况 */ if (isset($_REQUEST['session_id'])) { $session = Session::instance($_REQUEST['session_id']); $manager = role::get_manager($_REQUEST['session_id']); } else { $session = Session::instance(); $manager = role::get_manager(); } /* 当前请求的URL */ $current_url = urlencode(url::current(TRUE)); //zhu if (isset($manager['id'])) { $active_time = $session->get('Opococ_manager_active_time'); //用户最后操作时间 $session->set('Opococ_manager_active_time', time()); //用户最后操作时间 $login_ip = $session->get('Opococ_manager_login_ip'); //用户登录的IP //操作超时 if (time() - $active_time > Kohana::config('login.time_out')) { $session->delete('Opococ_manager'); $session->delete('Opococ_manager_active_time'); $session->delete('Opococ_manager_login_ip'); remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url); } //用户IP(登录状态更换IP需要重新登录) $ip = tool::get_long_ip(); if ($ip != $login_ip) { remind::set(Kohana::lang('o_global.login_again'), 'login?request_url=' . $current_url); } $this->manager = $manager; $this->manager_id = $manager['id']; $this->manager_name = $manager['name']; $this->manager_is_admin = role::is_root($manager['name']) ? 1 : $manager['is_admin']; $this->template->manager_data = $manager; } else { remind::set(Kohana::lang('o_global.first_login'), 'login?request_url=' . $current_url); } }
/** * author zhubin * 删除用户地址 * @param int */ public function delete() { //权限验证 role::check('user_edit'); $address_info = $this->input->get(); if (empty($address_info) || !isset($address_info['address_id']) || !isset($address_info['user_id'])) { remind::set(Kohana::lang('o_global.bad_request'), 'user/address'); } if (Myaddress::instance()->delete($address_info['address_id'])) { remind::set(Kohana::lang('o_user.delete_user_address_success'), 'user/user/edit/' . $address_info['user_id'], 'success'); } else { remind::set(Kohana::lang('o_user.delete_user_address_failed'), 'user/user/edit/' . $address_info['user_id'], 'error'); } }
public function delete($templateId) { //权限检查 得到所有可管理站点ID列表 role::check('distribution_system_manage'); $templateDao = Superplaner_Realtime_contract_template::instance(); $template = $templateDao->get_by_id($templateId); if ($template == null) { remind::set(Kohana::lang('o_contract.contract_not_exists'), request::referrer(), 'error'); } if (Superplaner_Realtime_contract_template::instance($templateId)->delete()) { remind::set(Kohana::lang('o_global.delete_success'), request::referrer(), 'success'); } else { remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error'); } }
public function delete($cardTypeId) { //权限检查 得到所有可管理站点ID列表 role::check('card_system_manage'); $cardType = $this->cardTypeDao->get_by_id($cardTypeId); if ($cardType == null) { remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error'); return; } if ($this->cardTypeDao->delete($cardTypeId)) { remind::set(Kohana::lang('o_global.delete_success'), 'card/card_type', 'success'); return; } else { remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error'); return; } }
/** * 添加新支付类型 */ function add() { //权限验证 role::check('manage_payment_type'); if ($_POST) { //标签过滤 tool::filter_strip_tags($_POST); $payment_type = Mypayment_type::instance(); if ($payment_type->add($_POST)) { remind::set(Kohana::lang('o_global.add_success'), 'manage/payment_type', 'success'); } else { $errors = $payment_type->errors(); remind::set(Kohana::lang('o_global.add_error'), 'manage/payment_type/add', 'error'); } } $this->template->content = new View("manage/payment_type_add"); }
/** * 判断用户的操作权限 * * @param <String> $model_flag * @return <type> */ public static function check($model_flag = 'default') { //zhu modify $verify = self::verify($model_flag); //验证操作 if ($verify) { return $verify; } else { if (request::is_ajax()) { $return_struct = array('status' => 0, 'code' => 501, 'msg' => Kohana::lang('o_global.access_denied'), 'content' => array()); die(json_encode($return_struct)); } else { $referrer = tool::referrer_url(); remind::set('权限不足', $referrer, 'error'); } } }
public function queue_add($site) { if (empty($site)) { remind::set('域名或者IP出错,请检查下您的输入!', 'site/scan/add'); } else { if (filter_var($site, FILTER_VALIDATE_IP)) { $ip = $site; } else { if (filter_var(gethostbyname($site), FILTER_VALIDATE_IP)) { $ip = gethostbyname($site); } else { remind::set('域名或者IP出错,请检查下您的输入!', 'site/scan/add'); } } } $sign = $this->generate_code('queue', $ip); return $this->client->queue_add($ip, $sign, $this->ip); }
public function delete($moneyExchangeId) { //权限检查 得到所有可管理站点ID列表 role::check('card_system_manage'); $moneyExchange = $this->moneyExchangeDao->get_by_id($moneyExchangeId); if ($moneyExchange == null) { remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error'); return; } if ($moneyExchange['flag'] == 2) { remind::set("不能删除生效中的汇率方案", request::referrer(), 'error'); return; } if ($this->moneyExchangeDao->delete($moneyExchange)) { remind::set(Kohana::lang('o_global.delete_success'), 'card/money_exchange', 'success'); return; } else { remind::set(Kohana::lang('o_global.delete_error'), request::referrer(), 'error'); return; } }
cursor: 'wait', left: '49%', top: '49%' }, overlayCSS: { backgroundColor: '#000', opacity: 0.1 }, message: $('<img border="0" src="' + url_base + 'images/loading.gif">') }); }, close: function() { $.unblockUI(); } }; return t; }(); </script> </head> <body> <!--**error start**--> <?php echo remind::get(); ?> <!--**error end**--> <?php echo !empty($content) ? $content : ''; ?> </body> </html>
function del_country() { $return_struct = array(); $request_data = $this->input->get(); // 修改返回状态数据 $return_struct['status'] = 1; $return_struct['code'] = 200; $return_struct['msg'] = 'ok'; $delivery_service = DeliveryService::get_instance(); $delivery_country_service = Delivery_countryService::get_instance(); if (empty($request_data['delivery_id']) or empty($request_data['ids'])) { remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error'); } $delivery = $delivery_service->get($request_data['delivery_id']); if ($delivery['site_id'] != $this->site_id) { remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error'); } $query_ids = explode('-', $request_data['ids']); foreach ($query_ids as $ids) { $delivery_countries = $delivery_country_service->get($ids); if ($delivery_countries['delivery_id'] != $delivery['id']) { remind::set(Kohana::lang('o_global.access_denied'), request::referrer(), 'error'); break; } if (!$delivery_country_service->remove($ids)) { $return_struct['status'] = 0; $return_struct['code'] = 501; break; } } header('Content-Type: text/javascript; charset=UTF-8'); exit(json_encode($return_struct)); }
public function do_delete() { role::check('promotion_promotion'); // 收集请求数据 $request_data = $this->input->get(); $promotion = Mypromotion::instance($request_data['id'])->get(); if (!$promotion['id']) { remind::set(Kohana::lang('o_global.bad_request'), 'promotion/promotion_activity', 'error'); } if (Mypromotion::instance()->delete($promotion['id'])) { //promotion::delete_memcache($promotion['site_id']); remind::set(Kohana::lang('o_global.delete_success'), 'promotion/promotion_activity', 'success'); } }
public function update_order_status($status) { $request_data = $this->input->post(); if (empty($_POST)) { remind::set(Kohana::lang('o_global.bad_request'), '/order/order/index/' . $request_data['backurl']); } if (empty($request_data['order_ids'])) { remind::set(Kohana::lang('o_global.bad_request'), 'order/order/index/' . $request_data['backurl']); } if (Order_basic_Model::show_status($status) == FALSE) { remind::set(Kohana::lang('o_global.bad_request'), 'order/order/index/' . $request_data['backurl']); } $status_name = Order_basic_Model::show_status($status); $order_ids = $request_data['order_ids']; $logs_data = array(); $logs_data['manager_id'] = $this->manager_id; $logs_data['user_log_type'] = 28; $logs_data['ip'] = Input::instance()->ip_address(); for ($i = 0; $i < count($order_ids); $i++) { $order_info = $this->order_basic_obj->get_order_by_id($order_ids[$i]); if ($order_info && $order_info['status'] != $status) { $order_id = $order_info['id']; $u_ob_r = $this->order_basic_obj->update_status_by_order_id($order_id, $status); if ($u_ob_r == TRUE) { $order_details = $this->order_detail_obj->get_orders_by_orderid($order_id); if ($order_details) { for ($j = 0; $j < count($order_details); $j++) { $u_od_r = $this->order_detail_obj->update_status_by_id($order_details[$j]['id'], $status); if ($u_od_r == TRUE) { $logs_data['memo'] = "订单操作成功!状态:" . $status_name . ",订单号:" . $order_id . '(子订单:' . $order_details[$j]['id'] . ')'; ulog::instance()->add($logs_data); } else { $logs_data['memo'] = "订单操作失败!状态:" . $status_name . ",订单号:" . $order_id . '(子订单:' . $order_details[$j]['id'] . ')'; ulog::instance()->add($logs_data); } } } else { $logs_data['memo'] = "子订单不存在:" . $order_id; ulog::instance()->add($logs_data); } } else { $logs_data['memo'] = "订单操作失败!状态:" . $status_name . ",订单号:" . $order_id; ulog::instance()->add($logs_data); } } else { $logs_data['memo'] = "订单ID不存在或已取消:" . $order_id; ulog::instance()->add($logs_data); } } remind::set('操作完成,详见日志', '/order/order/index/' . $request_data['backurl'], 'success'); }
/** * 提交商品修改 */ public function post() { // 初始化返回结构体 $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array()); try { // 初始化返回数据 $return_data = array(); // 收集请求数据 $request_data = $this->input->post(); $request_data = trims::run($request_data); $url_redirect = url::base() . 'product/gift_card'; $id = isset($request_data['id']) ? (int) $request_data['id'] : 0; $on_sale = isset($request_data['on_sale']) ? (int) $request_data['on_sale'] : 0; $price = (int) $request_data['price']; if ($price <= 0) { throw new MyRuntimeException("价格必须为整数", 500); } $data = array('front_visible' => 0, 'type' => ProductService::PRODUCT_TYPE_GIFT_CARD, 'price' => $price, 'title' => $request_data['title'], 'sku' => $request_data['sku'], 'on_sale' => $on_sale); if ($id > 0) { $data['id'] = $id; $data['update_time'] = time(); ProductService::get_instance()->update($data); } else { $data['create_time'] = time(); $id = ProductService::get_instance()->add($data); } if ($id <= 0) { throw new MyRuntimeException(Kohana::lang('o_product.no_save'), 500); } remind::set(Kohana::lang('o_product.edit_product_success'), $url_redirect, 'success'); } catch (MyRuntimeException $ex) { $this->_ex($ex, $return_struct, $request_data); } }
public function edit() { role::check('product_auction'); $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array()); try { $id = $this->input->get('id'); $post = $this->input->post(); $auction_service = Product_auctionService::get_instance(); //d($post); if ($post) { $result = $auction_service->update($post); if (!$result) { throw new MyRuntimeException('Internal Error', 500); } else { remind::set('更新成功!', 'product/product_auction/', 'success'); } } if (empty($id)) { throw new MyRuntimeException(Kohana::lang('o_global.bad_request'), 400); } $data = $auction_service->get($id); $this->template->content = new View('product/auction/edit', array('data' => $data)); } catch (MyRuntimeException $ex) { $this->_ex($ex); } }
/** * 提交商品修改 */ public function post() { // 初始化返回结构体 $return_struct = array('status' => 0, 'code' => 501, 'msg' => 'Not Implemented', 'content' => array()); try { // 初始化返回数据 $return_data = array(); // 收集请求数据 $request_data = $this->input->post(); $request_data = trims::run($request_data); $url_redirect = url::base() . $this->package_name . '/' . $this->class_name; //标签过滤 商品描述保留 tool::filter_strip_tags($request_data, array('desc', 'pdtdes_content')); $product = $request_data; //收集商品详细描述表单数据 $product['descsections'] = array(); if (!empty($request_data['pdtdes_title']) and is_array($request_data['pdtdes_title'])) { foreach ($request_data['pdtdes_title'] as $index => $pdtdes_title) { $descsection = array('title' => $pdtdes_title, 'position' => isset($request_data['pdtdes_position'][$index]) ? $request_data['pdtdes_position'][$index] : '', 'content' => isset($request_data['pdtdes_content'][$index]) ? $request_data['pdtdes_content'][$index] : ''); if (isset($request_data['pdtdes_id'][$index])) { $descsection['id'] = $request_data['pdtdes_id'][$index]; } $product['descsections'][] = $descsection; } } //收集商品批发数据 $product['wholesales'] = array('type' => 0, 'items' => array()); isset($request_data['wholesale_type']) and $product['wholesales']['type'] = $request_data['wholesale_type']; if (isset($product['is_wholesale']) && $product['is_wholesale'] > 0) { if (!empty($request_data['wholesale_indexs']) and is_array($request_data['wholesale_indexs'])) { foreach ($request_data['wholesale_indexs'] as $index) { $wholesale = array(); isset($request_data['wholesale_num_begin_' . $index]) and $wholesale['num_begin'] = $request_data['wholesale_num_begin_' . $index]; isset($request_data['wholesale_value_' . $index]) and $wholesale['value'] = $request_data['wholesale_value_' . $index]; $product['wholesales']['items'][] = $wholesale; } } } BLL_Product::set(&$product); if ($product['id'] <= 0) { throw new MyRuntimeException(Kohana::lang('o_product.no_save'), 500); } if ($request_data['save_redirect'] == 1) { $url_redirect .= '/edit?id=' . $product['id']; } elseif ($request_data['save_redirect'] == 2) { $url_redirect .= '/add'; } remind::set(Kohana::lang('o_product.edit_product_success'), $url_redirect, 'success'); } catch (MyRuntimeException $ex) { $this->_ex($ex, $return_struct, $request_data); } }
/** * 配置站点的支付成功代码 */ public function pay_code() { // 初始化返回数据 $return_data = array(); //请求结构体 $request_data = array(); try { /* 管理员才能进行代码更新操作 */ if ($this->manager_is_admin == 1) { $site = Mysite::instance($this->site_id)->get(); $site_detail = Mysite::instance($this->site_id)->detail(); //无站点ID非法操作 if (!$site['id']) { throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 401); } //更新pay_code信息 if ($_POST) { $pay_code = $this->input->post('pay_code'); if (empty($pay_code)) { throw new MyRuntimeException(Kohana::lang('o_site.site_config_payment_success_cannot_submit'), 402); } //更新站点robots信息 $data = array(); $data['pay_code'] = $pay_code; if (Mysite_detail::instance()->update_by_site_id($this->site_id, $data)) { remind::set(Kohana::lang('o_global.update_success'), 'site/config/pay_code', 'success'); } else { remind::set(Kohana::lang('o_global.update_error'), 'site/config/pay_code'); } } $pay_code = isset($site_detail['pay_code']) ? $site_detail['pay_code'] : ''; $this->template->content = new View("site/pay_code"); $this->template->content->pay_code = $pay_code; } else { throw new MyRuntimeException(Kohana::lang('o_global.access_denied'), 403); } } catch (MyRuntimeException $ex) { $return_struct['status'] = 0; $return_struct['code'] = $ex->getCode(); $return_struct['msg'] = $ex->getMessage(); //TODO 异常处理 //throw $ex; if ($this->is_ajax_request()) { $this->template = new View('layout/empty_html'); $this->template->content = $return_struct['msg']; } else { $this->template->return_struct = $return_struct; $content = new View('info'); $this->template->content = $content; /* 请求结构数据绑定 */ $this->template->content->request_data = $request_data; /* 返回结构体绑定 */ $this->template->content->return_struct = $return_struct; } } }
/** * 删除 */ public function do_delete($id) { $total_products = 0; $total = 0; if (!$id) { remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error'); } //验证 $order_product_service = Order_productService::get_instance(); $data = $order_product_service->get($id); if (!$data['id']) { remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error'); } if ($order_product_service->remove($data['id'])) { if (Myorder::instance($data['order_id'])->update_total()) { remind::set(Kohana::lang('o_global.delete_success'), 'order/order/edit/id/' . $data['order_id'], 'success'); } else { remind::set(Kohana::lang('o_global.delete_error'), 'order/order/edit/id/' . $data['order_id'], 'error'); } } else { remind::set(Kohana::lang('o_global.delete_error'), 'order/order/edit/id/' . $data['order_id'], 'error'); } }
/** * 批量更新分类的name_url */ public function update_category_name_url() { $site = Mysite::instance($this->site_id)->get(); if ($_POST) { $domain = $this->input->post('domain'); if (empty($domain) || $domain != $site['domain']) { remind::set(Kohana::lang('o_global.input_error'), 'site/update/update_category_name_url'); } $query_struct = array('where' => array('site_id' => $this->site_id), 'like' => array(), 'orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'offset' => 0)); $category_count = Mycategory::instance()->count($query_struct); $category_names = array(); //1000个商品以下直接读取所有的商品 if ($category_count < 1000) { $query_struct['limit']['per_page'] = $category_count; $categorys = Mycategory::instance()->lists($query_struct); $category_name = array(); foreach ($categorys as $key => $value) { $category_name = $value['name']; //判断是否为中文的商品 if (preg_match('/[\\x7f-\\xff]/', $category_name)) { continue; } $category_name_url = strtolower(product::generate_name_url($category_name)); //过滤重复的NAME URL $name_url_exist = Mycategory::instance()->check_name_url($category_name_url, $this->site_id, $value['id']); $perfix = 1; while ($name_url_exist) { $category_name_url = $category_name_url . '-' . $perfix; $name_url_exist = Mycategory::instance()->check_name_url($category_name_url, $this->site_id, $value['id']); $perfix++; } $data = array(); $data['name_url'] = $category_name_url; if (!Mycategory::instance($value['id'])->edit($data)) { $category_names[] = $value['name']; } } } else { remind::set(Kohana::lang('o_site.product_request_check'), 'site/update/update_category_name_url'); } if (count($category_names) > 0) { $category_name_str = ''; foreach ($category_names as $key => $value) { $category_name_str = $value . '|'; } remind::set(Kohana::lang('o_site.name_update_error') . $category_name_str, 'site/update/update_category_name_url'); } else { remind::set(Kohana::lang('o_site.name_update_success'), 'site/update/update_category_name_url', 'success'); } } $this->template->content = new View("site/update_category_name_url"); $this->template->content->site = $site; }
public function delete($id) { $doc = Mydoc::instance($id); $doc->delete(); remind::set(Kohana::lang('o_global.delete_success'), 'site/doc', 'success'); }
/** * 任务下达 * @param $type */ public function add($type = 'dlt') { if (empty($_POST)) { remind::set("未选择下达任务!", '/lottnum/jobs/index/' . $type . '/', 'error'); } $lottyid = lottnum::getlottid($type); $issue = $this->input->post('issue'); $jtype = $this->input->post('jtype'); $query_struct_default = array('where' => array('lotyid' => $lottyid, 'qihao' => $issue)); $qhservice = Qihaoservice::get_instance(); $qihao = $qhservice->query_data_list($query_struct_default); if ($qihao) { if (time() <= strtotime($qihao[0]['endtime'])) { remind::set($issue . "期未截止不能下达清算任务!", '/lottnum/jobs/index/' . $type . '/', 'error'); } } else { remind::set($issue . "期不存在不可做任务下达!", '/lottnum/jobs/index/' . $type . '/', 'error'); } if ($jtype == 2) { $query_struct_default = array('where' => array('lottyid' => $lottyid, 'qihao' => $issue, 'tasktype' => 1)); $jobobj = Lotty_jobService::get_instance(); $job = $jobobj->query_data_list($query_struct_default); if (count($job) == 0) { remind::set($issue . "期清算任务未下达,不可下达算奖任务!", '/lottnum/jobs/index/' . $type . '/', 'error'); } else { if ($qihao[0]['qsstat'] != 1) { remind::set($issue . "期清算任务未完成不可做任务下达!", '/lottnum/jobs/index/' . $type . '/', 'error'); } } } elseif ($jtype == 3) { $query_struct_default = array('where' => array('lottyid' => $lottyid, 'qihao' => $issue, 'tasktype' => 2)); $jobobj = Lotty_jobService::get_instance(); $job = $jobobj->query_data_list($query_struct_default); if (count($job) == 0) { remind::set($issue . "期算奖任务未下达,不可下达派奖任务!", '/lottnum/jobs/index/' . $type . '/', 'error'); } } $data = array(); $data['lottyid'] = $lottyid; $data['qihao'] = $issue; $data['tasktype'] = $jtype; $data['ctime'] = date("Y-m-d H:i:s"); $data['stat'] = 0; $data['manager'] = $this->manager['username']; $flag = Lotty_jobService::get_instance()->add($data); if ($flag > 0) { remind::set("任务下达成功!", '/lottnum/jobs/index/' . $type . '/', 'success'); } else { remind::set("任务下达失败!", '/lottnum/jobs/index/' . $type . '/', 'error'); } }
<td><?php echo $rs['submit_url']; ?> </td> </tr> <?php } ?> </tbody> </form> </table> <?php } else { ?> <?php echo remind::no_rows(); ?> <?php } ?> </div> </div> <!--**content end**--> <script type="text/javascript"> $(function() { //删除支付类型 $("#batch_delete").click(function(){ var i = false; $('.sel').each(function(){ if(i == false){
public function open_bill_detail($openBillId) { //权限检查 得到所有可管理站点ID列表 role::check('card_system_manage'); if ($openBillId == null) { remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error'); return; } $openBill = $this->issueBillDao->get_by_id($openBillId); if ($openBill == null) { remind::set(Kohana::lang('o_global.bad_request'), request::referrer(), 'error'); return; } $this->template->content = new View("card/open_bill_detail"); $this->template->content->openBill = $openBill; $this->template->content->channelList = $this->salesChannelMap; }