package com.hzs.member.base.provider;

import com.hzs.common.core.domain.R;
import com.hzs.member.base.IMemberLoginServiceApi;
import com.hzs.member.base.dto.LoginMember;
import com.hzs.member.login.service.IMemberLoginService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @Description: 会员登录dubbo服务
 * @Author: jiang chao
 * @Time: 2023/8/9 9:57
 * @Classname: MemberLoginServiceProvider
 * @PackageName: com.hzs.member.base.provider
 */
@Slf4j
@DubboService
public class MemberLoginServiceProvider implements IMemberLoginServiceApi {

    @Autowired
    private IMemberLoginService iMemberLoginService;

    @Override
    public R<LoginMember> appletLogin(String username, String password, String loginId, String source) {
        try {
            return R.ok(iMemberLoginService.appletLogin(username, password, loginId, source));
        } catch (Exception e) {
            log.error("会员登录服务异常. username: {}", username, e);
            return R.fail(e.getMessage());
        }
    }

}
