LimitBuyWidget.php 797 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2018/3/20 0020
  6. * Time: 下午 3:18
  7. */
  8. namespace app\backend\widgets\goods;
  9. use app\common\components\Widget;
  10. use app\common\models\goods\GoodsLimitBuy;
  11. class LimitBuyWidget extends Widget
  12. {
  13. public function run(){
  14. $goods_id = \YunShop::request()->id;
  15. $data= GoodsLimitBuy::getDataByGoodsId($goods_id);
  16. $starttime = strtotime('-1 month');
  17. $endtime = time();
  18. if (!empty($data)) {
  19. $starttime = $data->start_time;
  20. $endtime = $data->end_time;
  21. }
  22. return view('goods.widgets.limitbuy',[
  23. 'data' => $data,
  24. 'starttime' => $starttime,
  25. 'endtime' => $endtime,
  26. ]
  27. )->render();
  28. }
  29. }