Magento Shell

本文详细解析了Magento/shell/Virtualcard.php文件中的PHP脚本,包括其核心功能、运行流程及参数使用,帮助开发者了解如何通过命令行操作虚拟卡池,实现虚拟卡的生成和状态更新。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在magento/shell/下Virtualcard.php

Java代码  收藏代码
  1. <?php  
  2. require_once 'abstract.php';  
  3.   
  4. class Mage_Shell_Virtualcard extends Mage_Shell_Abstract  
  5. {  
  6.   
  7.     protected function _getPool()  
  8.     {  
  9.         return Mage::getModel('virtualcard/pool');  
  10.     }  
  11.   
  12.     /** 
  13.      * Run script 
  14.      * 
  15.      */  
  16.     public function run()  
  17.     {  
  18.         if ($option = $this->getArg('option'))   
  19.         {    
  20.             switch ($option){  
  21.                 case 'generation':  
  22.                     $this->_getPool()->applyCodesGeneration();  
  23.                     break;  
  24.                 case 'updateStates':  
  25.                     Mage::getModel('virtualcard/cron')->updateStates();  
  26.                     break;  
  27.             }             
  28.         }else{  
  29.             echo $this->usageHelp();  
  30.         }  
  31.     }  
  32.     /** 
  33.      * Retrieve Usage Help Message 
  34.      * 
  35.      */  
  36.     public function usageHelp()  
  37.     {  
  38.         return <<<USAGE  
  39. Usage:  php -f virtualcard.php -- [options]  
  40.   
  41.   --option generation | updateStates  
  42.   help                          This help  
  43. USAGE;  
  44.     }  
  45. }  
  46.   
  47. $shell = new Mage_Shell_Virtualcard();  
  48. $shell->run();  

 将这个文件加入crontable即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值