企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 通过唯一码ID获取年份季节 **位置:** Common\Common\function.php **参数:** * @param int $id 唯一码ID * @return string **调用:** > PHP 调用: get_season ($id) > View 模版调用: {$vo['id']|get_season } **完整代码:** ~~~ /** * 通过唯一码ID获取年份季节 * whz 2021-04-20 * @param $id Int * @return string */ function get_season ($id,$season_no = '') { if (empty($id)) { return ''; } $item_info = M('goods_item') ->field('import_id,sku_id') ->where(array('id'=>$id)) ->find(); //根据导入批次ID和SKU_ID获取年份季节 $buyer_info = M('goods_buyer as a') ->field('b.attr_value,b.attr_no') ->join('coscia_goods_attr_value as b on a.season_id = b.id','left') ->where(array('a.sku_id'=>$item_info['sku_id'], 'a.import_id'=>$item_info['import_id'], 'a.is_delete'=>0)) ->find(); $season = $buyer_info['attr_value']; if ($season_no == 1) { $season = $buyer_info['attr_no']; } return $season; } ~~~