<?php
/**
 * 作者: theworld
 * 时间: 2021-09-02
 * 代理账户认证       
 */

class accountIdcsmart{
	
	/**
	 * 作者: theworld
	 * 时间: 2023-03-10
	 * 账号登录
	 * @params  string   $email  邮箱
	 * @params  string   $password  密码
	 * @return array
	 */
	public function checkAccount($params){
		$_tblclients = _pdoSelect("tblclients","id","`email`='{$params['email']}'");
		if(empty($_tblclients['id'])){
			$resultMsg['status'] =400;
			$resultMsg['msg']="邮箱不存在";
		}else{
			$addons_clients = _pdoSelect("idcsmart_reseller_clients","`userid`,`apikey`,`disabled`","`userid`='{$_tblclients['id']}'");
			if(empty($addons_clients['userid'])){
				$resultMsg['status'] =400;
				$resultMsg['msg']="该账户还未加入代理商";
			}else if($addons_clients['apikey']!=$params['password']){
				$resultMsg['status'] =400;
				$resultMsg['msg']="API密钥错误";
			}else if($addons_clients['disabled']==1){
				$resultMsg['status'] =400;
				$resultMsg['msg']="该代理商已被禁用API";
			}else{
				$resultMsg['status']=200;
				$resultMsg['msg']="success";
				$resultMsg['account']['userid']=$addons_clients['userid'];
			}
		}
		return $resultMsg;
	}	
	
}
