Commit d37619f6 by 杨树贤

添加分享获取红包

parent 9e518365
<?php
namespace App\Http\Controllers;
use App\Services\OfferService;
use App\Services\ShareService;
use Illuminate\Http\Request;
class ShareController extends Controller
{
private $service;
public function __construct(ShareService $service)
{
$this->service = $service;
}
//回复报价的类型id
const INTEGRAL_TYPE_SHARE = 4;
public function store(Request $request)
{
$userId = $request->user->user_id;
$integralId = self::INTEGRAL_TYPE_SHARE;
$map = [
'user_id' => $userId,
'integral_id' => $integralId,
];
$result = $this->service->addShare($map);
if ($result['errcode'] === self::SUCCESS) {
return $this->Export(0, 'ok');
} else {
return $this->Export(self::SHARE_FAIL);
}
}
}
\ No newline at end of file
<?php
namespace App\Services;
class ShareService
{
//回复报价需要添加流水
public function addShare($map = [])
{
$url = config('website.BaseUrl') . '/integral_bills/add';
$result = reportCurl($url, $map, true);
$result = json_decode($result, true);
return $result;
}
}
\ No newline at end of file
...@@ -47,6 +47,13 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) { ...@@ -47,6 +47,13 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
//用户兑换接口 //用户兑换接口
$router->post('user_exchanges/exchange', 'UserExchangesController@exchange'); $router->post('user_exchanges/exchange', 'UserExchangesController@exchange');
//每日分享
$router->post('share/add', 'ShareController@store');
//邀请好友
$router->post('invites/add', 'InvitesController@store');
}); });
$router->group(['middleware' => 'web'], function () use ($router) { $router->group(['middleware' => 'web'], function () use ($router) {
$router->post('/oss/upload', 'OssController@upload'); $router->post('/oss/upload', 'OssController@upload');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment