feat: 新增用户标签功能

This commit is contained in:
mkm 2024-06-22 16:21:46 +08:00
parent 149946b45f
commit 025134aacd
3 changed files with 28 additions and 20 deletions

View File

@ -90,6 +90,7 @@ class UserLogic extends BaseLogic
'password' => $password, 'password' => $password,
'mobile' => $params['mobile'], 'mobile' => $params['mobile'],
'user_ship' => $params['user_ship']??0, 'user_ship' => $params['user_ship']??0,
'label_id' => $params['label_id']??0,
]; ];
$res=User::create($data); $res=User::create($data);

View File

@ -54,6 +54,7 @@ class StoreController extends BaseApiController
{ {
$params = (new UserValidate())->post()->goCheck('rechargeStoreMoney'); $params = (new UserValidate())->post()->goCheck('rechargeStoreMoney');
$auth_code = $this->request->post('auth_code'); //微信支付条码 $auth_code = $this->request->post('auth_code'); //微信支付条码
$recharge_type = $this->request->post('recharge_type',''); //微信支付条码
$find=User::where('mobile',$params['mobile'])->find(); $find=User::where('mobile',$params['mobile'])->find();
if(!$find){ if(!$find){
$find=UserUserLogic::StoreAdd($params); $find=UserUserLogic::StoreAdd($params);
@ -61,6 +62,9 @@ class StoreController extends BaseApiController
$find['real_name']=$params['real_name']; $find['real_name']=$params['real_name'];
$find->save(); $find->save();
} }
if($recharge_type!='INDUSTRYMEMBERS'){
return $this->success('添加用户成功');
}
$data=[ $data=[
'store_id'=>$params['store_id'], 'store_id'=>$params['store_id'],
'uid'=>$find['id'], 'uid'=>$find['id'],

View File

@ -28,7 +28,7 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
public function setSearch(): array public function setSearch(): array
{ {
return [ return [
'=' => ['pay_type','paid'], '=' => ['pay_type', 'paid'],
'%like%' => ['order_id'], '%like%' => ['order_id'],
'between_time' => 'create_time', 'between_time' => 'create_time',
]; ];
@ -46,37 +46,40 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
*/ */
public function lists(): array public function lists(): array
{ {
$store_id = $this->adminInfo['store_id']??5; $store_id = $this->adminInfo['store_id'] ?? 5;
$is_sashier=$this->request->get('is_sashier'); $is_sashier = $this->request->get('is_sashier');
if($is_sashier==1){//收银台订单 if ($is_sashier == 1) { //收银台订单
$this->searchWhere[] = ['store_id' ,'=',$store_id]; $this->searchWhere[] = ['store_id', '=', $store_id];
$this->searchWhere[] = ['pay_type','in',[17,9,13,18]]; $this->searchWhere[] = ['pay_type', 'in', [17, 9, 13, 18]];
}elseif($is_sashier==2){//小程序订单 } elseif ($is_sashier == 2) { //小程序订单
$this->searchWhere[] = ['pay_type','in',[7,3,18]]; $this->searchWhere[] = ['pay_type', 'in', [7, 3, 18]];
} }
return StoreOrder::where($this->searchWhere) return StoreOrder::where($this->searchWhere)
->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status','paid','total_num']) ->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status', 'paid', 'total_num'])
->limit($this->limitOffset, $this->limitLength) ->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc']) ->order(['id' => 'desc'])
->select()->each(function ($item) use ($store_id) { ->select()->each(function ($item) use ($store_id) {
if(empty($item['pay_time'])){ if (empty($item['pay_time'])) {
$item['pay_time'] = ''; $item['pay_time'] = '';
}else{
$item['pay_time'] = date('Y-m-d H:i:s', $item['pay_time']);
} }
// $item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : ''; $item['pay_type_name'] = PayEnum::getPaySceneDesc($item['pay_type']) ?? '';
$item['pay_type_name'] =PayEnum::getPaySceneDesc($item['pay_type']) ?? '';
$item['status_name'] = OrderEnum::getOrderType($item['status']) ?? ''; $item['status_name'] = OrderEnum::getOrderType($item['status']) ?? '';
if ($item['paid'] == 0) { if ($item['paid'] == 0) {
$item['paid_name'] = '待支付'; $item['paid_name'] = '待支付';
}else{ } else {
$item['paid_name'] = '已支付'; $item['paid_name'] = '已支付';
} }
$product_id = StoreOrderCartInfo::where('oid', $item['id'])->limit(3)->column('product_id'); $product = StoreOrderCartInfo::where('oid', $item['id'])->field(['id', 'oid', 'product_id', 'cart_info'])
if ($product_id) { ->limit(3)->select();
$item['product_info'] = StoreBranchProduct::whereIn('product_id' ,$product_id)->where('store_id', $store_id)->field(['product_id', 'store_name', 'image', 'price']) foreach ($product as &$items) {
->select(); $items['store_name'] = $items['cart_info']['name'];
} else { $items['image'] = $items['cart_info']['image'];
$item['product_info'] = []; $items['price'] = $items['cart_info']['price'];
unset($items['cart_info']);
} }
$item['product_info'] = $product;
return $item; return $item;
}) })
->toArray(); ->toArray();