| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <?php
- namespace App\Http\Controllers\Api\v1;
- use App\Http\Controllers\Api\webApp;
- use App\Http\Validator\MemberValidator;
- use App\Http\Validator\MerchantValidator;
- use App\Services\Api\AcceptorService;
- use App\Services\Api\MemberService;
- use App\Services\Api\MerchantCategoryService;
- use App\Services\Api\MerchantService;
- /**
- * 承兑商管理
- * @package App\Http\Controllers\Api
- */
- class AcceptorController extends webApp
- {
- /**
- * 信息
- * @return array
- */
- public function info()
- {
- $type = request()->post('type', 'detail');
- $id = request()->post('id', 0);
- $info = AcceptorService::make()->getInfo($this->userId, $type, $id);
- if($info){
- return showJson(1010, true, $info);
- }else{
- return showJson(2216, false, [],'404');
- }
- }
- /**
- * 商家列表
- * @return array
- */
- public function index()
- {
- $params = request()->post();
- $pageSize = request()->post('pageSize', 6);
- $datas = AcceptorService::make()->getDataList($params, $pageSize);
- return showJson(1010, true, $datas);
- }
- /**
- * 申请入驻
- * @return array
- */
- public function apply(MerchantValidator $validator)
- {
- $params = request()->all();
- $params = $validator->check($params, 'apply');
- if (!is_array($params)) {
- return showJson($params, false);
- }
- if(!$result = MerchantService::make()->apply($this->userId, $params)){
- return showJson(MerchantService::make()->getError(), false);
- }else{
- return showJson(MerchantService::make()->getError(), true, $result);
- }
- }
- /**
- * 入驻信息
- * @return array
- */
- public function applyInfo()
- {
- $info = MerchantService::make()->getApplyInfo($this->userId);
- if($info){
- return showJson(1010, true, $info);
- }else{
- return showJson(1009, false);
- }
- }
- /**
- * 修改账号信息
- * @param $userId
- * @param $params
- * @return bool
- */
- public function modify(MerchantValidator $validator)
- {
- $params = request()->all();
- $params = $validator->check($params, 'modify');
- if (!is_array($params)) {
- return showJson($params, false);
- }
- if(!MerchantService::make()->modify($this->userId, $params)){
- return showJson(MerchantService::make()->getError(),false);
- }else{
- return showJson(MerchantService::make()->getError(),true);
- }
- }
- /**
- * 修改店铺信息
- * @param $userId
- * @param $params
- * @return bool
- */
- public function saveInfo(MemberValidator $validator)
- {
- $params = request()->all();
- $params = $validator->check($params, 'info');
- if (!is_array($params)) {
- return showJson($params, false);
- }
- if(!MerchantService::make()->saveInfo($this->userId, $params)){
- return showJson(MerchantService::make()->getError(),false);
- }else{
- return showJson(MerchantService::make()->getError(),true);
- }
- }
- /**
- * 收藏点赞
- * @param MerchantValidator $validator
- * @return array
- */
- public function collect(MerchantValidator $validator)
- {
- $params = request()->all();
- $params = $validator->check($params, 'collect');
- if (!is_array($params)) {
- return showJson($params, false);
- }
- if(!$result = MerchantService::make()->collect($this->userId, $params)){
- return showJson(MerchantService::make()->getError(), false);
- }else{
- return showJson(MerchantService::make()->getError(), true, $result);
- }
- }
- /**
- * 缴纳保证金
- * @param MemberValidator $validator
- * @return array
- */
- public function deposit(MemberValidator $validator)
- {
- $params = request()->all();
- $params = $validator->check($params, 'deposit');
- if (!is_array($params)) {
- return showJson($params, false);
- }
- if(!$result = MerchantService::make()->deposit($this->userId, $params)){
- return showJson(MerchantService::make()->getError(),false);
- }else{
- return showJson(MerchantService::make()->getError(),true, $result);
- }
- }
- /**
- * 退还保证金
- * @param MemberValidator $validator
- * @return array
- */
- public function rebackDeposit(MemberValidator $validator)
- {
- $params = request()->all();
- $params = $validator->check($params, 'reback_deposit');
- if (!is_array($params)) {
- return showJson($params, false);
- }
- if(!$result = MerchantService::make()->rebackDeposit($this->userId, $params)){
- return showJson(MerchantService::make()->getError(),false);
- }else{
- return showJson(MerchantService::make()->getError(),true);
- }
- }
- }
|