Store.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | A3Mall
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: xzncit <158373108@qq.com>
  8. // +----------------------------------------------------------------------
  9. namespace mall\basic;
  10. use mall\utils\BC;
  11. use think\facade\Db;
  12. class Store {
  13. public static function get(&$data,$store){
  14. if(empty($store)){
  15. return $data;
  16. }
  17. $data["real_freight"] = 0;
  18. $data["payable_freight"] = 0;
  19. $data["payable_amount"] = BC::add($data["real_freight"],$data["real_amount"]);
  20. $data = Promotion::run($data);
  21. $data["order_amount"] = $data["payable_amount"];
  22. return $data;
  23. }
  24. public static function getUniqueCode(){
  25. $num = BC::add(time(),mt_rand(3,1000000),0) . mt_rand(2,99999);
  26. $num = substr($num, 0, 12);
  27. if(Db::name("order")->where("shipping_code != '' AND shipping_code='".$num."'")->count()){
  28. return self::getUniqueCode();
  29. }
  30. return $num;
  31. }
  32. }