diff --git a/app/controller/api/Coupon.php b/app/controller/api/Coupon.php index 567cf0f..ac733c9 100644 --- a/app/controller/api/Coupon.php +++ b/app/controller/api/Coupon.php @@ -764,6 +764,7 @@ class Coupon extends Base public function getShopCouponList() { $accountId = $this->request->user['user_id'] ?? 0; + $keyword = input("key/s"); $account = AccountRepository::getInstance()->findById($accountId, [], function ($q) { return $q->with(['business', 'parent']); }); @@ -798,6 +799,9 @@ class Coupon extends Base $whereMap = [ ["coupon_id","=",$couponMainId] ]; + if(!empty($keyword)){ + $whereMap[] = ["consumer_name", "like", "%{$keyword}%"]; + } switch ($type) { case 'all': // 全部持有优惠券 @@ -819,7 +823,7 @@ class Coupon extends Base $sortOrder = ['verificate_time' => 'desc']; break; } - $field = ["is_verificated","received_time","verificate_time","consumer_code"]; + $field = ["is_verificated","received_time","verificate_time","consumer_code","consumer_name"]; $data = CouponRepository::getInstance()->findList($whereMap,$field,$page,$size,function($q){ return $q->withjoin(["account"=>function($q){ $q->field(["nick_name","avatar_url","gender","user_code"]); diff --git a/app/controller/api/User.php b/app/controller/api/User.php index 356c76f..b2eeedc 100644 --- a/app/controller/api/User.php +++ b/app/controller/api/User.php @@ -162,7 +162,7 @@ class User extends Base throw new ValidateException('用户无效!'); } - if ($account['type'] == Account::type_business) { + if ( in_array($account['type'],[Account::type_business,Account::type_staff]) ) { // 商家用户 if (empty($account['business'])) { throw new ValidateException('用户无效!没有相关的商户信息记录'); @@ -204,36 +204,38 @@ class User extends Base ]; - if ($account['type'] == Account::type_staff) { - // 员工 - $businessCode = $account['parent']['business_code'] ?? ''; - if (!empty($businessCode)) { - $business = $busRepo->findOneByWhere(['code' => $businessCode]); - if ($business) { - $personalRes['business'] = [ - 'code' => $business['code'], - 'businessName' => $business['business_name'], - 'state' => $business['state'], - 'reason' => $business['reason'], - 'balance' => $business['balance'], - 'enable' => $business['enable'], - ]; - } - } +// if ($account['type'] == Account::type_staff) { +// // 员工 +// $businessCode = $account['parent']['business_code'] ?? ''; +// if (!empty($businessCode)) { +// $business = $busRepo->findOneByWhere(['code' => $businessCode]); +// if ($business) { +// $personalRes['business'] = [ +// 'code' => $business['code'], +// 'businessName' => $business['business_name'], +// 'state' => $business['state'], +// 'reason' => $business['reason'], +// 'balance' => $business['balance'], +// 'enable' => $business['enable'], +// ]; +// } +// } +// +// $personalRes['parent'] = []; +// if (!empty($account['parent'])) { +// $personalRes['parent'] = [ +// 'avatar' => File::convertCompleteFileUrl($account['parent']['avatar_url']), +// 'nickName' => $account['parent']['nick_name'], +// 'userType' => $account['parent']['type'], +// 'userTypeDes' => Account::accountTypeDescList()[$account['parent']['type']] ?? '', +// 'couponCount' => 0, +// 'businessCode' => $account['parent']['business_code'], +// ]; +// } +// +// } - $personalRes['parent'] = []; - if (!empty($account['parent'])) { - $personalRes['parent'] = [ - 'avatar' => File::convertCompleteFileUrl($account['parent']['avatar_url']), - 'nickName' => $account['parent']['nick_name'], - 'userType' => $account['parent']['type'], - 'userTypeDes' => Account::accountTypeDescList()[$account['parent']['type']] ?? '', - 'couponCount' => 0, - 'businessCode' => $account['parent']['business_code'], - ]; - } - - } elseif(!empty($account['business'])) { + if(!empty($account['business'])) { // 商户认证记录 $personalRes['business'] = [ 'state' => $account['business']['state'], diff --git a/app/repository/BillRepository.php b/app/repository/BillRepository.php index d1dafa3..301d408 100644 --- a/app/repository/BillRepository.php +++ b/app/repository/BillRepository.php @@ -213,7 +213,7 @@ class BillRepository extends Repository ->order($orders) ->select(); $failData["list"]->each(function ($item){ - if(empty($item->agency_code)){ + if(!empty($item->agency_code)){ $item->agency_business_name = MemberModel::whereRaw("FIND_IN_SET('".MemberModel::ANENT_ROLE_ID."',roles)" ) ->where("business_code",$item->agency_code)->value("nickname",""); }else{ diff --git a/app/repository/BusinessRepository.php b/app/repository/BusinessRepository.php index 1ccabb2..10967b4 100644 --- a/app/repository/BusinessRepository.php +++ b/app/repository/BusinessRepository.php @@ -142,7 +142,7 @@ class BusinessRepository extends Repository { return Business::alias("a") ->join("account b", "a.code = b.business_code") - ->field("a.code , a.business_name ") + ->field("a.code , a.business_name , a.contact_name") ->order("a.id desc") ->group("a.id") ->select(); diff --git a/view/manager/agency/edit_channel.html b/view/manager/agency/edit_channel.html index 16a02ef..ccf0e42 100644 --- a/view/manager/agency/edit_channel.html +++ b/view/manager/agency/edit_channel.html @@ -35,7 +35,8 @@