common.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. //获取订单编号
  3. function get_order_sn(){
  4. $order_id_main = date('YmdHis') . rand(10000000,99999999);
  5. $order_id_len = strlen($order_id_main);
  6. $order_id_sum = 0;
  7. for($i=0; $i<$order_id_len; $i++){
  8. $order_id_sum += (int)(substr($order_id_main,$i,1));
  9. }
  10. $osn = $order_id_main . str_pad((100 - $order_id_sum % 100) % 100,2,'0',STR_PAD_LEFT);
  11. return $osn;
  12. }
  13. //获取全图片地址 $image_data 返回数组
  14. function image_path($image_data){
  15. if(empty($image_data)){
  16. return $image_data;
  17. }
  18. if (strpos($image_data,'|')!==false){
  19. $image_res = explode('|',$image_data);
  20. }elseif(strpos($image_data,',')!==false){
  21. $image_res = explode(',',$image_data);
  22. }else{
  23. $image_res = array($image_data);
  24. }
  25. return $image_res;
  26. }
  27. function workshop_arr(){
  28. return array(1=>'生产一车间',2=>'生产二车间',3=>'生产三车间',4=>'生产四车间',5=>'生产五车间',6=>'生产六车间',7=>'生产七车间',8=>'生产八车间');
  29. }
  30. function member_type_arr(){
  31. return array(3=>'车间主任',4=>'仓库人员',5=>'副厂长',6=>'厂长',7=>'领导');
  32. }
  33. function digital_conversion(){
  34. return array(1=>'一',2=>'二',3=>'三',4=>'四',5=>'五',6=>'六',7=>'七',8=>'八');
  35. }