| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | <?php/** * 此处是设定erp重量的标准   以后获取重量都尽量通过这去获取重量 以前的代码还是通过以前的方案 */class Model_logic_weight extends Lin_Model {       //切记要修改token_120的token真正的token!!!!    function __construct(){        parent::__construct();        $this->load->_model('Model_weight','weight');    }    /**     * $type erp类目 如 126 127 128     */    public function getWeightByFeature($type,$features){        if(empty($type)){            return 0;        }        $sku = [];         if($type == 126){            return  100;        }        //类目 蕾丝尺寸  长度        if($type == 127){            //发块            $flag = true;            foreach($features as $v){                if($v['classid'] == 26){                    $flag = false;                }            }            if($flag){                //蕾丝尺寸1                $sku = ['16'=>127,'25'=>0,'14'=>0];            }else{                //蕾丝尺寸2                $sku = ['16'=>127,'26'=>0,'14'=>0];            }        }        //类目 头套类型  尺寸   密度        if($type == 128){            //头套类型            $sku = ['16'=>128,'18'=>0,'14'=>0,'10'=>0];        }        //类目 尺寸        if($type == 130){            //接发类型            $sku = ['16'=>130,'33'=>0,'14'=>0];        }        foreach($features as $k => $v){            if(isset($sku[$v['classid']])){                $sku[$v['classid']] = $v['id'];            }        }        $sku_str = implode("-",$sku);        $weight_info = $this->weight->get_features($sku_str);        if(empty($weight_info)){            return 0;        }else{            return $weight_info['weight'];        }    }}
 |