/**
*
* Check if mobile phone number is available
* @param $cellphone Mobile phone number
*/
Public Function Checkphone ($cellphone) {
$cellphone = Trim ($cellphone);
if (Inputcheck::checkcellphone ($cellphone) = = False)
throw new Apiexception (4001023);
$member = Member::findfirstbycellphone ($cellphone);
Todo by Wangtao
The return method here is not uniform, can register or can not register the return of a text, so that the caller is difficult to judge, once the text changes will make the caller code becomes cumbersome.
Should be returned in the form of a status code, even if True or false is better.
The hint message should only be used as an auxiliary form of an interface and cannot be relied upon by the caller.
I do not know what applications are already calling this interface, if you want to modify, a new interface to ensure unity. If it is determined that there is no call, you can delete the interface, avoid affecting the successor, resulting in a style of disunity
if (!empty ($member)) {
$this->response->render (' mobile phone number has been registered, change a mobile phone number! ')///return false will be better, in favor of caller's code judgment
} else {
$this->response->render (' mobile phone number can be registered ');//success should return a success status code, such as True
}
}
The interface should return to the unified format, not as the caller's judgment based on the text, to be based on the status code