/** * 删除样品包装 * @param $get * @return Result */ public function delete($get) { $id = $get['id']; $sample_id = $get['sample_id']; SamplePackage::delByPk($id); return new Result('操作成功', true, null, Router::getUrl('SamplePackage/showSamplePackageList', array('sample_id' => $sample_id))); }
/** * 跟新订单 * @param $get * @param $post * @return \Lite\Core\Result|void */ public function update($get, $post) { $id = $get['id']; $order = $id ? BusinessOrder::findOneByPk($id) : new BusinessOrder(); if ($post) { $post['order_no'] = $order->order_no ?: BusinessOrder::generateOrderNo(); $r = Result::convert(parent::update($get, $post)); if ($r->isSuccess()) { $data = $r->getData(); $r->setJumpUrl(Router::getUrl('BusinessOrder/info', array('id' => $data['id']))); } return $r; } $pay_type_list = PayType::find('state = ?', PayType::STATE_ENABLED)->all(); $default_customer_list = Customer::find()->order(' id asc ')->limit(10)->all(); if ($order->customer_id) { $order_customer = Customer::find('id = ?', $order->customer_id)->all(); if ($order_customer) { $default_customer_list = array_merge($default_customer_list, $order_customer); } } $default_customer_contact_list = array(); if ($order->customer_id) { $default_customer_contact_list = CustomerContact::find('customer_id = ?', $order->customer_id)->all(true); } return array('order' => $order, 'order_type_list' => $order->getPropertiesDefine('order_type')['options'], 'pay_type_list' => $pay_type_list, 'default_customer_list' => $default_customer_list, 'default_customer_contact_list' => $default_customer_contact_list); }
public function index($search) { $result = Result::convert(parent::index($search)); $result->addData(array('operation_link_list' => array(function (User $item) { return '<a href="' . Router::getUrl('user/updatePassword', array('id' => $item->id)) . '" rel="popup">修改密码</a>'; }))); return $result; }
/** * @param $get * @param $post * @return \Lite\Core\Result */ public function update($get, $post) { if ($post) { $post['op_user_id'] = Auth::instance()->getLoginUserId(); } $result = parent::update($get, $post); if ($post) { $data = $result->getData(); $result->setJumpUrl(Router::getUrl('Customer/info', array('id' => $data['id']))); } return $result; }
public function updateUserGroupAccess($get, $post) { $user_group_id = $get['user_group_id'] ?: $post['user_group_id']; if (Router::isPost()) { $ex = Model::transaction(function () use($post, $user_group_id) { $con = "user_group_id = '" . addslashes($user_group_id) . "'"; UserGroupAuth::deleteWhere(0, $con); $data = array(); if ($post['act_bids']) { foreach ($post['act_bids'] as $act_id) { $data[] = array('user_group_id' => $user_group_id, 'action_id' => $act_id, 'type' => UserGroupAuth::TYPE_BLACK); } } if ($post['act_wids']) { foreach ($post['act_wids'] as $act_id) { $data[] = array('user_group_id' => $user_group_id, 'action_id' => $act_id, 'type' => UserGroupAuth::TYPE_BLACK); } } if ($data) { UserGroupAuth::insertMany($data); } }); return new Result(!$ex ? '操作成功' : $ex->getMessage(), !$ex, null, Router::getUrl('UserGroup')); } if (!$user_group_id) { $tmp = UserGroup::find()->one(); $user_group_id = $tmp->id; } $act_list = AccessAction::find()->all(true); $act_ids = array_column($act_list, 'id'); //user_group values $w_user_group_values = $b_user_group_values = array(); if ($act_ids) { $user_group_values = UserGroupAuth::find('action_id IN ? AND user_group_id = ?', $act_ids, $user_group_id)->all(true); foreach ($user_group_values as $val) { if ($val['type'] == UserGroupAuth::TYPE_WHITE) { $w_user_group_values[$val['action_id']] = $val; } else { $b_user_group_values[$val['action_id']] = $val; } } } array_orderby($act_list, 'desc', SORT_DESC); $white_list = $black_list = array(); foreach ($act_list as $act) { $a = $this->convertPathToArray('全部/' . $act['desc'], array($act['id'], $act['uri'], !!$w_user_group_values[$act['id']])); $white_list = array_merge_recursive($white_list, $a); $b = $this->convertPathToArray('全部/' . $act['desc'], array($act['id'], $act['uri'], !!$b_user_group_values[$act['id']])); $black_list = array_merge_recursive($black_list, $b); } return array('user_group_id' => $user_group_id, 'auth_list' => array($white_list, $black_list), 'user_group_list' => UserGroup::find()->all()); }
public function uploadImage() { if (Router::isPost()) { $file = $_FILES['file']; if (empty($file['name'])) { return new Result('请选择文件', false); } $ext = $this->getFileExt($file['type']); if (!$ext) { return new Result('文件类型不符合,请重新选择文件上传', false); } $rsp = Request::postFiles(Config::get('upload/host'), array(), array('file' => $file['tmp_name'])); $result = json_decode($rsp, true); if ($result['code'] == '0') { return new Result('图片上传成功', null, array('src' => Config::get('upload/url') . $result['data'], 'value' => $result['data'])); } return new Result('图片上传失败,请稍候重试', null, $rsp); } return array('UPLOAD_PAGE_URL' => Router::getUrl('index/uploadImage')); }
public static function checkAuth($controller, $action) { if (!$controller || !$action) { return; } $result = self::isAuthAction($controller, $action); if (!$result) { if (!self::instance()->isLogin()) { $url = Router::getUrl('index/login'); $html = <<<EOT <!doctype html> <html lang="en"> <head> \t<meta charset="UTF-8"> \t<title>Document</title> \t<script>top.location.href="{$url}";</script> </head> <body> \t正在登录系统... </body> </html> EOT; die($html); } else { //暂时不返回 $viewer = new ViewBase(); echo $viewer->render('index/deny.php', true); die; } } }
'; var UEDITOR_HOME_URL = '<?php echo Config::get('app/richeditor_home'); ?> '; var UPLOAD_URL = '<?php echo Router::getUrl('upload/file', array('ref' => 'json')); ?> '; var UPLOAD_PROGRESS_URL = '<?php echo Router::getUrl('upload/progress', array('ref' => 'json')); ?> '; var CGI_ADD_SAMPLE = '<?php echo Router::getUrl('sample/quickAddSample', array('ref' => 'iframe')); ?> '; var CGI_SEARCH_SAMPLE = '<?php echo $this->getUrl('Sample/getSampleInfoByNo'); ?> '; </script> <?php echo $this->getCss($cdn_url . 'ywj/ui/backend/default.css'); echo $this->getCss($cdn_url . 'ywj/ui/backend/theme-sidelayout.css'); echo $this->getCss($cdn_url . 'ywj/ui/backend/font-awesome.css'); echo $this->getCss('patch.css'); echo $this->getJs($cdn_url . 'seajs/sea.js'); echo $this->getJs($cdn_url . 'seajs/config.js'); echo $this->getJs($cdn_url . 'ywj/component/imagescale.js');
/** * 删除单件眼样品的工艺 * @param $get * @return Result */ public function deleteSampleTechnic($get) { $id = $get['id']; $sample_id = $get['sample_id']; SampleTechnic::delByPk($id); return new Result('操作成功', true, null, Router::getUrl('Sample/updateSampleTechnic', array('sample_id' => $sample_id))); }