[ 'class' => LoginBehavior::className(), 'ignore' =>[ 'api/verify-code/country-code', 'api/verify-code/sms-type', 'api/verify-code/sms', ] ] ]); } /** * showdoc * @catalog 验证码 * @title 手机号国家代码 * @description 本接口提供手机号国家代码 * @method get * @url /api/verify-code/country-code * @return {"code":0,"msg":"ok","data":[{"id":"1","iso":"AF","iso3":"AFG","name":"AFGHANISTAN","name_cn":"阿富汗","nicename":"Afghanistan","num_code":"4","country_code":"93"}]} * @return_param country_code 手机号国家代码 * @remark */ public function actionCountryCode() { $list = SmsCountry::find() ->select('id,iso,iso3,name,name_cn,nicename,num_code,country_code') ->asArray()->all(); $data = [ 'code' => 0, 'msg' => 'ok', 'data' => $list ]; return $this->responseHandler($data); } /** * showdoc * @catalog 验证码 * @title 短信类型 * @description 本接口提供短信类型 * @method get * @url /api/verify-code/sms-type * @return {"code":0,"msg":"ok","data":[{"type":0,"label":"身份验证验证码"},{"type":1,"label":"登录确认验证码"},{"type":2,"label":"登录异常验证码"},{"type":3,"label":"用户注册验证码"},{"type":4,"label":"修改密码验证码"},{"type":5,"label":"信息变更验证码"}]} * @remark */ public function actionSmsType() { $list = SmsTpl::typeLabels(); $data = [ 'code' => 0, 'msg' => 'ok', 'data' => $list ]; return $this->responseHandler($data); } /** * showdoc * @catalog 验证码 * @title 短信验证码 * @description 本接口提供发送短信验证码 * @method post * @url /api/verify-code/sms * @param mobile 必选 string 手机号 * @param type 必选 int 类型,详见短信类型接口 * @param mobile_prefix 必选 string 手机号国家代码 * @return {"code":0,"msg":"ok","data":{}} * @remark */ public function actionSms() { if(!\Yii::$app->request->isPost){ $data = $this->invaildRequest(); return $this->responseHandler($data); } $form = new SmsForm(); $form->attributes = \Yii::$app->request->post(); $form->cx_mch_id = $this->cx_mch_id; $form->user_id = \Yii::$app->user->isGuest ? 0 : \Yii::$app->user->identity->id; $data = $form->sender(); return $this->responseHandler($data); } }