當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Route::makeUrl方法代碼示例

本文整理匯總了PHP中Core\Helper\Utility\Route::makeUrl方法的典型用法代碼示例。如果您正苦於以下問題:PHP Route::makeUrl方法的具體用法?PHP Route::makeUrl怎麽用?PHP Route::makeUrl使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Core\Helper\Utility\Route的用法示例。


在下文中一共展示了Route::makeUrl方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: preparePage

 private function preparePage($goods_id, $pageNo)
 {
     global $smarty;
     // 設置缺省值
     $pageNo = isset($pageNo) && $pageNo > 0 ? $pageNo : 0;
     $pageSize = 10;
     // 每頁顯示 10 個
     // 查詢條件
     $condArray = array();
     $condArray[] = array('goods_id = ?', $goods_id);
     $condArray[] = array('is_show = 1');
     $baseService = new BaseService();
     $totalCount = $baseService->_countArray('goods_comment', $condArray);
     if ($totalCount <= 0) {
         // 沒數據,可以直接退出了
         return;
     }
     // 頁數超過最大值
     if ($pageNo * $pageSize >= $totalCount) {
         return;
     }
     // 查詢數據
     $goodsCommentArray = $baseService->_fetchArray('goods_comment', '*', $condArray, array('order' => 'comment_id desc'), $pageNo * $pageSize, $pageSize);
     // 給 smarty 賦值
     $smarty->assign('currentUrl', RouteHelper::makeUrl('/Ajax/GoodsComment', array('goods_id' => $goods_id)));
     $smarty->assign('totalCount', $totalCount);
     $smarty->assign('pageNo', $pageNo);
     $smarty->assign('pageSize', $pageSize);
     $smarty->assign('goodsCommentArray', $goodsCommentArray);
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:30,代碼來源:GoodsComment.php

示例2: get

 /**
  * 360 一站通登陸
  */
 public function get($f3)
 {
     // 標準動態鏈接,不能偽靜態地址
     $callback = RouteHelper::makeUrl('/Thirdpart/Dev360Auth/Callback', null, false, true, false);
     $params = array('client_id' => Dev360AuthPlugin::getOptionValue(self::$optionKeyPrefix . 'dev360auth_app_key'), 'redirect_uri' => $callback, 'response_type' => 'code');
     $url = 'https://openapi.360.cn/oauth2/authorize?' . http_build_query($params);
     header("Location: {$url}");
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:11,代碼來源:Login.php

示例3: smarty_helper_function_make_url

/**
 * 用於生成係統的操作鏈接,符合係統 URL 調用規範
 *
 * 在模板中的使用方法 {{makeUrl controller='/User/Login' username='xxx' password='xxx' }}
 *
 * 必須要有 controller 用於指定控製器,其它參數可以沒有
 *
 * */
function smarty_helper_function_make_url(array $paramArray, $smarty)
{
    $controller = isset($paramArray['controller']) ? $paramArray['controller'] : '/Error/E404';
    $static = isset($paramArray['static']) ? $paramArray['static'] : null;
    // 去除 controller, static ,其它都是控製器的參數
    unset($paramArray['controller']);
    unset($paramArray['static']);
    return RouteHelper::makeUrl($controller, $paramArray, false, false, $static);
}
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:17,代碼來源:smarty_helper.php

示例4: post

 public function post($f3)
 {
     global $smarty;
     // 首先做參數合法性驗證
     $validator = new Validator($f3->get('POST'));
     $input = array();
     $input['user_name'] = $validator->required('用戶名不能為空')->minLength(2, '用戶名最短為2個字符')->validate('user_name');
     $input['password'] = $validator->required('密碼不能為空')->minLength(6, '密碼最短為6個非空字符')->validate('password');
     $input['email'] = $validator->validate('email');
     $input['mobile_phone'] = $validator->digits('手機號格式不對')->validate('mobile_phone');
     $p_captcha = $validator->required('驗證碼不能為空')->validate('captcha');
     // 手機輸入,輸入法經常無故添加空格,我們需要去除所有的空額,防止出錯
     $p_captcha = Utils::filterAlnumStr($p_captcha);
     // 需要跳轉回去的地址
     $returnUrl = $validator->validate('returnUrl');
     if (!$this->validate($validator)) {
         goto out_fail;
     }
     // 檢查驗證碼是否有效
     $captchaController = new \Controller\Image\Captcha();
     if (!$captchaController->validateCaptcha($p_captcha)) {
         $this->addFlashMessage('驗證碼錯誤[' . $p_captcha . '][' . $captchaController->getCaptcha() . ']');
         goto out_fail;
     }
     $userService = new UserService();
     // 檢查用戶是否已經注冊
     $isUserExist = $userService->isUserExist($input['user_name'], $input['email']);
     if ($isUserExist) {
         $this->addFlashMessage($isUserExist . '已經存在');
         goto out_fail;
     }
     // 注冊用戶
     $user = $userService->registerUser($input);
     if (!$user) {
         $this->addFlashMessage('用戶注冊失敗,請稍後刷新頁麵重試');
         goto out_fail;
     }
     // 記錄用戶的登陸信息
     $userInfo = $user->toArray();
     unset($userInfo['password']);
     // 不要記錄密碼
     AuthHelper::saveAuthUser($userInfo, 'normal');
     $this->addFlashMessage("注冊成功");
     if ($returnUrl) {
         header('Location:' . $returnUrl);
         return;
     } else {
         // 跳轉到用戶之前看的頁麵,如果之前沒有看過的頁麵那就回到首頁
         RouteHelper::jumpBack($this, '/', true);
     }
     return;
     // 這裏正常返回
     out_fail:
     // 失敗,從這裏出口
     $smarty->assign('captchaUrl', RouteHelper::makeUrl('/Image/Captcha', array('hash' => time())));
     $smarty->display('user_register.tpl', 'User|Register|post');
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:57,代碼來源:Register.php

示例5: pluginGetConfigureUrl

 public function pluginGetConfigureUrl($system)
 {
     // manage 係統可以配置這個插件
     if (PluginHelper::SYSTEM_MANAGE === $system) {
         return RouteHelper::makeUrl('/Thirdpart/EtaoFeed/Configure');
     }
     // 其它係統不需要配置
     return null;
 }
開發者ID:swcug,項目名稱:bzfshop,代碼行數:9,代碼來源:plugin_load.php

示例6: get

 /**
  * QQ 登陸
  */
 public function get($f3)
 {
     $callback = RouteHelper::makeUrl('/Thirdpart/QQAuth/Callback', null, false, true);
     $qqLoginState = md5(uniqid(rand(), true));
     // 防止 csrf 攻擊
     $f3->set('SESSION[qq_login_state]', $qqLoginState);
     $loginUrl = "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=" . QQAuthPlugin::getOptionValue('qqauth_appid') . "&redirect_uri=" . urlencode($callback) . "&state=" . $qqLoginState . "&scope=get_user_info";
     header("Location:{$loginUrl}");
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:12,代碼來源:Login.php

示例7: get

    public function get($f3)
    {
        global $smarty;
        $smartyCacheId = 'EtaoFeed|' . md5(__NAMESPACE__ . '\\' . __CLASS__ . '_\\' . __METHOD__);
        // 判斷是否有緩存
        enableSmartyCache(true, 1200);
        // 緩存 20 分鍾
        if ($smarty->isCached('empty.tpl', $smartyCacheId)) {
            goto out_display;
        }
        $currentStamp = Time::localTimeStr();
        $sellerId = EtaoFeedPlugin::getOptionValue('etaofeed_seller_id');
        $categoryUrl = RouteHelper::makeUrl('/Thirdpart/EtaoFeed/Category', null, false, true);
        $itemDir = RouteHelper::makeUrl('/Thirdpart/EtaoFeed/Item', null, false, true);
        $itemIdXmlList = '';
        // 處理 delete 的商品
        $currentThemeInstance = ThemeHelper::getCurrentSystemThemeInstance();
        $totalGoodsCount = SearchHelper::count(SearchHelper::Module_Goods, array(array('is_on_sale = 0'), array('update_time', '>=', EtaoFeedPlugin::getOptionValue('etaofeed_query_timestamp')), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray()))));
        if ($totalGoodsCount <= 0) {
            goto query_update_goods;
        }
        $totalPageCount = ceil($totalGoodsCount / Item::$pageSize);
        for ($index = 0; $index < $totalPageCount; $index++) {
            $itemIdXmlList .= '<outer_id action="delete">1' . $index . '</outer_id>';
        }
        query_update_goods:
        // 處理修改過的商品
        $totalGoodsCount = SearchHelper::count(SearchHelper::Module_Goods, array(array('is_on_sale = 1'), array('update_time', '>=', EtaoFeedPlugin::getOptionValue('etaofeed_query_timestamp')), array(QueryBuilder::buildGoodsFilterForSystem($currentThemeInstance->getGoodsFilterSystemArray()))));
        if ($totalGoodsCount <= 0) {
            goto out_output;
        }
        $totalPageCount = ceil($totalGoodsCount / Item::$pageSize);
        for ($index = 0; $index < $totalPageCount; $index++) {
            $itemIdXmlList .= '<outer_id action="upload">2' . $index . '</outer_id>';
        }
        out_output:
        $apiXml = <<<XML
<?xml version="1.0" encoding="utf-8" ?>
<root>
  <version>1.0</version>
  <modified>{$currentStamp}</modified>
  <seller_id>{$sellerId}</seller_id>
  <cat_url>{$categoryUrl}</cat_url>
  <dir>{$itemDir}/</dir>
  <item_ids>{$itemIdXmlList}</item_ids>
</root>
XML;
        $smarty->assign('outputContent', $apiXml);
        // 更新查詢時間
        //EtaoFeedPlugin::saveOptionValue('etaofeed_query_timestamp', Time::gmTime());
        out_display:
        header('Content-Type:text/xml;charset=utf-8');
        header("Cache-Control: no-cache, must-revalidate");
        // HTTP/1.1 //查詢信息
        $smarty->display('empty.tpl', $smartyCacheId);
    }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:56,代碼來源:IncIndex.php

示例8: post

 public function post($f3)
 {
     global $smarty;
     // 首先做參數合法性驗證
     $validator = new Validator($f3->get('POST'));
     $input = array();
     $input['user_name'] = $validator->required('用戶名不能為空')->validate('user_name');
     $input['password'] = $validator->required('密碼不能為空')->validate('password');
     $p_captcha = $validator->required('驗證碼不能為空')->validate('captcha');
     // 手機輸入,輸入法經常無故添加空格,我們需要去除所有的空額,防止出錯
     $p_captcha = Utils::filterAlnumStr($p_captcha);
     // 需要跳轉回去的地址
     $returnUrl = $validator->validate('returnUrl');
     if (!$this->validate($validator)) {
         goto out_fail;
     }
     // 檢查驗證碼是否有效
     $captchaController = new \Controller\Image\Captcha();
     if (!$captchaController->validateCaptcha($p_captcha)) {
         $this->addFlashMessage('驗證碼錯誤[' . $p_captcha . '][' . $captchaController->getCaptcha() . ']');
         goto out_fail;
     }
     $userService = new UserService();
     // 驗證用戶登陸
     $user = $userService->doAuthUser($input['user_name'], $input['user_name'], $input['password']);
     if (!$user) {
         $this->addFlashMessage("登陸失敗,用戶名、密碼錯誤");
         goto out_fail;
     }
     // 記錄用戶的登陸信息
     $userInfo = $user->toArray();
     unset($userInfo['password']);
     // 不要記錄密碼
     AuthHelper::saveAuthUser($userInfo, 'normal');
     $this->addFlashMessage("登陸成功");
     if ($returnUrl) {
         header('Location:' . $returnUrl);
         return;
     } else {
         // 跳轉到用戶之前看的頁麵,如果之前沒有看過的頁麵那就回到首頁
         RouteHelper::jumpBack($this, '/', true);
     }
     return;
     // 這裏正常返回
     out_fail:
     // 失敗從這裏出口
     $smarty->assign('captchaUrl', RouteHelper::makeUrl('/Image/Captcha', array('hash' => time())));
     $smarty->display('user_login.tpl', 'User|Login|post');
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:49,代碼來源:Login.php

示例9: Edit

 /**
  * 更新或者新建一個快遞公司
  *
  * @param $f3
  */
 public function Edit($f3)
 {
     // 權限檢查
     $this->requirePrivilege('manage_misc_express_edit');
     global $smarty;
     // 參數驗證
     $validator = new Validator($f3->get('GET'));
     $meta_id = $validator->digits()->validate('meta_id');
     $meta_id = $meta_id ?: 0;
     //  加載 快遞信息
     $expressService = new ExpressService();
     $expressInfo = $expressService->loadMetaById($meta_id);
     if (Request::isRequestGet()) {
         goto out_assign;
     }
     // 安全性檢查
     if ($meta_id > 0) {
         if ($expressInfo->isEmpty() || ExpressService::META_TYPE != $expressInfo->meta_type) {
             $this->addFlashMessage('非法ID[' . $meta_id . ']');
             goto out;
         }
     }
     unset($validator);
     $validator = new Validator($f3->get('POST'));
     $inputArray = array();
     $inputArray['meta_type'] = ExpressService::META_TYPE;
     $inputArray['meta_name'] = $validator->required()->validate('meta_name');
     $inputArray['meta_ename'] = $validator->required()->validate('meta_ename');
     $inputArray['meta_sort_order'] = $validator->digits()->validate('meta_sort_order');
     $inputArray['meta_status'] = $validator->digits()->validate('meta_status');
     $inputArray['meta_desc'] = $validator->validate('meta_desc');
     if (!$this->validate($validator)) {
         goto out;
     }
     // 保存
     $expressInfo->copyFrom($inputArray);
     $expressInfo->save();
     $this->addFlashMessage('快遞信息保存成功');
     // POST 成功從這裏退出
     RouteHelper::reRoute($this, RouteHelper::makeUrl('/Misc/Express/Edit', array('meta_id' => $expressInfo->meta_id), true));
     return;
     out_assign:
     $smarty->assign($expressInfo->toArray());
     out:
     $smarty->display('misc_express_edit.tpl');
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:51,代碼來源:Express.php

示例10: Edit

 public function Edit($f3)
 {
     // 權限檢查
     $this->requirePrivilege('manage_article_category_edit');
     global $smarty;
     // 參數驗證
     $validator = new Validator($f3->get('GET'));
     $meta_id = $validator->digits()->validate('meta_id');
     $meta_id = $meta_id ?: 0;
     //  加載 分類信息
     $articleCategoryService = new ArticleCategoryService();
     $articleCategory = $articleCategoryService->loadArticleCategoryById($meta_id);
     if (Request::isRequestGet()) {
         goto out_assign;
     }
     // 安全性檢查
     if ($meta_id > 0) {
         if ($articleCategory->isEmpty() || ArticleCategoryService::META_TYPE != $articleCategory->meta_type) {
             $this->addFlashMessage('非法ID[' . $meta_id . ']');
             goto out;
         }
     }
     unset($validator);
     $validator = new Validator($f3->get('POST'));
     $inputArray = array();
     $inputArray['meta_type'] = ArticleCategoryService::META_TYPE;
     $inputArray['meta_name'] = $validator->required()->validate('meta_name');
     $inputArray['meta_sort_order'] = $validator->digits()->validate('meta_sort_order');
     $inputArray['meta_desc'] = $validator->validate('meta_desc');
     if (!$this->validate($validator)) {
         goto out;
     }
     // 保存
     $articleCategory->copyFrom($inputArray);
     $articleCategory->save();
     $this->addFlashMessage('分類信息保存成功');
     // POST 成功從這裏退出
     RouteHelper::reRoute($this, RouteHelper::makeUrl('/Article/Category/Edit', array('meta_id' => $articleCategory->meta_id), true));
     return;
     out_assign:
     $smarty->assign($articleCategory->toArray());
     out:
     $smarty->display('article_category_edit.tpl');
 }
開發者ID:swcug,項目名稱:bzfshop,代碼行數:44,代碼來源:Category.php

示例11: __call

 /**
  * 采用 Magic 方法來實現,就不用每個支付方式都實現一次了
  */
 public function __call($method, $args)
 {
     global $f3;
     $payGateway = PaymentGatewayHelper::getPaymentGateway($method);
     $ret = $payGateway->doReturnUrl($f3);
     if ($ret) {
         $this->addFlashMessage('訂單支付成功');
     } else {
         $this->addFlashMessage('訂單支付失敗,請聯係在線客服');
     }
     $order_id = $payGateway->getOrderId();
     if (!empty($order_id)) {
         // 跳轉到訂單查看
         RouteHelper::reRoute($this, RouteHelper::makeUrl('/My/Order/Detail', array('order_id' => $order_id), true));
         return;
     }
     // 跳轉到我的訂單
     RouteHelper::reRoute($this, '/My/Order');
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:22,代碼來源:PaymentReturn.php

示例12: post

 public function post($f3)
 {
     // 權限檢查
     $this->requirePrivilege('manage_goods_edit_edit_post');
     global $smarty;
     // 參數驗證
     $validator = new Validator($f3->get('GET'));
     $goods_id = $validator->required('商品ID不能為空')->digits()->min(1)->validate('goods_id');
     if (!$this->validate($validator)) {
         goto out_fail_list_goods;
     }
     unset($validator);
     // 用戶提交的商品信息做驗證
     $goodsPromoteInfo = $f3->get('POST.goods_promote');
     if (empty($goodsPromoteInfo)) {
         goto out_fail_validate;
     }
     //安全性處理
     unset($goodsPromoteInfo['promote_id']);
     $goodsPromoteInfo['goods_id'] = $goods_id;
     // 寫入到數據庫
     $goodsBasicService = new GoodsBasicService();
     $goodsPromote = $goodsBasicService->loadGoodsPromoteByGoodsId($goods_id);
     $goodsPromote->copyFrom($goodsPromoteInfo);
     $goodsPromote->save();
     // 記錄商品編輯日誌
     $goodsLogContent = '360分類:' . $goodsPromote['360tuan_category'] . ',' . $goodsPromote['360tuan_category_end'] . "\n" . "360排序:" . $goodsPromote['360tuan_sort_order'];
     $authAdminUser = AuthHelper::getAuthUser();
     $goodsLogService = new GoodsLogService();
     $goodsLogService->addGoodsLog($goods_id, $authAdminUser['user_id'], $authAdminUser['user_name'], static::$goodsLogDesc, $goodsLogContent);
     // 成功,顯示商品詳情
     $this->addFlashMessage('商品推廣渠道保存成功');
     //清除緩存,確保商品顯示正確
     ClearHelper::clearGoodsCacheById($goods_id);
     RouteHelper::reRoute($this, RouteHelper::makeUrl('/Goods/Edit/Promote', array('goods_id' => $goods_id), true));
     return;
     // 參數驗證失敗
     out_fail_validate:
     $smarty->display('goods_edit_promote.tpl');
     return;
     out_fail_list_goods:
     RouteHelper::reRoute($this, '/Goods/Search');
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:43,代碼來源:Promote.php

示例13: getGoodsItemXml

    private function getGoodsItemXml($index, $goodsItem, $goodsIdToGalleryArray)
    {
        global $f3;
        $siteName = $f3->get('sysConfig[site_name]');
        $goodsViewUrl = RouteHelper::makeUrl('/Goods/View', array('goods_id' => $goodsItem['goods_id']), false, true);
        $goodsViewUrl = RouteHelper::addParam($goodsViewUrl, array('utm_source' => 'baidutuan'));
        $goodsImageUrl = '';
        if (isset($goodsIdToGalleryArray[$goodsItem['goods_id']])) {
            $goodsImageUrl = RouteHelper::makeImageUrl($goodsIdToGalleryArray[$goodsItem['goods_id']][0]['img_url']);
        }
        // 購買數量
        $bought = $goodsItem['virtual_buy_number'] + $goodsItem['user_pay_number'];
        // 轉換價格顯示
        $goodsItem['market_price'] = Money::toSmartyDisplay($goodsItem['market_price']);
        $goodsItem['shop_price'] = Money::toSmartyDisplay($goodsItem['shop_price']);
        $rebate = 0;
        if ($goodsItem['market_price'] > 0) {
            $rebate = 10 * round($goodsItem['shop_price'] / $goodsItem['market_price'], 2);
        }
        $today = strtotime(date('Ymd'));
        $twoDaysLater = $today + 86400 * 2;
        $xmlitem = <<<XMLITEM
\t<url>
\t    <loc><![CDATA[{$goodsViewUrl}]]></loc>
\t    <data><display>
\t\t<website><![CDATA[{$siteName}]]></website>
\t\t<siteurl><![CDATA[{$this->siteUrl}]]></siteurl>
\t\t<city>全國</city>
\t\t<title><![CDATA[{$goodsItem['goods_name']}]]></title>
\t\t<image><![CDATA[{$goodsImageUrl}]]></image>
\t\t<startTime>{$today}</startTime>
\t\t<endTime>{$twoDaysLater}</endTime>
        <value>{$goodsItem['market_price']}</value>
        <price>{$goodsItem['shop_price']}</price>
        <rebate>{$rebate}</rebate>
        <bought>{$bought}</bought>
        </display></data>
        </url>
XMLITEM;
        return $xmlitem;
    }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:41,代碼來源:Baidu.php

示例14: Update


//.........這裏部分代碼省略.........
             // 設置額外餘額,需要重新計算 order_info 中的值
             $diffDiscount = 0;
             if ($orderGoods->extra_discount != $updateValueArray['extra_discount']) {
                 $diffDiscount = $updateValueArray['extra_discount'] - $orderGoods->extra_discount;
             }
             $orderInfo->extra_discount += $diffDiscount;
             $orderInfo->order_amount -= $diffDiscount;
             $action_note .= '額外優惠:' . Money::toSmartyDisplay($updateValueArray['extra_discount']) . ",";
             $action_note .= '優惠說明:' . $updateValueArray['extra_discount_note'] . "\n";
             break;
         case 'set_suppliers_price':
             $action_note .= '供貨價:' . Money::toSmartyDisplay($updateValueArray['suppliers_price']) . ",";
             $action_note .= '供貨快遞費:' . Money::toSmartyDisplay($updateValueArray['suppliers_shipping_fee']) . "\n";
             break;
         case 'set_shipping_no':
             if ($updateValueArray['shipping_id'] > 0) {
                 //取得快遞信息
                 $expressService = new ExpressService();
                 $expressInfo = $expressService->loadMetaById($updateValueArray['shipping_id']);
                 if ($expressInfo->isEmpty() || ExpressService::META_TYPE != $expressInfo['meta_type']) {
                     $this->addFlashMessage('快遞ID非法');
                     goto out;
                 }
                 $updateValueArray['shipping_name'] = $expressInfo['meta_name'];
             } else {
                 $updateValueArray['shipping_name'] = null;
             }
             $action_note .= '快遞公司:' . $updateValueArray['shipping_name'] . "\n";
             $action_note .= '快遞單號:' . $updateValueArray['shipping_no'] . "\n";
             break;
         case 'set_memo':
             $action_note .= '客服備注:' . $updateValueArray['memo'] . "\n";
             break;
         case 'set_refund':
             // 檢查訂單狀態
             if (!in_array($orderGoods['order_goods_status'], array(OrderGoodsService::OGS_PAY, OrderGoodsService::OGS_ASKREFUND))) {
                 $this->addFlashMessage('訂單狀態非法,不能退款');
                 goto out;
             }
             if ($orderGoods['settle_id'] > 0) {
                 $this->addFlashMessage('已經結算的訂單不能退款');
                 goto out;
             }
             // 訂單設置為 申請退款
             $updateValueArray['order_goods_status'] = OrderGoodsService::OGS_ASKREFUND;
             // 同步更新 order_info 中的 refund 字段
             $diffRefund = 0;
             if ($orderGoods->refund != $updateValueArray['refund']) {
                 $diffRefund = $updateValueArray['refund'] - $orderGoods->refund;
             }
             $orderInfo->refund += $diffRefund;
             // 檢查金額,對一些常見錯誤提出警告
             if (0 == $updateValueArray['refund']) {
                 $this->addFlashMessage('警告:你確定給顧客退款金額設置為 ' . Money::toSmartyDisplay($updateValueArray['refund']) . ' ?');
             }
             if (0 == $updateValueArray['suppliers_refund']) {
                 $this->addFlashMessage('警告:你確定供貨商給我們退款金額為 ' . Money::toSmartyDisplay($updateValueArray['refund']) . ' ?');
             }
             if ($updateValueArray['refund'] <= $updateValueArray['suppliers_refund']) {
                 $this->addFlashMessage('警告:給顧客退款金額 &lt;= 供貨商給我們的退款金額');
             }
             // 日誌信息記錄
             $action_note .= '申請退款' . "\n";
             $action_note .= '顧客金額:' . Money::toSmartyDisplay($updateValueArray['refund']) . ",";
             $action_note .= '顧客說明:' . $updateValueArray['refund_note'] . "\n";
             $action_note .= '供貨商金額:' . Money::toSmartyDisplay($updateValueArray['suppliers_refund']) . ",";
             $action_note .= '供貨商說明:' . $updateValueArray['suppliers_refund_note'] . "\n";
             break;
         case 'set_extra_refund':
             // 檢查訂單狀態
             if (OrderGoodsService::OGS_UNPAY == $orderGoods['order_goods_status']) {
                 $this->addFlashMessage('訂單狀態非法,不能退款');
                 goto out;
             }
             $action_note .= '額外退款:' . Money::toSmartyDisplay($updateValueArray['extra_refund']) . ",";
             $action_note .= '退款說明:' . $updateValueArray['extra_refund_note'] . "\n";
             break;
         default:
             // 非法的 action
             goto out;
     }
     // 更新訂單信息
     $orderGoods->copyFrom($updateValueArray);
     $orderGoods->update_time = Time::gmTime();
     $orderGoods->save();
     // 更新 order_info 的 update_time 字段
     $orderInfo->update_time = Time::gmTime();
     $orderInfo->save();
     // 添加訂單操作日誌
     $authAdminUser = AuthHelper::getAuthUser();
     $orderActionService = new OrderActionService();
     $orderActionService->logOrderAction($orderGoods['order_id'], $orderGoods['rec_id'], $orderInfo['order_status'], $orderInfo['pay_status'], $orderGoods['order_goods_status'], $action_note, $authAdminUser['user_name'], 0, $orderInfo['shipping_status']);
     $this->addFlashMessage('訂單信息保存成功');
     out:
     RouteHelper::reRoute($this, RouteHelper::makeUrl('/Order/Goods/Detail', array('rec_id' => $rec_id), true));
     return;
     out_fail:
     // 失敗從這裏退出
     RouteHelper::reRoute($this, '/Order/Goods/Search', false);
 }
開發者ID:jackycgq,項目名稱:bzfshop,代碼行數:101,代碼來源:Goods.php

示例15: post

 public function post($f3)
 {
     // 權限檢查
     $this->requirePrivilege('manage_goods_edit_edit_get');
     // 參數驗證
     $validator = new Validator($f3->get('POST'));
     $goods_id = $validator->required('商品ID不能為空')->validate('goods_id');
     $action = $validator->required('操作不能為空')->validate('action');
     //任務時間
     $taskTimeStr = $validator->required('必須選擇時間')->validate('task_time');
     $taskTime = Time::gmStrToTime($taskTimeStr) ?: null;
     if (!$this->validate($validator)) {
         goto out;
     }
     $authAdminUser = AuthHelper::getAuthUser();
     // 添加 Cron 任務
     CronHelper::addCronTask($authAdminUser['user_name'] . '[' . $authAdminUser['user_id'] . ']', GoodsCronTask::$task_name, @GoodsCronTask::$actionDesc[$action] . '[' . $goods_id . ']', '\\Core\\Cron\\GoodsCronTask', $taskTime, $f3->get('POST'), $goods_id);
     $this->addFlashMessage('成功添加定時任務');
     out:
     RouteHelper::reRoute($this, RouteHelper::makeUrl('/Goods/Edit/Cron', array('goods_id' => $goods_id), true));
 }
開發者ID:swcug,項目名稱:bzfshop,代碼行數:21,代碼來源:Cron.php


注:本文中的Core\Helper\Utility\Route::makeUrl方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。