|
|
@@ -0,0 +1,186 @@
|
|
|
+<?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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|