| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <?php
- namespace App\Http\Controllers\Api;
- use App\Http\Validator\CoinValidator;
- use App\Http\Validator\WalletValidator;
- use App\Services\Api\AdvertService;
- use App\Services\Api\MemberWalletService;
- use App\Services\Common\CoinLogService;
- /**
- * 用户地址簿
- * Class WalletController
- * @package App\Http\Controllers\Api
- */
- class WalletController extends webApp
- {
- public function __construct()
- {
- parent::__construct();
- $this->service = new MemberWalletService();
- }
- /**
- * 获取列表
- * @return array|mixed
- */
- public function index()
- {
- $pageSize = request()->post('pageSize', 15);
- $type = request()->post('type', 1);
- $list = MemberWalletService::make()->getOptionList($this->userId, $type, $pageSize);
- return message(1010, true, $list);
- }
- /**
- * 添加地址簿
- * @param WalletValidator $validate
- * @return array
- */
- public function add(WalletValidator $validate)
- {
- $params = $validate->check(request()->post(),'add');
- if(!is_array($params)){
- return message($params, false);
- }
- if($this->service->saveData($this->userId, $params)){
- return message(1002, true);
- }else{
- return message($this->service->getError(), true);
- }
- }
- /**
- * 删除
- * @param WalletValidator $validate
- * @return array
- */
- public function del(WalletValidator $validate)
- {
- $params = $validate->check(request()->post(),'info');
- if(!is_array($params)){
- return message($params, false);
- }
- if($this->service->del($params['id'], $this->userId)){
- return message(1002, true);
- }else{
- return message(1003, true);
- }
- }
- }
|