webman/app/controller/admin/api/v1/PromotionController.php

43 lines
1.1 KiB
PHP

<?php
namespace app\controller\admin\api\v1;
use app\dao\UserDao;
use app\dao\UserRewardDao;
use support\Request;
use App\Utils\ApiResponse;
use App\model\Admin;
use app\model\Recommend;
use app\model\User;
use app\model\UserPhone;
use app\model\UserPhoneLog;
use hg\apidoc\annotation as Apidoc;
use app\model\Withdraw;
use App\Utils\Random;
/**
* @Apidoc\Title("admin推广链接控制器")
* @Apidoc\Group("admin")
*/
class PromotionController
{
/**
* @Apidoc\Title("管理员生成推广链接")
* @Apidoc\Url("admin/api/v1/Promotion/Generatelink")
* @Apidoc\Method("POST")
*/
public function Generatelink(Request $request){
$invite_code=Random::str_random(7);
$Recommend =new Recommend();
$Recommend->invite_code=$invite_code;
return ApiResponse::success(200, $invite_code);
}
/**
* @Apidoc\Title("获取推广列表所有")
* @Apidoc\Url("admin/api/v1/Promotion/list")
* @Apidoc\Method("POST")
*/
public function list(Request $request){
$Recommend =Recommend::all();
return ApiResponse::success(200, $Recommend);
}
}