Commit 939b4129 by 杨树贤

添加兑现相关逻辑

parent cce9face
......@@ -59,7 +59,6 @@ class UserExchangesController extends Controller
{
//这个是兑换的商品id,不是兑换流水的id,因为这个时候还没有生成
$exchangeId = $request->get('exchange_id');
//先写死用于测试
$userId = $request->user->user_id;
//判断是否可以兑换
......@@ -95,4 +94,28 @@ class UserExchangesController extends Controller
}
/**
* 确认兑换接口
* @param Request $request
* @param UserExchangeService $service
* @return array|false|string
*/
public function confirm(Request $request, UserExchangeService $service)
{
$exchangeId = $request->get('exchange_id');
if (empty($exchangeId)) {
return $this->Export(self::INVALID_PARAMETER);
}
return $this->Export(0, 'ok');
//
// $result = $service->confirmExchange($exchangeId);
// if ($result['errcode'] == 0) {
// return $this->Export($result['errcode'], 'ok');
// } else {
// return $this->Export($result['errcode'], '确认兑换失败');
// }
}
}
\ No newline at end of file
......@@ -51,7 +51,10 @@ class ExchangeSettingService
$redis = new RedisModel();
//user_oauth 绑定公众号类型为2
$oauthOfficialAccountType = 2;
$keyName = $userId . '-' . $oauthOfficialAccountType;
//先获取union_id
$user = json_decode($redis->hget('ic_user',$userId),true);
$unionId = array_get($user,'union_id');
$keyName = $unionId . '_' . $oauthOfficialAccountType;
$userOauth = json_decode($redis->hget('ic_user_oauth', $keyName),true);
return $userOauth;
......
......@@ -38,6 +38,8 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
//用户兑换接口
$router->addRoute(['GET', 'POST'], 'user_exchanges/exchange', 'UserExchangesController@exchange');
//确认兑换接口,目前只是给微信转账用
$router->addRoute(['GET', 'POST'], 'user_exchanges/exchange/confirm', 'UserExchangesController@confirm');
//每日分享
$router->addRoute(['GET', 'POST'], 'share/add', 'ShareController@store');
......
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