settter
parent
f6597d885a
commit
29847b2ad3
|
@ -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"]);
|
||||
|
|
|
@ -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'],
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
<select name="business_code" lay-search="" >
|
||||
<option value=""></option>
|
||||
{foreach $business as $bitem}
|
||||
<option value="{$bitem['code']}" {if $bitem['code']== $item['business_code']} selected {/if} > {$bitem['contact_name']}_{$bitem['business_name']}</option>
|
||||
<option value="{$bitem['code']}" {if $bitem['code']== $item['business_code']} selected {/if} >
|
||||
{$bitem['contact_name']}_{$bitem['business_name']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue