From 4e7d5a76fa0c9d1bc1f29ab1509fa663c12ba47d Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Wed, 13 Mar 2024 15:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dao/store/product/ProductAttrValueDao.php | 4 ++- app/controller/api/Auth.php | 36 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/app/common/dao/store/product/ProductAttrValueDao.php b/app/common/dao/store/product/ProductAttrValueDao.php index d51cf3fa..3cc100db 100644 --- a/app/common/dao/store/product/ProductAttrValueDao.php +++ b/app/common/dao/store/product/ProductAttrValueDao.php @@ -41,7 +41,9 @@ class ProductAttrValueDao extends BaseDao public function add($data,$isType) { foreach ($data as &$item) { - $item['profit_rate'] = bcdiv(bcsub($item['price'], $item['procure_price'], 2), $item['price'], 2) * 100; + if (isset($item['procure_price'])) { + $item['profit_rate'] = bcdiv(bcsub($item['price'], $item['procure_price'], 2), $item['price'], 2) * 100; + } } if ($isType == 2) { foreach ($data as $datum) { diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index 13ece6a2..7cf584f5 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -29,6 +29,7 @@ use app\common\model\user\UserRecharge; use app\common\repositories\store\order\StoreOrderRepository; use app\common\repositories\store\order\StoreRefundOrderRepository; use app\common\repositories\system\CacheRepository; +use app\common\repositories\system\RelevanceRepository; use app\common\repositories\user\UserRepository; use app\common\repositories\user\UserSignRepository; use app\common\repositories\wechat\RoutineQrcodeRepository; @@ -175,6 +176,41 @@ class Auth extends BaseController Cache::set($key, true, new \DateTime($day . ' 23:59:59')); } } + $data['is_wsxx'] = 0; + $data['mer_info'] = []; + // 判断是否是商户,并且有没有完善信息 + // 这里有点小问题以后要修改 + $store_service = Db::name('store_service')->where('uid', $data['uid'])->find(); + if ($store_service) { + $mer_arr = Db::name('merchant')->where('mer_id', $store_service['mer_id'])->where('is_del', 0)->field('type_id,mer_avatar,mer_banner,business_status,mer_info,category_id,service_phone,mer_address,uid,mer_name,create_time,update_time,mer_settlement_agree_status,is_margin,street_id,is_company,mer_money')->find(); + $bank_info = Db::name('merchant_intention')->where('mer_id', $store_service['mer_id'])->field('company_name,bank_username,bank_opening,bank_code')->find(); + if ($mer_arr && $mer_arr['mer_avatar'] != '' && $mer_arr['mer_banner'] != '' && $mer_arr['mer_info'] && $mer_arr['service_phone'] != '' && $mer_arr['mer_address'] != '') { + $data['is_wsxx'] = 1; + } + if($bank_info && count($bank_info)>0 && count($mer_arr)>0){ + $data['mer_info'] = array_merge($mer_arr,$bank_info); + }else{ + $data['mer_info'] =$mer_arr; + } + $merType = Db::name('merchant_type')->where('mer_type_id', $mer_arr['type_id'] ?? 0)->field('type_code,type_name')->find(); + $data['mer_info']['type_code'] = $merType['type_code']; + $data['mer_info']['type_name'] = $merType['type_name']; + $data['mer_info']['setting_status'] = 0; + if (!empty($mer_arr['mer_avatar']) && !empty($mer_arr['mer_banner']) && !empty($mer_arr['mer_address'])) { + $data['mer_info']['setting_status'] = 1; + } + } + $data['fan_num'] = app()->make(RelevanceRepository::class)->getUserFans($user->uid, 1, 1, 1); + $data['focus_num'] = app()->make(RelevanceRepository::class)->getUserFocus($user->uid, 1, 1, 1); + $data['community_num'] = Db::name('community')->where('uid', $user->uid)->whereIn('is_type', '1,2')->count(); + + $arr=env('APP_SHOW')??''; + $arr=explode(',',$arr); + if(in_array($user['uid'],$arr )){ + $data['show_controller_applet']=true; + }else{ + $data['show_controller_applet']=false; + } return app('json')->success($data); }