user/views.py
class UserView(ViewSet): @action(methods=['GET'], detail=False, ) def send_sms(self, request): phone = request.query_params.get('phone') sms_code = gen_code() # res = send_sms_v2(phone, sms_code) res = send_sms_v3(phone, sms_code) print(sms_code) if res: return APIResponse() else: return APIResponse(code=101, msg='发送失败,请稍后再试')