isSubmitlimitation($cacheKey)) return [false,'已发送验证码,请勿重复操作!']; //生成验证码 $code = $this->createCode(); //发送验证码 list($status,$msg) = $this->sendCode($code); if($status){ Cache::add($cacheKey,$code,1); return [true,'']; }else{ return [false,$msg]; } } public function createCode(){ return "123123"; } public function sendCode($code){ return [true,'']; } //微信公众号发送 目前发现不行 // public function sendCode($code){ // $serivce = new WxService(); // list($status,$msg) = $serivce->getToken(); // if(! $status) return [false,$msg]; // // list($status,$msg) = $serivce->sendToWx($msg,$code); // return [$status,$msg]; // } public function isSubmitlimitation($cacheKey){ if(Cache::has($cacheKey)){ return false; } return true; } }