| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?php
- namespace ghs\controllers;
- use bizGhs\lakala\services\LakalaAccountService;
- use common\components\util;
- use ghs\models\lakala\ApplicationIdForm;
- use ghs\models\lakala\CreateForm;
- use ghs\models\lakala\FormDataForm;
- use ghs\models\lakala\OcrResultForm;
- use ghs\models\lakala\OptionForm;
- use ghs\models\lakala\SetCurrentForm;
- use ghs\models\lakala\UploadFileForm;
- use Yii;
- class LakalaAccountController extends BaseController
- {
- public function actionList()
- {
- $list = LakalaAccountService::list($this->mainId, $this->shopId);
- util::success($list);
- }
- public function actionDetail()
- {
- $form = new ApplicationIdForm();
- $form->loadAndValidate();
- $detail = LakalaAccountService::detail((int)$form->id, $this->mainId, $this->shopId);
- util::success($detail);
- }
- public function actionCreate()
- {
- $form = new CreateForm();
- $data = Yii::$app->request->post();
- $form->load($data ?: ['type' => ''], '');
- $form->validateForm();
- util::success(LakalaAccountService::create(
- $this->mainId,
- $this->shopId,
- $this->shop,
- $form->type,
- (int)$form->accountId
- ));
- }
- public function actionSaveDraft()
- {
- $form = new FormDataForm();
- $form->loadAndValidate();
- util::success(LakalaAccountService::saveDraft(
- (int)$form->id,
- $this->mainId,
- $this->shopId,
- $form->getFormData(),
- (int)$form->currentStep
- ));
- }
- public function actionDeleteDraft()
- {
- $form = new ApplicationIdForm();
- $form->loadAndValidate();
- LakalaAccountService::deleteDraft((int)$form->id, $this->mainId, $this->shopId);
- util::complete();
- }
- public function actionUploadFile()
- {
- $form = new UploadFileForm();
- $form->loadAndValidate();
- util::success(LakalaAccountService::upload(
- (int)$form->id,
- $this->mainId,
- $this->shopId,
- $form->content,
- $form->imgType,
- (int)$form->isOcr
- ));
- }
- public function actionOcrResult()
- {
- $form = new OcrResultForm();
- $form->loadAndValidate();
- util::success(LakalaAccountService::ocr(
- (int)$form->id,
- $this->mainId,
- $this->shopId,
- $form->batchNo,
- $form->imgType
- ));
- }
- public function actionOption()
- {
- $form = new OptionForm();
- $form->loadAndValidate();
- $option = LakalaAccountService::option($form->type, $form->parentCode, $form->keyword);
- util::success($option);
- }
- public function actionApplyContract()
- {
- $form = new ApplicationIdForm();
- $form->loadAndValidate();
- $contract = LakalaAccountService::applyContract((int)$form->id, $this->mainId, $this->shopId);
- util::success($contract);
- }
- public function actionContractStatus()
- {
- $form = new ApplicationIdForm();
- $form->loadAndValidate();
- util::success(LakalaAccountService::contractStatus((int)$form->id, $this->mainId, $this->shopId));
- }
- public function actionSubmit()
- {
- $form = new FormDataForm();
- $form->loadAndValidate();
- $submit = LakalaAccountService::submitForPlatformAudit(
- (int)$form->id,
- $this->mainId,
- $this->shopId,
- $form->getFormData()
- );
- util::success($submit);
- }
- public function actionRefresh()
- {
- $form = new ApplicationIdForm();
- $form->loadAndValidate();
- $re = LakalaAccountService::refresh((int)$form->id, $this->mainId, $this->shopId);
- util::success($re);
- }
- public function actionSetCurrent()
- {
- $form = new SetCurrentForm();
- $form->loadAndValidate();
- LakalaAccountService::setCurrent((int)$form->accountId, $this->mainId, $this->shopId);
- util::complete('已设置为当前收款账户');
- }
- }
|