function.php 2.08 KB
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019-08-14
 * Time: 19:42
 */

function setbgcolor($ind){
    if ($ind == 0) return "#fe7496";
    if ($ind == 1) return "#22c7c1";
    if ($ind == 2) return "#5e82e3";
    if ($ind == 11) return "#22c7c1";
    if ($ind == 12) return "#5e82e3";
    return "";
}
function setbgbackground($ind){ 
    if ($ind == 0) return "#ffa1b9";
    if ($ind == 1) return "#59e1d2";
    if ($ind == 2) return "#a3bcff";
    if ($ind == 11) return "#59e1d2";
    if ($ind == 12) return "#a3bcff";
    return "";
}
function get_type($ind){
    if ($ind == 0) return "全场通用";
    if ($ind == 1) return "品牌";
    if ($ind == 2) return "品类";
    if ($ind == 11) return "用途";
    if ($ind == 12) return "分类1";
    return "";
}
function get_type_card($ind){
    if ($ind == 0) return "全场通用";
    if ($ind == 1) return "指定品牌";
    if ($ind == 2) return "指定品类";
    if ($ind == 11) return "指定用途";
    if ($ind == 12) return "指定分类1";
    return "";
}

function Mini_Host(){ return WEAPPAPIURL;}

/*-- 保留俩位小数 --*/
function tofix2($val){
    return floor($val*100)/100;
}

function check_is_set($ind){
    $iset= tpCache('basic.categoryset',I('stoid'));
    if(strpos($iset,''.$ind) !== false){
        return true;
    }
    return false;
}

function get_tj_price($market_price,$tgr){
    $jt_json=$tgr['jt_json'];
    $jt_json=json_decode($jt_json,true);
    $price=0;
    foreach ($jt_json as $k=>$v){
       if($tgr['jt_ct_num']>=$v['rynum']){
           $price=$v['price'];
       }
    }
    return  $market_price-$price;
}

function get_quan_list_img($img){
    if(strpos($img,"http") !== false){
        return $img;
    }else{
       return getImg($img,NOIMG);
    }
 }

 function replay_huiche($word){
     $word= str_replace("\r\n", "<BR/>", $word);
     $word= str_replace("\n", "<BR/>", $word);
     $word= str_replace("\r","<BR/>", $word);
     return $word;
 }

function str_is_has($long,$item){
    if (strpos($long, $item) !== false) {
        return 1;
    } else {
        return 0;
    }
}