💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 根据用户ID获取店铺和姓名的拼接信息 **位置:** Common\Common\function.php **参数:** > @param $uid Int **调用:** > get_shop_sales ($sale_uid) PHP 文件调用 > {$vo['sale_uid']|get_shop_sales } View 模版调用 **完整代码:** ~~~ /** * * 根据用户ID获取店铺和姓名的拼接信息 * QJM 2019-03-22 * @param $uid 用户ID * @return int|string 店铺和姓名的拼接信息 * 异常返回-1:传入的用户ID不存在 */ function get_shop_sales ($uid) { // 这里只要判断员工是否存在就可以了,不用判断是否禁用状态 $where['u.id'] = array('eq', $uid); // 时尚顾问ID $fashion_sales = M('user as u') ->field('u.id as id, u.username as job_no, u.nickname as username, u.shop_max_id') ->where($where) ->find(); if (empty($fashion_sales)) { return -1; } // 查询员工店铺信息 $map_shop['id'] = array('eq', $fashion_sales['shop_max_id']); // 店铺ID $map_shop['status'] = array('eq', 0); // 是否禁用 0启用,1禁用 $map_shop['is_show'] = array('eq', 1); // 是否展示 0否, 1是 $map_shop['is_delete'] = array('eq', 0); // 是否删除 0 否,1是,默认0否 $shops_info = M('shops')->field('shops_name')->where($map_shop)->find(); // 店铺信息的显示判断 if (!empty($shops_info)) { $shop_name = $shops_info['shops_name']; } else { $shop_name = 'COSCIA'; } // 调用函数获取用户的昵称 $user_name = get_user_name($uid, 1); $shop_sales = $shop_name ."-". $user_name; return $shop_sales; } ~~~