| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- namespace ghs\controllers;
- use biz\ghs\classes\GhsClass;
- use bizGhs\clear\classes\ClearClass;
- use bizGhs\clear\services\ClearService;
- use bizGhs\custom\classes\CustomClass;
- use common\components\dict;
- use common\components\util;
- use Yii;
- class ClearController extends BaseController
- {
- public function actionCancel()
- {
- $id = Yii::$app->request->get('id');
- $clear = ClearClass::getLockById($id);
- if (empty($clear)) {
- util::fail('没有结账信息');
- }
- $ghsId = $clear->ghsId ?? 0;
- $ghs = GhsClass::getById($ghsId, true);
- if (empty($ghs)) {
- util::fail('没有找到供货商关系');
- }
- if ($ghs->shopId != $this->shopId) {
- util::fail('没有权限');
- }
- if ($clear->clearStyle != dict::getDict('clearStyle', 'gys2Hd')) {
- util::fail('不是你建的账单');
- }
- if ($clear->status == ClearClass::STATUS_HAS_PAY) {
- util::fail('账单已完成');
- }
- if ($clear->status == ClearClass::STATUS_EXPIRE) {
- util::fail('账单已取消');
- }
- $clear->status = ClearClass::STATUS_EXPIRE;
- $clear->save();
- util::complete();
- }
- //城市供货商向基地批发商的结账单 ssh 20220523
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $where = [];
- if (isset($get['status']) && is_numeric($get['status'])) {
- $where['status'] = $get['status'];
- }
- $ghsId = $get['ghsId'] ?? 0;
- if (!empty($ghsId)) {
- $ghs = GhsClass::getById($ghsId, true);
- GhsClass::valid($ghs, $this->shopId);
- $where['ghsId'] = $ghsId;
- }
- $where['customShopId'] = $this->shopId ?? 0;
- $list = ClearService::getClearList($where);
- util::success($list);
- }
- //获取基本信息 ssh 20210625
- public function actionGetFullInfo()
- {
- $id = Yii::$app->request->get('id', '');
- $info = clearClass::getById($id);
- if (isset($info['customShopId']) == false || $info['customShopId'] != $this->shopId) {
- util::fail('没有权限');
- }
- $respond = ClearClass::getGhsCgInfo($info);
- util::success($respond);
- }
- //客户的结帐单 ssh 20210625
- public function actionCustomList()
- {
- $get = Yii::$app->request->get();
- $where = [];
- if (isset($get['status']) && is_numeric($get['status'])) {
- $where['status'] = $get['status'];
- }
- $customId = $get['customId'] ?? 0;
- if (!empty($customId)) {
- $custom = CustomClass::getById($customId, true);
- CustomClass::valid($custom, $this->shopId);
- $where['customId'] = $customId;
- }
- $where['ghsShopId'] = $this->shopId ?? 0;
- $list = ClearService::getClearList($where);
- util::success($list);
- }
- //获取基本信息 ssh 20210625
- public function actionGetCustomFullInfo()
- {
- $id = Yii::$app->request->get('id', '');
- $info = ClearClass::getById($id);
- if (isset($info['ghsShopId']) == false || $info['ghsShopId'] != $this->shopId) {
- util::fail('没有权限');
- }
- $respond = ClearClass::getSaleInfo($info);
- util::success($respond);
- }
- }
|