Przeglądaj źródła

常量初始化

shish 5 lat temu
rodzic
commit
39c11217e2

+ 189 - 188
app/ghs/controllers/AuthController.php

@@ -27,192 +27,193 @@ use yii\helpers\Json;
  */
 class AuthController extends PublicController
 {
-	
-	//准备授权 shish 2019.11.19
-	public function actionPrepare()
-	{
-		$get = Yii::$app->request->get();
-		$url = isset($get['url']) && !empty($get['url']) ? $get['url'] : '';
-		if (empty($url)) {
-			util::fail('没有网址');
-		}
-		$account = httpUtil::getAccount($url);
-		if (empty($account)) {
-			util::fail('没有商家帐号');
-		}
-		$merchant = MerchantService::getById($account);
-		if (empty($merchant)) {
-			util::fail('商家无效');
-		}
-		/**
-		 * authScope 参数的说明
-		 * 1.用户通过公众号菜单打开网页,因为已经关注过了公众号,已经生成过用户信息,所以只要使用snsapi_base静默方式拿到openid就可以
-		 * 2.为了保证付款页的访问速度,暂时只要通过snsapi_base静默方式拿到openid先生成可以用的用户信息即可
-		 * 3.其它情况需要获取用户完整信息的,使用snsapi_userinfo让用户授权获取信息即可
-		 * 4.snsapi_base静默方式使用的场景更多,所以参数authScope默认使用snsapi_base
-		 */
-		$authScope = isset($get['authScope']) ? $get['authScope'] : 'snsapi_base';
-		$urlEncode = stringUtil::urlSafeB64Encode($url);
-		//微信授权获取code shish 2019.11.24
-		wxUtil::getCode($urlEncode, $merchant, $authScope);
-		util::end();
-	}
-	
-	//微信授权获取用户信息 shish 2019.11.20
-	public function actionGetUserInfo()
-	{
-		$get = Yii::$app->request->get();
-		$code = isset($get['code']) ? $get['code'] : '';
-		if (empty($code)) {
-			util::fail('没有获取用户code');
-		}
-		if (isset($get['state']) && $get['state'] == 'authdeny') {
-			util::fail('auth fail');
-		}
-		$urlEncode = $get['url'];
-		$url = stringUtil::urlSafeBase64Decode($urlEncode);
-		$account = httpUtil::getAccount($url);
-		if (empty($account)) {
-			util::stop('商店ID无效!!');
-		}
-		$merchant = xhMerchantService::getByAccount($account);
-		if (empty($merchant)) {
-			util::stop('商店无效');
-		}
-		$merchantId = $merchant['id'];
-		$authScope = isset($get['authScope']) ? $get['authScope'] : '';
-		if (empty($authScope)) {
-			util::stop('没有授权类型');
-		}
-		$data = wxUtil::getOpenId($code, $merchant);
-		if ($data === false) {
-			//微信授权获取code shish 2019.11.24
-			wxUtil::getCode($urlEncode, $merchant, $authScope);
-			util::end();
-		}
-		$openId = $data['openid'];
-		$access_token = $data['access_token'];
-		$user = UserService::getByOpenId($openId, $merchantId);
-		//用户来源
-		$userSource = Yii::$app->dict->getValue('userSourceGetId', 'official');
-		$source = $userSource['name'];
-		if (empty($user)) {
-			//$authScope 默认是 snsapi_base 公众号菜单打开网页(已经关注公众号,有完整信息)、打开付款页(有些客户只付款,没有后续可以不用登记完整信息),只需要获取openid
-			$originalInfo = [];
-			$originalInfo['openId'] = $openId;
-			$originalInfo['merchantId'] = $merchantId;
-			
-			//没有关注公众号,需要获取用户完整信息的情况,则通过弹框授权
-			if ($authScope == 'snsapi_userinfo') {
-				$baseInfo = wxUtil::authGetUserInfo($openId, $access_token);
-				$originalInfo = array_merge($baseInfo, $originalInfo);
-				$originalInfo['isFull'] = 1;
-				$originalInfo['unionId'] = $baseInfo['unionid'];
-				$originalInfo['headImgUrl'] = $baseInfo['headimgurl'];
-				$originalInfo['nickName'] = $baseInfo['nickName'];
-			}
-			$user = UserService::replaceUser($originalInfo, $source, $merchantId);
-		} else {
-			if ($user['isFull'] == 0) {
-				if ($authScope == 'snsapi_userinfo') {
-					$baseInfo = wxUtil::authGetUserInfo($openId, $access_token);
-					$originalInfo = $baseInfo;
-					$originalInfo['isFull'] = 1;
-					$originalInfo['unionId'] = $baseInfo['unionid'];
-					$originalInfo['headImgUrl'] = $baseInfo['headimgurl'];
-					$originalInfo['openId'] = $baseInfo['openid'];
-					$originalInfo['nickName'] = $baseInfo['nickName'];
-					$originalInfo['merchantId'] = $merchantId;
-					$user = UserService::replaceUser($originalInfo, $source, $merchantId);
-				}
-			}
-		}
-		//这个的基类没有设置统一的全局变量,这里进行设置一次
-		$userId = $user['id'];
-		$admin = AdminService::getByCondition(['userId' => $userId]);
-		if (empty($admin)) {
-			util::fail('您没有权限访问');
-		}
-		$adminId = $admin['id'];
-		//获取token
-		$token = jwt::getNewToken($adminId);
-		$url = strpos($url, '?') === false ? $url . '?token=' . $token : $url . '&token=' . $token;
-		$this->redirect($url);
-	}
-	
-	//登陆并拿到token shish 2019.11.23
-	public function actionLogin()
-	{
-		$get = Yii::$app->request->get();
-		$mobile = isset($get['mobile']) ? $get['mobile'] : 0;
-		if (stringUtil::isMobile($mobile) == false) {
-			util::fail('请填写正常的手机号');
-		}
-		$password = isset($get['password']) && !empty($get['password']) ? $get['password'] : '';
-		if (empty($password)) {
-			util::fail('请输入密码');
-		}
-		$admin = AdminService::getByCondition(['mobile' => $mobile]);
-		if (password_verify($password, $admin['password']) == false) {
-			util::fail('密码错误');
-		}
-		$adminId = $admin['id'];
-		$shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId]);
-		$merchantId = isset($shopAdmin['merchantId']) ? $shopAdmin['merchantId'] : 0;
-		$shopId = isset($shopAdmin['shopId']) ? $shopAdmin['shopId'] : 0;
-		if (empty($shopId)) {
-			util::fail('您不是管理员');
-		}
-		//管理员关联门店
-		Yii::$app->redis->executeCommand('SET', ['LOGIN_ADMIN_SHOP' . $adminId, $shopId]);
-		//获取token
-		$token = jwt::getNewToken($adminId);
-		util::success(['token' => $token, 'account' => $merchantId, 'shopId' => $shopId]);
-	}
-	
-	//静默获取小程序用户信息
-	public function actionMiniInfo()
-	{
-		$code = Yii::$app->request->get('code', '');
-		if (empty($code)) {
-			util::fail('没有CODE信息');
-		}
-		$wxMiniBase = WxOpenClass::getGhsWxInfo();
-		$appId = $wxMiniBase['miniAppId'];
-		$appSecret = $wxMiniBase['miniAppSecret'];
-		if (empty($appSecret)) {
-			util::fail('没有找到小程序的密钥');
-		}
-		$url = "https://api.weixin.qq.com/sns/jscode2session?appid={$appId}&secret={$appSecret}&js_code={$code}&grant_type=authorization_code";
-		$curl = new curl\Curl();
-		$result = $curl->get($url);
-		$arr = Json::decode($result);
-		$sessionKey = isset($arr['session_key']) ? $arr['session_key'] : '';
-		$openid = isset($arr['openid']) ? $arr['openid'] : '';
-		if (empty($openid)) {
-			Yii::info(json_encode($arr));
-			util::fail('没有获取到小程序openId');
-		}
-		$cacheKey = 'GHS_SHOP_MINI_SESSION_KEY_' . $openid;
-		Yii::$app->redis->executeCommand('SET', [$cacheKey, $sessionKey]);
-		//用户来源
-		$userSource = UserClass::$userSourceId['mini']['name'];
-		$admin = AdminService::getByMiniOpenId($openid);
-		if (empty($admin)) {
-			$adminInfo = ['miniOpenId' => $openid];
-			$admin = AdminService::replaceAdmin($adminInfo, $userSource);
-		}
-		$adminId = $admin['id'];
-		$currentShopId = $admin['currentShopId'] ?? 0;
-		//员工id
-		$shopAdminId = 0;
-		if (!empty($currentShopId)) {
-			$shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId]);
-			$shopAdminId = $shopAdmin['id'] ?? 0;
-		}
-		$admin['avatar'] = Yii::$app->params['imgHost'] . '/retail/default-img.png';
-		$token = jwt::getNewToken($adminId);
-		util::success(['token' => $token, 'admin' => $admin, 'shopAdminId' => $shopAdminId, 'shopId' => $currentShopId]);
-	}
-	
+
+    //准备授权 shish 2019.11.19
+    public function actionPrepare()
+    {
+        $get = Yii::$app->request->get();
+        $url = isset($get['url']) && !empty($get['url']) ? $get['url'] : '';
+        if (empty($url)) {
+            util::fail('没有网址');
+        }
+        $account = httpUtil::getAccount($url);
+        if (empty($account)) {
+            util::fail('没有商家帐号');
+        }
+        $merchant = MerchantService::getById($account);
+        if (empty($merchant)) {
+            util::fail('商家无效');
+        }
+        /**
+         * authScope 参数的说明
+         * 1.用户通过公众号菜单打开网页,因为已经关注过了公众号,已经生成过用户信息,所以只要使用snsapi_base静默方式拿到openid就可以
+         * 2.为了保证付款页的访问速度,暂时只要通过snsapi_base静默方式拿到openid先生成可以用的用户信息即可
+         * 3.其它情况需要获取用户完整信息的,使用snsapi_userinfo让用户授权获取信息即可
+         * 4.snsapi_base静默方式使用的场景更多,所以参数authScope默认使用snsapi_base
+         */
+        $authScope = isset($get['authScope']) ? $get['authScope'] : 'snsapi_base';
+        $urlEncode = stringUtil::urlSafeB64Encode($url);
+        //微信授权获取code shish 2019.11.24
+        wxUtil::getCode($urlEncode, $merchant, $authScope);
+        util::end();
+    }
+
+    //微信授权获取用户信息 shish 2019.11.20
+    public function actionGetUserInfo()
+    {
+        $get = Yii::$app->request->get();
+        $code = isset($get['code']) ? $get['code'] : '';
+        if (empty($code)) {
+            util::fail('没有获取用户code');
+        }
+        if (isset($get['state']) && $get['state'] == 'authdeny') {
+            util::fail('auth fail');
+        }
+        $urlEncode = $get['url'];
+        $url = stringUtil::urlSafeBase64Decode($urlEncode);
+        $account = httpUtil::getAccount($url);
+        if (empty($account)) {
+            util::stop('商店ID无效!!');
+        }
+        $merchant = xhMerchantService::getByAccount($account);
+        if (empty($merchant)) {
+            util::stop('商店无效');
+        }
+        $merchantId = $merchant['id'];
+        $authScope = isset($get['authScope']) ? $get['authScope'] : '';
+        if (empty($authScope)) {
+            util::stop('没有授权类型');
+        }
+        $data = wxUtil::getOpenId($code, $merchant);
+        if ($data === false) {
+            //微信授权获取code shish 2019.11.24
+            wxUtil::getCode($urlEncode, $merchant, $authScope);
+            util::end();
+        }
+        $openId = $data['openid'];
+        $access_token = $data['access_token'];
+        $user = UserService::getByOpenId($openId, $merchantId);
+        //用户来源
+        $userSource = Yii::$app->dict->getValue('userSourceGetId', 'official');
+        $source = $userSource['name'];
+        if (empty($user)) {
+            //$authScope 默认是 snsapi_base 公众号菜单打开网页(已经关注公众号,有完整信息)、打开付款页(有些客户只付款,没有后续可以不用登记完整信息),只需要获取openid
+            $originalInfo = [];
+            $originalInfo['openId'] = $openId;
+            $originalInfo['merchantId'] = $merchantId;
+
+            //没有关注公众号,需要获取用户完整信息的情况,则通过弹框授权
+            if ($authScope == 'snsapi_userinfo') {
+                $baseInfo = wxUtil::authGetUserInfo($openId, $access_token);
+                $originalInfo = array_merge($baseInfo, $originalInfo);
+                $originalInfo['isFull'] = 1;
+                $originalInfo['unionId'] = $baseInfo['unionid'];
+                $originalInfo['headImgUrl'] = $baseInfo['headimgurl'];
+                $originalInfo['nickName'] = $baseInfo['nickName'];
+            }
+            $user = UserService::replaceUser($originalInfo, $source, $merchantId);
+        } else {
+            if ($user['isFull'] == 0) {
+                if ($authScope == 'snsapi_userinfo') {
+                    $baseInfo = wxUtil::authGetUserInfo($openId, $access_token);
+                    $originalInfo = $baseInfo;
+                    $originalInfo['isFull'] = 1;
+                    $originalInfo['unionId'] = $baseInfo['unionid'];
+                    $originalInfo['headImgUrl'] = $baseInfo['headimgurl'];
+                    $originalInfo['openId'] = $baseInfo['openid'];
+                    $originalInfo['nickName'] = $baseInfo['nickName'];
+                    $originalInfo['merchantId'] = $merchantId;
+                    $user = UserService::replaceUser($originalInfo, $source, $merchantId);
+                }
+            }
+        }
+        //这个的基类没有设置统一的全局变量,这里进行设置一次
+        $userId = $user['id'];
+        $admin = AdminService::getByCondition(['userId' => $userId]);
+        if (empty($admin)) {
+            util::fail('您没有权限访问');
+        }
+        $adminId = $admin['id'];
+        //获取token
+        $token = jwt::getNewToken($adminId);
+        $url = strpos($url, '?') === false ? $url . '?token=' . $token : $url . '&token=' . $token;
+        $this->redirect($url);
+    }
+
+    //登陆并拿到token shish 2019.11.23
+    public function actionLogin()
+    {
+        $get = Yii::$app->request->get();
+        $mobile = isset($get['mobile']) ? $get['mobile'] : 0;
+        if (stringUtil::isMobile($mobile) == false) {
+            util::fail('请填写正常的手机号');
+        }
+        $password = isset($get['password']) && !empty($get['password']) ? $get['password'] : '';
+        if (empty($password)) {
+            util::fail('请输入密码');
+        }
+        $admin = AdminService::getByCondition(['mobile' => $mobile]);
+        if (password_verify($password, $admin['password']) == false) {
+            util::fail('密码错误');
+        }
+        $adminId = $admin['id'];
+        $shopAdmin = ShopAdminService::getByCondition(['adminId' => $adminId]);
+        $merchantId = isset($shopAdmin['merchantId']) ? $shopAdmin['merchantId'] : 0;
+        $shopId = isset($shopAdmin['shopId']) ? $shopAdmin['shopId'] : 0;
+        if (empty($shopId)) {
+            util::fail('您不是管理员');
+        }
+        //管理员关联门店
+        Yii::$app->redis->executeCommand('SET', ['LOGIN_ADMIN_SHOP' . $adminId, $shopId]);
+        //获取token
+        $token = jwt::getNewToken($adminId);
+        util::success(['token' => $token, 'account' => $merchantId, 'shopId' => $shopId]);
+    }
+
+    //静默获取小程序用户信息
+    public function actionMiniInfo()
+    {
+        $code = Yii::$app->request->get('code', '');
+        if (empty($code)) {
+            util::fail('没有CODE信息');
+        }
+        $wxMiniBase = WxOpenClass::getGhsWxInfo();
+        $appId = $wxMiniBase['miniAppId'];
+        $appSecret = $wxMiniBase['miniAppSecret'];
+        if (empty($appSecret)) {
+            util::fail('没有找到小程序的密钥');
+        }
+        $url = "https://api.weixin.qq.com/sns/jscode2session?appid={$appId}&secret={$appSecret}&js_code={$code}&grant_type=authorization_code";
+        $curl = new curl\Curl();
+        $result = $curl->get($url);
+        $arr = Json::decode($result);
+        $sessionKey = isset($arr['session_key']) ? $arr['session_key'] : '';
+        $openid = isset($arr['openid']) ? $arr['openid'] : '';
+        if (empty($openid)) {
+            Yii::info(json_encode($arr));
+            util::fail('没有获取到小程序openId');
+        }
+        $cacheKey = 'GHS_SHOP_MINI_SESSION_KEY_' . $openid;
+        Yii::$app->redis->executeCommand('SET', [$cacheKey, $sessionKey]);
+        //用户来源
+        $userSource = UserClass::$userSourceId['mini']['name'];
+        $admin = AdminService::getByMiniOpenId($openid);
+        if (empty($admin)) {
+            $adminInfo = ['miniOpenId' => $openid];
+            $admin = AdminService::replaceAdmin($adminInfo, $userSource);
+        }
+        $adminId = $admin['id'];
+        $currentShopId = $admin['currentShopId'] ?? 0;
+        //员工id
+        $shopAdminId = 0;
+        if (!empty($currentShopId)) {
+            $shopAdmin = ShopAdminClass::getByCondition(['shopId' => $currentShopId, 'adminId' => $adminId]);
+            $shopAdminId = $shopAdmin['id'] ?? 0;
+        }
+        $admin['avatar'] = Yii::$app->params['imgHost'] . '/retail/default-img.png';
+        $token = jwt::getNewToken($adminId);
+
+        util::success(['token' => $token, 'admin' => $admin, 'shopAdminId' => $shopAdminId, 'shopId' => $currentShopId,]);
+    }
+
 }

+ 17 - 0
app/ghs/controllers/ConsoleController.php

@@ -53,4 +53,21 @@ class ConsoleController extends BaseController
         ]);
     }
 
+    //常用初始化
+    public function actionInit()
+    {
+        $constant = [
+            //默认的日期搜索选项
+            'defaultDateSearchOption' => [
+                ['name' => '昨天', 'value' => 1, 'type' => 'fixed'],
+                ['name' => '今天', 'value' => 2, 'type' => 'fixed'],
+                ['name' => '本月', 'value' => 3, 'type' => 'fixed'],
+                ['name' => '上月', 'value' => 4, 'type' => 'fixed'],
+                ['name' => '今年', 'value' => 5, 'type' => 'fixed'],
+                ['name' => '自定义', 'value' => 6, 'type' => 'custom'],
+            ],
+        ];
+        util::success(['constant' => $constant]);
+    }
+
 }

+ 66 - 49
app/shop/controllers/ConsoleController.php

@@ -13,53 +13,70 @@ use common\components\util;
 
 class ConsoleController extends BaseController
 {
-	
-	//概况 shish 2019.12.19
-	public function actionProfile()
-	{
-		$asset = MerchantAssetService::getByMerchantId($this->sjId);
-		$notice = [
-			['title' => '您的试用期还有7天,点击免费续期1年 ', 'action' => '详情', 'clickHint' => '请在手机上进行续费', 'url' => 'http://www.test.com', 'page' => 'page/notice/recharge'],
-		];
-		//今天访客数
-		$todayVisit = StatVisitService::getTodayVisitNum($this->sjId);
-		//今天客户与粉丝数
-		$userData = StatUserService::getTodayNum($this->sjId);
-		$todayFansNum = isset($userData['riseFansNum']) ? $userData['riseFansNum'] : 0;
-		$todayUserNum = isset($userData['riseUserNum']) ? $userData['riseUserNum'] : 0;
-		//今天订单数
-		$orderData = StatOrderService::getTodayNum($this->sjId);
-		$todayOrder = isset($orderData['riseNum']) ? $orderData['riseNum'] : 0;
-		//今天收入
-		$incomeData = StatIncomeService::getTodayNum($this->sjId);
-		$todayIncome = isset($incomeData['amount']) ? $incomeData['amount'] : 0;
-		$todayData = ['visit' => $todayVisit, 'fans' => $todayFansNum, 'user' => $todayUserNum, 'income' => $todayIncome, 'order' => $todayOrder];
-		
-		//当月的收入
-		$currentMonthIncome = StatIncomeMonthService::getCurrentMonthIncome($this->sjId);
-		//上个月收入
-		$previousMonthIncome = StatIncomeMonthService::getPreviousMonthIncome($this->sjId);
-		//最近7天收入变化趋势
-		$latestIncome = StatIncomeService::getLatestSevenDay($this->sjId);
-		$incomeStat = [
-			'month' => $currentMonthIncome,
-			'week' => 999,
-			'previousMonth' => $previousMonthIncome,
-			'list' => $latestIncome,
-		];
-		$visitStat = [
-			'month' => 1999,
-			'week' => 999,
-			'list' => ['7.1' => 100, '7.2' => 200, '7.3' => 300, '7.4' => 400, '7.5' => 500],
-		];
-		util::success([
-			'asset' => $asset,
-			'notice' => $notice,
-			'todayData' => $todayData,
-			'admin' => ['avatar' => 'http://a.huahb.com/images/avatar.jpg'],
-			'visitStat' => $visitStat,
-			'incomeStat' => $incomeStat,
-		]);
-	}
-	
+
+    //概况 shish 2019.12.19
+    public function actionProfile()
+    {
+        $asset = MerchantAssetService::getByMerchantId($this->sjId);
+        $notice = [
+            ['title' => '您的试用期还有7天,点击免费续期1年 ', 'action' => '详情', 'clickHint' => '请在手机上进行续费', 'url' => 'http://www.test.com', 'page' => 'page/notice/recharge'],
+        ];
+        //今天访客数
+        $todayVisit = StatVisitService::getTodayVisitNum($this->sjId);
+        //今天客户与粉丝数
+        $userData = StatUserService::getTodayNum($this->sjId);
+        $todayFansNum = isset($userData['riseFansNum']) ? $userData['riseFansNum'] : 0;
+        $todayUserNum = isset($userData['riseUserNum']) ? $userData['riseUserNum'] : 0;
+        //今天订单数
+        $orderData = StatOrderService::getTodayNum($this->sjId);
+        $todayOrder = isset($orderData['riseNum']) ? $orderData['riseNum'] : 0;
+        //今天收入
+        $incomeData = StatIncomeService::getTodayNum($this->sjId);
+        $todayIncome = isset($incomeData['amount']) ? $incomeData['amount'] : 0;
+        $todayData = ['visit' => $todayVisit, 'fans' => $todayFansNum, 'user' => $todayUserNum, 'income' => $todayIncome, 'order' => $todayOrder];
+
+        //当月的收入
+        $currentMonthIncome = StatIncomeMonthService::getCurrentMonthIncome($this->sjId);
+        //上个月收入
+        $previousMonthIncome = StatIncomeMonthService::getPreviousMonthIncome($this->sjId);
+        //最近7天收入变化趋势
+        $latestIncome = StatIncomeService::getLatestSevenDay($this->sjId);
+        $incomeStat = [
+            'month' => $currentMonthIncome,
+            'week' => 999,
+            'previousMonth' => $previousMonthIncome,
+            'list' => $latestIncome,
+        ];
+        $visitStat = [
+            'month' => 1999,
+            'week' => 999,
+            'list' => ['7.1' => 100, '7.2' => 200, '7.3' => 300, '7.4' => 400, '7.5' => 500],
+        ];
+        util::success([
+            'asset' => $asset,
+            'notice' => $notice,
+            'todayData' => $todayData,
+            'admin' => ['avatar' => 'http://a.huahb.com/images/avatar.jpg'],
+            'visitStat' => $visitStat,
+            'incomeStat' => $incomeStat,
+        ]);
+    }
+
+    //常用初始化
+    public function actionInit()
+    {
+        $constant = [
+            //默认的日期搜索选项
+            'defaultDateSearchOption' => [
+                ['name' => '昨天', 'value' => 1, 'type' => 'fixed'],
+                ['name' => '今天', 'value' => 2, 'type' => 'fixed'],
+                ['name' => '本月', 'value' => 3, 'type' => 'fixed'],
+                ['name' => '上月', 'value' => 4, 'type' => 'fixed'],
+                ['name' => '今年', 'value' => 5, 'type' => 'fixed'],
+                ['name' => '自定义', 'value' => 6, 'type' => 'custom'],
+            ],
+        ];
+        util::success(['constant' => $constant]);
+    }
+
 }

+ 12 - 7
biz-ghs/order/classes/OrderClass.php

@@ -126,18 +126,18 @@ class OrderClass extends BaseClass
         }
         //列表页显示的按钮
         if ($isList) {
-            $item = ['type' => 'item', 'show' => 1, 'disable' => 0];
+            $item = ['type' => 'item', 'show' => 1, 'disable' => 1];
             $send = ['type' => 'send', 'show' => 1, 'disable' => 0];
             $selfGet = ['type' => 'selfGet', 'show' => 1, 'disable' => 1];
-            if ($order['sendStatus'] > 0) {
-                //只有待发货订单,花材按钮才能点击
-                $item['disable'] = 1;
+            if (in_array($order['status'], [self::ORDER_STATUS_UN_PAY, self::ORDER_STATUS_UN_SEND])) {
+                //待付款和待配送订单,改花材按钮才能点击
+                $item['disable'] = 0;
             }
-            if ($order['sendType'] == 1) {
+            if ($order['sendType'] == self::SEND_TYPE_NO) {
                 //自取订单,发货按钮不可点
                 $send['disable'] = 1;
             }
-            if ($order['sendType'] == 0) {
+            if ($order['sendType'] == self::SEND_TYPE_UNKNOWN) {
                 //只有未确认配送方式的订单才可点击自取
                 $selfGet['disable'] = 0;
             }
@@ -175,7 +175,12 @@ class OrderClass extends BaseClass
         }
         if ($order['status'] == OrderClass::ORDER_STATUS_COMPLETE) {
             $print = ['type' => 'print', 'show' => 1, 'disable' => 1];
-            return [$print];
+            $send = ['type' => 'send', 'show' => 1, 'disable' => 1];
+            //自取订单不显示发货按钮
+            if ($order['sendType'] == self::SEND_TYPE_NO) {
+                $send['show'] = 0;
+            }
+            return [$print, $send];
         }
         return [];
     }