settter
parent
f6597d885a
commit
29847b2ad3
|
@ -764,6 +764,7 @@ class Coupon extends Base
|
||||||
public function getShopCouponList()
|
public function getShopCouponList()
|
||||||
{
|
{
|
||||||
$accountId = $this->request->user['user_id'] ?? 0;
|
$accountId = $this->request->user['user_id'] ?? 0;
|
||||||
|
$keyword = input("key/s");
|
||||||
$account = AccountRepository::getInstance()->findById($accountId, [], function ($q) {
|
$account = AccountRepository::getInstance()->findById($accountId, [], function ($q) {
|
||||||
return $q->with(['business', 'parent']);
|
return $q->with(['business', 'parent']);
|
||||||
});
|
});
|
||||||
|
@ -798,6 +799,9 @@ class Coupon extends Base
|
||||||
$whereMap = [
|
$whereMap = [
|
||||||
["coupon_id","=",$couponMainId]
|
["coupon_id","=",$couponMainId]
|
||||||
];
|
];
|
||||||
|
if(!empty($keyword)){
|
||||||
|
$whereMap[] = ["consumer_name", "like", "%{$keyword}%"];
|
||||||
|
}
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'all':
|
case 'all':
|
||||||
// 全部持有优惠券
|
// 全部持有优惠券
|
||||||
|
@ -819,7 +823,7 @@ class Coupon extends Base
|
||||||
$sortOrder = ['verificate_time' => 'desc'];
|
$sortOrder = ['verificate_time' => 'desc'];
|
||||||
break;
|
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){
|
$data = CouponRepository::getInstance()->findList($whereMap,$field,$page,$size,function($q){
|
||||||
return $q->withjoin(["account"=>function($q){
|
return $q->withjoin(["account"=>function($q){
|
||||||
$q->field(["nick_name","avatar_url","gender","user_code"]);
|
$q->field(["nick_name","avatar_url","gender","user_code"]);
|
||||||
|
|
|
@ -162,7 +162,7 @@ class User extends Base
|
||||||
throw new ValidateException('用户无效!');
|
throw new ValidateException('用户无效!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($account['type'] == Account::type_business) {
|
if ( in_array($account['type'],[Account::type_business,Account::type_staff]) ) {
|
||||||
// 商家用户
|
// 商家用户
|
||||||
if (empty($account['business'])) {
|
if (empty($account['business'])) {
|
||||||
throw new ValidateException('用户无效!没有相关的商户信息记录');
|
throw new ValidateException('用户无效!没有相关的商户信息记录');
|
||||||
|
@ -204,36 +204,38 @@ class User extends Base
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
if ($account['type'] == Account::type_staff) {
|
// if ($account['type'] == Account::type_staff) {
|
||||||
// 员工
|
// // 员工
|
||||||
$businessCode = $account['parent']['business_code'] ?? '';
|
// $businessCode = $account['parent']['business_code'] ?? '';
|
||||||
if (!empty($businessCode)) {
|
// if (!empty($businessCode)) {
|
||||||
$business = $busRepo->findOneByWhere(['code' => $businessCode]);
|
// $business = $busRepo->findOneByWhere(['code' => $businessCode]);
|
||||||
if ($business) {
|
// if ($business) {
|
||||||
$personalRes['business'] = [
|
// $personalRes['business'] = [
|
||||||
'code' => $business['code'],
|
// 'code' => $business['code'],
|
||||||
'businessName' => $business['business_name'],
|
// 'businessName' => $business['business_name'],
|
||||||
'state' => $business['state'],
|
// 'state' => $business['state'],
|
||||||
'reason' => $business['reason'],
|
// 'reason' => $business['reason'],
|
||||||
'balance' => $business['balance'],
|
// 'balance' => $business['balance'],
|
||||||
'enable' => $business['enable'],
|
// '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['business'])) {
|
||||||
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'])) {
|
|
||||||
// 商户认证记录
|
// 商户认证记录
|
||||||
$personalRes['business'] = [
|
$personalRes['business'] = [
|
||||||
'state' => $account['business']['state'],
|
'state' => $account['business']['state'],
|
||||||
|
|
|
@ -213,7 +213,7 @@ class BillRepository extends Repository
|
||||||
->order($orders)
|
->order($orders)
|
||||||
->select();
|
->select();
|
||||||
$failData["list"]->each(function ($item){
|
$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)" )
|
$item->agency_business_name = MemberModel::whereRaw("FIND_IN_SET('".MemberModel::ANENT_ROLE_ID."',roles)" )
|
||||||
->where("business_code",$item->agency_code)->value("nickname","");
|
->where("business_code",$item->agency_code)->value("nickname","");
|
||||||
}else{
|
}else{
|
||||||
|
|
|
@ -142,7 +142,7 @@ class BusinessRepository extends Repository
|
||||||
{
|
{
|
||||||
return Business::alias("a")
|
return Business::alias("a")
|
||||||
->join("account b", "a.code = b.business_code")
|
->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")
|
->order("a.id desc")
|
||||||
->group("a.id")
|
->group("a.id")
|
||||||
->select();
|
->select();
|
||||||
|
|
|
@ -35,7 +35,8 @@
|
||||||
<select name="business_code" lay-search="" >
|
<select name="business_code" lay-search="" >
|
||||||
<option value=""></option>
|
<option value=""></option>
|
||||||
{foreach $business as $bitem}
|
{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}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue