本文整理汇总了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);
}
示例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}");
}
示例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);
}
示例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');
}
示例5: pluginGetConfigureUrl
public function pluginGetConfigureUrl($system)
{
// manage 系统可以配置这个插件
if (PluginHelper::SYSTEM_MANAGE === $system) {
return RouteHelper::makeUrl('/Thirdpart/EtaoFeed/Configure');
}
// 其它系统不需要配置
return null;
}
示例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}");
}
示例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);
}
示例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');
}
示例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');
}
示例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');
}
示例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');
}
示例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');
}
示例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;
}
示例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('警告:给顾客退款金额 <= 供货商给我们的退款金额');
}
// 日志信息记录
$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);
}
示例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));
}