<?php
/**
  * @method 客户定制接口
  * @author soul
  * @copyright 2023/7/13
  */
class OthCom
{
	/**
	  * @method get  VIN解码
	  * @http  get
	  * @param  vin                string [必填] 17位车架号
	  * @author soul
	  * @copyright 2023/7/12
	  * @return {"status":true,"data":{"mch_code":["7ce78e37b943dd4206f6343810f2d935"],"vin_year":"2013-02","vin_year_name":"制造日期"},"code":"","runtime":573}
	  */
	public function decodeVinBmtsr($vin)
	{
		$arr = ['mch_code'=>[], 'vin_year'=>'', 'vin_year_name'=>''];
		$YpcVin = new YpcVin();
		$res = $YpcVin->decodeVin($vin);
		$YpcVin->tongjiVin($vin, $res['data']['from']);
		$cfg = mvc::$cfg['COMAPI'][225801];
		if(!empty($res['data']['model']) && $res['data']['from'] == 'ypc' && in_array($res['data']['brand_id'], $cfg['brandids']))
		{
			$vinMod3Arr = $res['data']['model'];
			$Ypc2Base = new Ypc2Base();
			$res = $Ypc2Base->get('bc_modchassis_mod3', ['distinct mcm_mch_code mch_code'], sprintf(" and mcm_mod3_id in (%s)", implode(',', array_column($vinMod3Arr, 'mod3_id'))));
			$arr['mch_code'] = array_column($res['data'], 'mch_code');
			$arr['vin_year'] = $vinMod3Arr[0]['vin_year'];
			$arr['vin_year_name'] = $vinMod3Arr[0]['vin_year_name'];
		}
		return LibFc::ReturnData(true, $arr);
	}
}