ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 通过唯一码ID获取供应商 **位置:** Common\Common\function.php **参数:** * @param int $id 唯一码ID * @param string $vendors 供应商名称 * * @return string **调用:** > PHP 调用: get_vendors ($id) > View 模版调用: {$vo['id']|get_vendors} **完整代码:** ~~~ /** * 通过唯一码ID获取供应商 * whz 2021-04-20 * @param $id Int * @return string */ function get_vendors ($id) { 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.vendor_no') ->join('coscia_vendor as b on a.vendor_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(); $vendors = $buyer_info['vendor_no']; return $vendors; } ~~~