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,
'mobile' => $params['mobile'],
'user_ship' => $params['user_ship']??0,
'label_id' => $params['label_id']??0,
];
$res=User::create($data);

View File

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

View File

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