|
|
@ -17,8 +17,12 @@ namespace app\controller\api; |
|
|
|
use app\common\repositories\store\order\StoreGroupOrderRepository; |
|
|
|
use app\common\repositories\store\order\StoreGroupOrderRepository; |
|
|
|
use app\common\repositories\store\order\StoreOrderRepository; |
|
|
|
use app\common\repositories\store\order\StoreOrderRepository; |
|
|
|
use app\common\repositories\store\order\StoreRefundOrderRepository; |
|
|
|
use app\common\repositories\store\order\StoreRefundOrderRepository; |
|
|
|
|
|
|
|
use app\common\repositories\system\HuitongRepository; |
|
|
|
use app\common\repositories\system\notice\SystemNoticeConfigRepository; |
|
|
|
use app\common\repositories\system\notice\SystemNoticeConfigRepository; |
|
|
|
|
|
|
|
use app\common\repositories\system\notice\SystemNoticeRepository; |
|
|
|
use app\common\repositories\user\UserAssetsLogRepository; |
|
|
|
use app\common\repositories\user\UserAssetsLogRepository; |
|
|
|
|
|
|
|
use app\common\repositories\user\UserAssetsRepository; |
|
|
|
|
|
|
|
use app\common\repositories\user\UserGroupRepository; |
|
|
|
use app\common\repositories\user\UserOrderRepository; |
|
|
|
use app\common\repositories\user\UserOrderRepository; |
|
|
|
use app\common\repositories\user\UserRechargeRepository; |
|
|
|
use app\common\repositories\user\UserRechargeRepository; |
|
|
|
use app\common\repositories\user\UserRepository; |
|
|
|
use app\common\repositories\user\UserRepository; |
|
|
@ -173,9 +177,107 @@ class Auth extends BaseController |
|
|
|
Cache::set($key, true, new \DateTime($day . ' 23:59:59')); |
|
|
|
Cache::set($key, true, new \DateTime($day . ' 23:59:59')); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$groupRepository = app(UserGroupRepository::class); |
|
|
|
|
|
|
|
$groupData = $groupRepository->getList([], 1, 10); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$groupList = array_column($groupData['list']->toArray(), 'group_name', 'group_id'); |
|
|
|
|
|
|
|
$data['group_name'] = $groupList[$data['group_id']] ?? ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用户资产 |
|
|
|
|
|
|
|
$assets = app(UserAssetsRepository::class)->assets($data['uid']); |
|
|
|
|
|
|
|
$data['assets'] = $assets; |
|
|
|
|
|
|
|
return app('json')->success($data); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function noticeList() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
[$page, $limit] = $this->getPage(); |
|
|
|
|
|
|
|
$where = array('type' => 5); |
|
|
|
|
|
|
|
return app('json')->success(app(SystemNoticeRepository::class)->getList($where, $page, $limit)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* notes 兑换配置 |
|
|
|
|
|
|
|
* @return mixed |
|
|
|
|
|
|
|
* @create 2024/3/19 22:20 |
|
|
|
|
|
|
|
* @update 2024/3/19 22:20 |
|
|
|
|
|
|
|
* @author zhangkxiang |
|
|
|
|
|
|
|
* @editor |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public function exchangeConfig(){ |
|
|
|
|
|
|
|
$config = app(UserAssetsRepository::class)->getConfig(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = [ |
|
|
|
|
|
|
|
'integralToDiamond' => $config['integralToDiamond'], |
|
|
|
|
|
|
|
'diamondToStock' => $config['diamondToStock'] |
|
|
|
|
|
|
|
]; |
|
|
|
return app('json')->success($data); |
|
|
|
return app('json')->success($data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function assetsLog(){ |
|
|
|
|
|
|
|
$uid = 3; |
|
|
|
|
|
|
|
// $uid = 3; |
|
|
|
|
|
|
|
$page = $this->request->param('page', 1); |
|
|
|
|
|
|
|
$limit = $this->request->param('limit', 10); |
|
|
|
|
|
|
|
$asset_type = $this->request->param('asset_type', 1); |
|
|
|
|
|
|
|
$change_type = $this->request->param('change_type'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$where = array(); |
|
|
|
|
|
|
|
$where[] = array('asset_type','=',$asset_type); |
|
|
|
|
|
|
|
if($change_type) $where[] = array('type','=',$change_type); |
|
|
|
|
|
|
|
$where[] = array('status','in',[UserAssetsLogRepository::STATUS_GET, UserAssetsLogRepository::STATUS_WITHDRAW, UserAssetsLogRepository::STATUS_USE]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return app('json')->success(app(UserAssetsLogRepository::class)->list($uid, $where, $page, $limit)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function integralToDiamond(){ |
|
|
|
|
|
|
|
$count = $this->request->param('count', 1); |
|
|
|
|
|
|
|
$uid = 3; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
app(UserAssetsRepository::class)->consumeToShare($uid, $count); |
|
|
|
|
|
|
|
}catch (\Exception $e){ |
|
|
|
|
|
|
|
return app('json')->fail($e->getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return app('json')->success(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function diamondToStock(){ |
|
|
|
|
|
|
|
$count = $this->request->param('count', 1); |
|
|
|
|
|
|
|
$uid = 3; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
app(UserAssetsRepository::class)->consumeToShare($uid, $count); |
|
|
|
|
|
|
|
}catch (\Exception $e){ |
|
|
|
|
|
|
|
return app('json')->fail($e->getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return app('json')->success(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function toHuitong(){ |
|
|
|
|
|
|
|
$count = $this->request->param('count', 1); |
|
|
|
|
|
|
|
$phone = $this->request->param('phoneTo', "13166665555"); |
|
|
|
|
|
|
|
$smsCode = $this->request->param('smsCode', 0156); |
|
|
|
|
|
|
|
$type = $this->request->param('type', 'intention'); |
|
|
|
|
|
|
|
$uid = 3; |
|
|
|
|
|
|
|
Log::info("code: {$smsCode}, type: {$type}"); |
|
|
|
|
|
|
|
$checkSms = app()->make(SmsService::class)->checkSmsCode('18362705640', $smsCode, $type); |
|
|
|
|
|
|
|
if (!$smsCode || !$checkSms) |
|
|
|
|
|
|
|
return app('json')->fail('验证码不正确'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
app(UserAssetsRepository::class)->sendHuitong($uid, $phone, $count); |
|
|
|
|
|
|
|
}catch (\Exception $e){ |
|
|
|
|
|
|
|
return app('json')->fail($e->getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return app('json')->success(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @param UserRepository $repository |
|
|
|
* @param UserRepository $repository |
|
|
|
* @return mixed |
|
|
|
* @return mixed |
|
|
|