Commit 26c3091d by 杨树贤

初步完成兑现接口

parent 4d433bd0
...@@ -10,17 +10,17 @@ class Controller extends BaseController ...@@ -10,17 +10,17 @@ class Controller extends BaseController
const SUCCESS = 0; const SUCCESS = 0;
//这个是服务那边返回的错误码,代表已经超出了每日每人可领取的对应项的数额(比如每人每天只能签到一次) //这个是服务那边返回的错误码,代表已经超出了每日每人可领取的对应项的数额(比如每人每天只能签到一次)
const INTEGRAL_LIMIT = 109001; const INTEGRAL_LIMIT = 509000;
//下面的都是这个接口项目的错误码 //下面的都是这个接口项目的错误码
//签到 //签到
const CHECK_IN_FAIL = 109101; const CHECK_IN_FAIL = 509001;
//报价 //报价
const OFFER_FAIL = 109102; const OFFER_FAIL = 509002;
//上传商品 //上传商品
const UPLOAD_GOODS_FAIL = 109103; const UPLOAD_GOODS_FAIL = 509003;
public function Export($Errcode = 0, $ErrMsg = '', $dataArr = []) public function Export($Errcode = 0, $ErrMsg = '', $dataArr = [])
......
...@@ -43,4 +43,28 @@ class UserExchangesController extends Controller ...@@ -43,4 +43,28 @@ class UserExchangesController extends Controller
return $this->Export(0, 'ok', $result); return $this->Export(0, 'ok', $result);
} }
/**
* 兑换商品接口(微信转账或者话费充值)
* @param Request $request
* @param UserExchangeService $service
* @return array
*/
public function exchange(Request $request, UserExchangeService $service)
{
$exchangeId = $request->get('exchange_id');
//先写死用于测试
// $exchangeId = 1;
$userId = $request->user->user_id;
$type = $request->get('type');
$result = $service->addUserExchange([
'user_id' => $userId,
'exchange_id' => $exchangeId,
]);
//这里直接使用服务返回的错误码,对应的错误码在language.php
return $this->Export($result['errcode']);
}
} }
\ No newline at end of file
...@@ -14,4 +14,13 @@ class UserExchangeService ...@@ -14,4 +14,13 @@ class UserExchangeService
return $result; return $result;
} }
public function addUserExchange($map = [])
{
$url = config('website.BaseUrl') . '/rob/exchange/quota';
$result = reportCurl($url, $map, true);
$result = json_decode($result, true);
return $result;
}
} }
\ No newline at end of file
...@@ -12,13 +12,16 @@ return [ ...@@ -12,13 +12,16 @@ return [
109002 => 'Hprose请求失败', 109002 => 'Hprose请求失败',
109003 => '登录失败', 109003 => '登录失败',
109100 => '参数不正确或者缺失,请检查请求的参数', 109100 => '今天已经兑换过了,请明天再来吧',
109101 => '今天已签到过', 109101 => '红包余额不足',
109102 => '签到添加红包失败', 109102 => '红包余额不足',
109103 => '今天已报价过', 109103 => '当前提现不可用',
109104 => '报价添加红包失败',
109105 => '今天已经上传商品过', 509000 => '超过操作类型的限额',
109106 => '上传商品添加红包失败', 509001 => '签到失败',
509002 => '报价失败',
509003 => '上传商品失败',
], ],
......
...@@ -44,6 +44,9 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) { ...@@ -44,6 +44,9 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
//商品配置列表 //商品配置列表
$router->get('exchange_settings/list', 'ExchangeSettingsController@index'); $router->get('exchange_settings/list', 'ExchangeSettingsController@index');
//用户兑换接口
$router->post('user_exchanges/exchange', 'UserExchangesController@exchange');
}); });
$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